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

Function assertIsName

src/core/dom/query.js:15–20  ·  view source on GitHub ↗

* Asserts that name is just an alphanumeric word, and does not contain * advanced CSS selector features like attributes, pseudo-classes, class names, * nor ids. * @param {string} name

(name)

Source from the content-addressed store, hash-verified

13 * @param {string} name
14 */
15function assertIsName(name) {
16 devAssert(
17 /^[\w-]+$/.test(name),
18 `Expected "${name}" to be a CSS name composed of alphanumerics and hyphens.`
19 );
20}
21
22/**
23 * Finds all elements that matche `selector`, scoped inside `root`

Callers 7

ancestorElementsByTagFunction · 0.85
childElementByAttrFunction · 0.85
lastChildElementByAttrFunction · 0.85
childElementsByAttrFunction · 0.85
childElementByTagFunction · 0.85
childElementsByTagFunction · 0.85
elementByTagFunction · 0.85

Calls 2

devAssertFunction · 0.90
testMethod · 0.45

Tested by

no test coverage detected