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

Function elementStringOrPassThru

src/core/error/message-helpers.js:22–29  ·  view source on GitHub ↗
(val)

Source from the content-addressed store, hash-verified

20 * @return {*}
21 */
22export function elementStringOrPassThru(val) {
23 // Do check equivalent to `val instanceof Element` without cross-window bug
24 if (isElement(val)) {
25 val = /** @type {Element} */ (val);
26 return val.tagName.toLowerCase() + (val.id ? `#${val.id}` : '');
27 }
28 return val;
29}
30
31/**
32 * Tests if an error message contains the user sentinel.

Callers 2

assertFunction · 0.90

Calls 1

isElementFunction · 0.90

Tested by

no test coverage detected