(node: Node, attributes: AttributeValue[])
| 15 | }; |
| 16 | |
| 17 | function annotate(node: Node, attributes: AttributeValue[]) { |
| 18 | for (const attribute of attributes) { |
| 19 | node.annotations.push(attribute); |
| 20 | |
| 21 | const { name, value, type } = attribute; |
| 22 | if (type === 'attribute') { |
| 23 | if (node.attributes[name] !== undefined) |
| 24 | node.errors.push({ |
| 25 | id: 'duplicate-attribute', |
| 26 | level: 'warning', |
| 27 | message: `Attribute '${name}' already set`, |
| 28 | }); |
| 29 | node.attributes[name] = value; |
| 30 | } else if (type === 'class') |
| 31 | if (node.attributes.class) node.attributes.class[name] = value; |
| 32 | else node.attributes.class = { [name]: value }; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | function handleAttrs(token: Token, type: string) { |
| 37 | switch (type) { |
no test coverage detected
searching dependent graphs…