| | |
| | | "use strict"; |
| | | var __spreadArray = (this && this.__spreadArray) || function (to, from) { |
| | | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) |
| | | to[j] = from[i]; |
| | | return to; |
| | | var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { |
| | | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { |
| | | if (ar || !(i in from)) { |
| | | if (!ar) ar = Array.prototype.slice.call(from, 0, i); |
| | | ar[i] = from[i]; |
| | | } |
| | | } |
| | | return to.concat(ar || Array.prototype.slice.call(from)); |
| | | }; |
| | | Object.defineProperty(exports, "__esModule", { value: true }); |
| | | exports.subselects = exports.getNextSiblings = exports.ensureIsTag = exports.PLACEHOLDER_ELEMENT = void 0; |
| | |
| | | return function (elem) { return func(elem) && next(elem); }; |
| | | }; |
| | | /* |
| | | * :not, :has, :is and :matches have to compile selectors |
| | | * :not, :has, :is, :matches and :where have to compile selectors |
| | | * doing this in src/pseudos.ts would lead to circular dependencies, |
| | | * so we add them here |
| | | */ |
| | | exports.subselects = { |
| | | is: is, |
| | | /** |
| | | * `:matches` is an alias for `:is`. |
| | | * `:matches` and `:where` are aliases for `:is`. |
| | | */ |
| | | matches: is, |
| | | where: is, |
| | | not: function (next, token, options, context, compileToken) { |
| | | var opts = { |
| | | xmlMode: !!options.xmlMode, |
| | |
| | | context[0] = elem; |
| | | var childs = adapter.getChildren(elem); |
| | | var nextElements = shouldTestNextSiblings |
| | | ? __spreadArray(__spreadArray([], childs), getNextSiblings(elem, adapter)) : childs; |
| | | ? __spreadArray(__spreadArray([], childs, true), getNextSiblings(elem, adapter), true) : childs; |
| | | return (next(elem) && adapter.existsOne(hasElement, nextElements)); |
| | | }; |
| | | } |