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

Function isInternalElement

src/core/dom/query.js:385–395  ·  view source on GitHub ↗

* Whether the tag is an internal (service) AMP tag. * @param {Node|string} nodeOrTagName * @return {boolean}

(nodeOrTagName)

Source from the content-addressed store, hash-verified

383 * @return {boolean}
384 */
385function isInternalElement(nodeOrTagName) {
386 /** @type {undefined|string} */
387 let tagName;
388 if (isString(nodeOrTagName)) {
389 tagName = nodeOrTagName;
390 } else if (isElement(nodeOrTagName)) {
391 tagName = nodeOrTagName.tagName;
392 }
393
394 return !!tagName && tagName.toLowerCase().startsWith('i-');
395}
396
397/**
398 * Finds a matching node inside an HTML template slot's children

Callers 1

isInternalOrServiceNodeFunction · 0.85

Calls 2

isStringFunction · 0.90
isElementFunction · 0.90

Tested by

no test coverage detected