MCPcopy Index your code
hub / github.com/prototypejs/prototype / match

Function match

src/prototype/dom/dom.js:1553–1562  ·  view source on GitHub ↗

* Element.match(@element, selector) -> boolean * - selector (String): A CSS selector. * * Checks if `element` matches the given CSS selector. * * ##### Examples * * language: html * * * *

(element, selector)

Source from the content-addressed store, hash-verified

1551 * // -> false
1552 **/
1553 function match(element, selector) {
1554 element = $(element);
1555
1556 // If selector is a string, we assume it's a CSS selector.
1557 if (Object.isString(selector))
1558 return Prototype.Selector.match(element, selector);
1559
1560 // Otherwise, we assume it's an object with its own `match` method.
1561 return selector.match(element);
1562 }
1563
1564
1565 // Internal method for optimizing traversal. Works like

Callers 1

deprecated.jsFile · 0.50

Calls 1

$Function · 0.85

Tested by

no test coverage detected