* Returns a duplicate attribute name if the tag contains two attributes * named the same, but with different attribute values. Same attribute name * AND value is OK. Returns null if there are no such duplicate attributes. * @return {?string}
()
| 290 | * @return {?string} |
| 291 | */ |
| 292 | hasDuplicateAttrs() { |
| 293 | /** @type {string} */ |
| 294 | let lastAttrName = ''; |
| 295 | /** @type {string} */ |
| 296 | let lastAttrValue = ''; |
| 297 | for (const attr of this.attrs()) { |
| 298 | if (lastAttrName === attr.name && lastAttrValue !== attr.value) { |
| 299 | return attr.name; |
| 300 | } |
| 301 | lastAttrName = attr.name; |
| 302 | lastAttrValue = attr.value; |
| 303 | } |
| 304 | return null; |
| 305 | } |
| 306 | /** |
| 307 | * Removes duplicate attributes from the attribute list. This is consistent |
| 308 | * with HTML5 parsing error handling rules, only the first attribute with |