MCPcopy Index your code
hub / github.com/ampproject/amphtml / dedupeAttrs

Method dedupeAttrs

validator/js/engine/htmlparser-interface.js:311–323  ·  view source on GitHub ↗

* Removes duplicate attributes from the attribute list. This is consistent * with HTML5 parsing error handling rules, only the first attribute with * each attribute name is considered, the remainder are ignored.

()

Source from the content-addressed store, hash-verified

309 * each attribute name is considered, the remainder are ignored.
310 */
311 dedupeAttrs() {
312 /** @type {!Array<!Object>} */
313 const newAttrs = [];
314 /** @type {string} */
315 let lastAttrName = '';
316 for (const attr of this.attrs_) {
317 if (lastAttrName !== attr.name) {
318 newAttrs.push(attr);
319 }
320 lastAttrName = attr.name;
321 }
322 this.attrs_ = newAttrs;
323 }
324 /**
325 * Returns the value of a given attribute name. If it does not exist then
326 * returns null.

Callers 2

startTagMethod · 0.80
startTagMethod · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected