MCPcopy Create free account
hub / github.com/ampproject/amphtml / htmlRefs

Function htmlRefs

src/core/dom/static-template.js:122–136  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

120 * @return {{[key: string]: HTMLElement}}
121 */
122export function htmlRefs(root) {
123 const elements = root.querySelectorAll('[ref]');
124 const refs = map();
125
126 for (let i = 0; i < elements.length; i++) {
127 const element = elements[i];
128 const ref = element.getAttribute('ref');
129 devAssert(ref, 'Empty ref attr');
130 element.removeAttribute('ref');
131 devAssert(refs[ref] === undefined, 'Duplicate ref');
132 refs[ref] = element;
133 }
134
135 return refs;
136}

Callers 8

renderElementsFunction · 0.90
test-animation.jsFile · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
refreshDefaultRecBox_Method · 0.90

Calls 3

mapFunction · 0.90
devAssertFunction · 0.90
getAttributeMethod · 0.80

Tested by

no test coverage detected