Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asamuzakjp/dom-selector

Package Overview
Dependencies
Maintainers
0
Versions
192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asamuzakjp/dom-selector - npm Package Compare versions

Comparing version 6.3.5 to 6.3.7

4

dist/cjs/index.js

@@ -1,2 +0,2 @@

var f=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var d=(p,t)=>{for(var e in t)f(p,e,{get:t[e],enumerable:!0})},x=(p,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!u.call(p,n)&&n!==e&&f(p,n,{get:()=>t[n],enumerable:!(i=a(t,n))||i.enumerable});return p};var D=p=>x(f({},"__esModule",{value:!0}),p);var w={};d(w,{DOMSelector:()=>$});module.exports=D(w);var y=require("./js/finder.js"),o=require("./js/utility.js"),r=require("./js/constant.js");/*!
var f=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var d=(p,t)=>{for(var e in t)f(p,e,{get:t[e],enumerable:!0})},x=(p,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!u.call(p,n)&&n!==e&&f(p,n,{get:()=>t[n],enumerable:!(i=y(t,n))||i.enumerable});return p};var N=p=>x(f({},"__esModule",{value:!0}),p);var $={};d($,{DOMSelector:()=>D});module.exports=N($);var a=require("./js/finder.js"),o=require("./js/utility.js"),r=require("./js/constant.js");/*!
* DOM Selector - A CSS selector engine.

@@ -6,3 +6,3 @@ * @license MIT

* @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE}
*/const E=new RegExp(`${r.COMPOUND_I}${r.COMBO}${r.COMPOUND_I}`,"i"),l=new RegExp(`${r.COMPOUND_I}${r.DESCEND}${r.COMPOUND_I}`,"i"),m=new RegExp(`^${r.TAG_ID_CLASS}$`);class ${#t;#s;#e;#r;constructor(t,e){this.#t=t,this.#s=e??t.document,this.#e=new y.Finder(t),this.#r=(0,o.initNwsapi)(t,e)}matches(t,e,i){if(e?.nodeType){if(e.nodeType!==r.ELEMENT_NODE){const s=new this.#t.TypeError(`Unexpected node ${e.nodeName}`);this.#e.onError(s,i)}}else{const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}const n=e.ownerDocument;if(n===this.#s&&n.contentType==="text/html"){const s={complex:E.test(t),compound:!1,descend:!1,simple:!1,target:r.TARGET_SELF};if((0,o.filterSelector)(t,s))try{return this.#r.match(t,e)}catch{}}let h;try{this.#e.setup(t,e,i),h=this.#e.find(r.TARGET_SELF).size}catch(s){this.#e.onError(s,i)}return!!h}closest(t,e,i){if(e?.nodeType){if(e.nodeType!==r.ELEMENT_NODE){const s=new this.#t.TypeError(`Unexpected node ${e.nodeName}`);this.#e.onError(s,i)}}else{const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}const n=e.ownerDocument;if(n===this.#s&&n.contentType==="text/html"){const s={complex:E.test(t),compound:!1,descend:!1,simple:!1,target:r.TARGET_LINEAL};if((0,o.filterSelector)(t,s))try{return this.#r.closest(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_LINEAL);if(s.size){let c=e;for(;c;){if(s.has(c)){h=c;break}c=c.parentNode}}}catch(s){this.#e.onError(s,i)}return h??null}querySelector(t,e,i){if(!e?.nodeType){const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}let n;if(e.nodeType===r.DOCUMENT_NODE?n=e:n=e.ownerDocument,n===this.#s&&n.contentType==="text/html"){const s={complex:!1,compound:!(m.test(t)||E.test(t)),descend:l.test(t),simple:m.test(t),target:r.TARGET_FIRST};if((0,o.filterSelector)(t,s))try{return this.#r.first(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_FIRST);s.size&&([h]=s)}catch(s){this.#e.onError(s,i)}return h??null}querySelectorAll(t,e,i){if(!e?.nodeType){const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}let n;if(e.nodeType===r.DOCUMENT_NODE?n=e:n=e.ownerDocument,n===this.#s&&n.contentType==="text/html"){const s={complex:!1,compound:!1,descend:l.test(t),simple:!1,target:r.TARGET_ALL};if((0,o.filterSelector)(t,s))try{return this.#r.select(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_ALL);s.size&&(h=[...s])}catch(s){this.#e.onError(s,i)}return h??[]}}0&&(module.exports={DOMSelector});
*/const E=new RegExp(`${r.COMPOUND_I}${r.COMBO}${r.COMPOUND_I}`,"i"),l=new RegExp(`${r.COMPOUND_I}${r.DESCEND}${r.COMPOUND_I}`,"i"),m=new RegExp(`^${r.TAG_ID_CLASS}$`);class D{#t;#s;#e;#r;constructor(t,e){this.#t=t,this.#s=e??t.document,this.#e=new a.Finder(t),this.#r=(0,o.initNwsapi)(t,e)}matches(t,e,i){if(e?.nodeType){if(e.nodeType!==r.ELEMENT_NODE){const s=new this.#t.TypeError(`Unexpected node ${e.nodeName}`);this.#e.onError(s,i)}}else{const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}const n=e.ownerDocument;if(n===this.#s&&n.contentType==="text/html"&&e.parentNode){const s={complex:E.test(t),compound:!1,descend:!1,simple:!1,target:r.TARGET_SELF};if((0,o.filterSelector)(t,s))try{return this.#r.match(t,e)}catch{}}let h;try{this.#e.setup(t,e,i),h=this.#e.find(r.TARGET_SELF).size}catch(s){this.#e.onError(s,i)}return!!h}closest(t,e,i){if(e?.nodeType){if(e.nodeType!==r.ELEMENT_NODE){const s=new this.#t.TypeError(`Unexpected node ${e.nodeName}`);this.#e.onError(s,i)}}else{const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}const n=e.ownerDocument;if(n===this.#s&&n.contentType==="text/html"&&e.parentNode){const s={complex:E.test(t),compound:!1,descend:!1,simple:!1,target:r.TARGET_LINEAL};if((0,o.filterSelector)(t,s))try{return this.#r.closest(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_LINEAL);if(s.size){let c=e;for(;c;){if(s.has(c)){h=c;break}c=c.parentNode}}}catch(s){this.#e.onError(s,i)}return h??null}querySelector(t,e,i){if(!e?.nodeType){const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}let n;if(e.nodeType===r.DOCUMENT_NODE?n=e:n=e.ownerDocument,n===this.#s&&n.contentType==="text/html"){const s={complex:!1,compound:!(m.test(t)||E.test(t)),descend:l.test(t),simple:m.test(t),target:r.TARGET_FIRST};if((0,o.filterSelector)(t,s))try{return this.#r.first(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_FIRST);s.size&&([h]=s)}catch(s){this.#e.onError(s,i)}return h??null}querySelectorAll(t,e,i){if(!e?.nodeType){const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}let n;if(e.nodeType===r.DOCUMENT_NODE?n=e:n=e.ownerDocument,n===this.#s&&n.contentType==="text/html"){const s={complex:!1,compound:!1,descend:l.test(t),simple:!1,target:r.TARGET_ALL};if((0,o.filterSelector)(t,s))try{return this.#r.select(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_ALL);s.size&&(h=[...s])}catch(s){this.#e.onError(s,i)}return h??[]}}0&&(module.exports={DOMSelector});
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

var x=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var d=(o,t)=>{for(var c in t)x(o,c,{get:t[c],enumerable:!0})},F=(o,t,c,L)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $(t))!R.call(o,r)&&r!==c&&x(o,r,{get:()=>t[r],enumerable:!(L=P(t,r))||L.enumerable});return o};var M=o=>F(x({},"__esModule",{value:!0}),o);var ft={};d(ft,{ALPHA_NUM:()=>A,ANB:()=>l,ATTR_SELECTOR:()=>U,BIT_01:()=>W,BIT_02:()=>Z,BIT_04:()=>v,BIT_08:()=>q,BIT_16:()=>J,BIT_32:()=>Q,BIT_FFFF:()=>V,CHILD_IDX:()=>I,CLASS_SELECTOR:()=>b,COMBINATOR:()=>G,COMBO:()=>T,COMPLEX:()=>_,COMPLEX_L:()=>N,COMPOUND:()=>n,COMPOUND_A:()=>O,COMPOUND_B:()=>S,COMPOUND_I:()=>Dt,DESCEND:()=>it,DIGIT:()=>p,DOCUMENT_FRAGMENT_NODE:()=>xt,DOCUMENT_NODE:()=>pt,DOCUMENT_POSITION_CONTAINED_BY:()=>_t,DOCUMENT_POSITION_CONTAINS:()=>Tt,DOCUMENT_POSITION_PRECEDING:()=>Et,DUO:()=>tt,ELEMENT_NODE:()=>nt,HEX:()=>ot,HYPHEN:()=>et,IDENT:()=>Y,ID_SELECTOR:()=>f,KEY_FORM_FOCUS:()=>Rt,KEY_INPUT_BUTTON:()=>dt,KEY_INPUT_DATE:()=>i,KEY_INPUT_EDIT:()=>Ft,KEY_INPUT_LTR:()=>Mt,KEY_INPUT_TEXT:()=>D,KEY_LOGICAL:()=>Ut,KEY_MODIFIER:()=>bt,KEY_PS_STATE:()=>Gt,KEY_SHADOW_HOST:()=>Yt,LANG_PART:()=>It,LOGICAL_COMPLEX:()=>Pt,LOGICAL_COMPOUND:()=>$t,NESTED_LOGICAL_A:()=>C,NESTED_LOGICAL_B:()=>a,NOT_SUPPORTED_ERR:()=>h,NTH:()=>m,N_TH:()=>Ct,OPERATOR:()=>B,PSEUDO_CLASS:()=>lt,PS_CLASS_SELECTOR:()=>u,PS_ELEMENT_SELECTOR:()=>H,SELECTOR:()=>y,SHOW_ALL:()=>Ot,SHOW_DOCUMENT:()=>St,SHOW_DOCUMENT_FRAGMENT:()=>Nt,SHOW_ELEMENT:()=>Lt,STRING:()=>z,SUB_TYPE:()=>s,SYNTAX_ERR:()=>w,TAG_ID_CLASS:()=>at,TAG_TYPE:()=>e,TAG_TYPE_I:()=>E,TARGET_ALL:()=>K,TARGET_FIRST:()=>j,TARGET_LINEAL:()=>k,TARGET_SELF:()=>X,TEXT_NODE:()=>ct,TYPE_FROM:()=>rt,TYPE_SELECTOR:()=>g,TYPE_TO:()=>st,WALKER_FILTER:()=>At});module.exports=M(ft);const U="AttributeSelector",b="ClassSelector",G="Combinator",Y="Identifier",f="IdSelector",h="NotSupportedError",m="Nth",B="Operator",u="PseudoClassSelector",H="PseudoElementSelector",y="Selector",z="String",w="SyntaxError",K="all",j="first",k="lineal",X="self",g="TypeSelector",W=1,Z=2,v=4,q=8,J=16,Q=32,V=65535,tt=2,ot=16,et=45,rt=8,st=-1,nt=1,ct=3,pt=9,xt=11,Et=2,Tt=8,_t=16,Ot=4294967295,St=256,Nt=1024,Lt=1,At=1281,A="[A-Z\\d]+",I="(?:first|last|only)-(?:child|of-type)",p="(?:0|[1-9]\\d*)",It=`(?:-${A})*`,lt=`(?:any-)?link|${I}|checked|empty|indeterminate|read-(?:only|write)|root|target`,l=`[+-]?(?:${p}n?|n)|(?:[+-]?${p})?n\\s*[+-]\\s*${p}`,Ct=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${l})\\s*\\)`,s="\\[[^|\\]]+\\]|[#.:][\\w-]+",at="(?:[A-Za-z][\\w-]*|[#.][\\w-]+)",e="\\*|[A-Za-z][\\w-]*",E="\\*|[A-Z][\\w-]*",n=`(?:${e}|(?:${e})?(?:${s})+)`,T="\\s?[\\s>~+]\\s?",_=`${n}(?:${T}${n})*`,it="\\s?[\\s>]\\s?",C=`:is\\(\\s*${n}(?:\\s*,\\s*${n})*\\s*\\)`,a=`:is\\(\\s*${_}(?:\\s*,\\s*${_})*\\s*\\)`,O=`(?:${e}|(?:${e})?(?:${s}|${C})+)`,S=`(?:${e}|(?:${e})?(?:${s}|${a})+)`,Dt=`(?:${E}|(?:${E})?(?:${s})+)`,N=`${S}(?:${T}${S})*`,Pt=`(?:is|not)\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,$t=`(?:is|not)\\(\\s*${O}(?:\\s*,\\s*${O})*\\s*\\)`,Rt=Object.freeze(["button","input","select","textarea"]),dt=Object.freeze(["button","reset","submit"]),i=Object.freeze(["date","datetime-local","month","time","week"]),D=Object.freeze(["email","password","search","tel","text","url"]),Ft=Object.freeze([...i,...D,"number"]),Mt=Object.freeze(["checkbox","color","date","image","number","range","radio","time"]),Ut=Object.freeze(["has","is","not","where"]),bt=Object.freeze(["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Hyper","Meta","NumLock","ScrollLock","Shift","Super","Symbol","SymbolLock"]),Gt=Object.freeze(["enabled","disabled","valid","invalid","in-range","out-of-range","checked","indeterminate","read-only","read-write","open","closed","placeholder-shown"]),Yt=Object.freeze(["host","host-context"]);0&&(module.exports={ALPHA_NUM,ANB,ATTR_SELECTOR,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,CHILD_IDX,CLASS_SELECTOR,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DESCEND,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,HEX,HYPHEN,IDENT,ID_SELECTOR,KEY_FORM_FOCUS,KEY_INPUT_BUTTON,KEY_INPUT_DATE,KEY_INPUT_EDIT,KEY_INPUT_LTR,KEY_INPUT_TEXT,KEY_LOGICAL,KEY_MODIFIER,KEY_PS_STATE,KEY_SHADOW_HOST,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,OPERATOR,PSEUDO_CLASS,PS_CLASS_SELECTOR,PS_ELEMENT_SELECTOR,SELECTOR,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SYNTAX_ERR,TAG_ID_CLASS,TAG_TYPE,TAG_TYPE_I,TARGET_ALL,TARGET_FIRST,TARGET_LINEAL,TARGET_SELF,TEXT_NODE,TYPE_FROM,TYPE_SELECTOR,TYPE_TO,WALKER_FILTER});
var x=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var c in t)x(e,c,{get:t[c],enumerable:!0})},F=(e,t,c,C)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of d(t))!M.call(e,r)&&r!==c&&x(e,r,{get:()=>t[r],enumerable:!(C=R(t,r))||C.enumerable});return e};var b=e=>F(x({},"__esModule",{value:!0}),e);var Bt={};U(Bt,{ALPHA_NUM:()=>I,ANB:()=>a,ATTR_SELECTOR:()=>Y,BIT_01:()=>v,BIT_02:()=>q,BIT_04:()=>J,BIT_08:()=>Q,BIT_16:()=>V,BIT_32:()=>tt,BIT_FFFF:()=>ot,CHILD_IDX:()=>l,CLASS_SELECTOR:()=>G,COMBINATOR:()=>f,COMBO:()=>_,COMPLEX:()=>O,COMPLEX_L:()=>N,COMPOUND:()=>n,COMPOUND_A:()=>T,COMPOUND_B:()=>S,COMPOUND_I:()=>it,COMPOUND_WO_PSEUDO:()=>L,DESCEND:()=>$t,DIGIT:()=>p,DOCUMENT_FRAGMENT_NODE:()=>_t,DOCUMENT_NODE:()=>Et,DOCUMENT_POSITION_CONTAINED_BY:()=>St,DOCUMENT_POSITION_CONTAINS:()=>Tt,DOCUMENT_POSITION_PRECEDING:()=>Ot,DUO:()=>et,ELEMENT_NODE:()=>pt,HAS_COMPOUND:()=>Mt,HEX:()=>rt,HYPHEN:()=>st,IDENT:()=>h,ID_SELECTOR:()=>m,KEY_FORM_FOCUS:()=>Ut,KEY_INPUT_BUTTON:()=>Ft,KEY_INPUT_DATE:()=>$,KEY_INPUT_EDIT:()=>bt,KEY_INPUT_LTR:()=>Yt,KEY_INPUT_TEXT:()=>i,KEY_LOGICAL:()=>Gt,KEY_MODIFIER:()=>ft,KEY_PS_STATE:()=>ht,KEY_SHADOW_HOST:()=>mt,LANG_PART:()=>At,LOGIC_COMPLEX:()=>Rt,LOGIC_COMPOUND:()=>dt,NESTED_LOGIC_A:()=>D,NESTED_LOGIC_B:()=>P,NOT_SUPPORTED_ERR:()=>B,NTH:()=>H,N_TH:()=>Dt,OPERATOR:()=>u,PSEUDO_CLASS:()=>Lt,PS_CLASS_SELECTOR:()=>w,PS_ELEMENT_SELECTOR:()=>y,SELECTOR:()=>z,SHOW_ALL:()=>Nt,SHOW_DOCUMENT:()=>Ct,SHOW_DOCUMENT_FRAGMENT:()=>It,SHOW_ELEMENT:()=>lt,STRING:()=>K,SUB_TYPE:()=>s,SUB_TYPE_WO_PSEUDO:()=>A,SYNTAX_ERR:()=>j,TAG_ID_CLASS:()=>Pt,TAG_TYPE:()=>o,TAG_TYPE_I:()=>E,TARGET_ALL:()=>k,TARGET_FIRST:()=>W,TARGET_LINEAL:()=>X,TARGET_SELF:()=>g,TEXT_NODE:()=>xt,TYPE_FROM:()=>nt,TYPE_SELECTOR:()=>Z,TYPE_TO:()=>ct,WALKER_FILTER:()=>at});module.exports=b(Bt);const Y="AttributeSelector",G="ClassSelector",f="Combinator",h="Identifier",m="IdSelector",B="NotSupportedError",H="Nth",u="Operator",w="PseudoClassSelector",y="PseudoElementSelector",z="Selector",K="String",j="SyntaxError",k="all",W="first",X="lineal",g="self",Z="TypeSelector",v=1,q=2,J=4,Q=8,V=16,tt=32,ot=65535,et=2,rt=16,st=45,nt=8,ct=-1,pt=1,xt=3,Et=9,_t=11,Ot=2,Tt=8,St=16,Nt=4294967295,Ct=256,It=1024,lt=1,at=1281,I="[A-Z\\d]+",l="(?:first|last|only)-(?:child|of-type)",p="(?:0|[1-9]\\d*)",At=`(?:-${I})*`,Lt=`(?:any-)?link|${l}|checked|empty|indeterminate|read-(?:only|write)|root|target`,a=`[+-]?(?:${p}n?|n)|(?:[+-]?${p})?n\\s*[+-]\\s*${p}`,Dt=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${a})\\s*\\)`,s="\\[[^|\\]]+\\]|[#.:][\\w-]+",A="\\[[^|\\]]+\\]|[#.][\\w-]+",Pt="(?:[A-Za-z][\\w-]*|[#.][\\w-]+)",o="\\*|[A-Za-z][\\w-]*",E="\\*|[A-Z][\\w-]*",n=`(?:${o}|(?:${o})?(?:${s})+)`,L=`(?:${o}|(?:${o})?(?:${A})+)`,_="\\s?[\\s>~+]\\s?",O=`${n}(?:${_}${n})*`,$t="\\s?[\\s>]\\s?",D=`:is\\(\\s*${n}(?:\\s*,\\s*${n})*\\s*\\)`,P=`:is\\(\\s*${O}(?:\\s*,\\s*${O})*\\s*\\)`,T=`(?:${o}|(?:${o})?(?:${s}|${D})+)`,S=`(?:${o}|(?:${o})?(?:${s}|${P})+)`,it=`(?:${E}|(?:${E})?(?:${s})+)`,N=`${S}(?:${_}${S})*`,Rt=`(?:is|not)\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,dt=`(?:is|not)\\(\\s*${T}(?:\\s*,\\s*${T})*\\s*\\)`,Mt=`has\\([\\s>~+]?\\s*${L}\\s*\\)`,Ut=Object.freeze(["button","input","select","textarea"]),Ft=Object.freeze(["button","reset","submit"]),$=Object.freeze(["date","datetime-local","month","time","week"]),i=Object.freeze(["email","password","search","tel","text","url"]),bt=Object.freeze([...$,...i,"number"]),Yt=Object.freeze(["checkbox","color","date","image","number","range","radio","time"]),Gt=Object.freeze(["has","is","not","where"]),ft=Object.freeze(["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Hyper","Meta","NumLock","ScrollLock","Shift","Super","Symbol","SymbolLock"]),ht=Object.freeze(["enabled","disabled","valid","invalid","in-range","out-of-range","checked","indeterminate","read-only","read-write","open","closed","placeholder-shown"]),mt=Object.freeze(["host","host-context"]);0&&(module.exports={ALPHA_NUM,ANB,ATTR_SELECTOR,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,CHILD_IDX,CLASS_SELECTOR,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,COMPOUND_WO_PSEUDO,DESCEND,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,HAS_COMPOUND,HEX,HYPHEN,IDENT,ID_SELECTOR,KEY_FORM_FOCUS,KEY_INPUT_BUTTON,KEY_INPUT_DATE,KEY_INPUT_EDIT,KEY_INPUT_LTR,KEY_INPUT_TEXT,KEY_LOGICAL,KEY_MODIFIER,KEY_PS_STATE,KEY_SHADOW_HOST,LANG_PART,LOGIC_COMPLEX,LOGIC_COMPOUND,NESTED_LOGIC_A,NESTED_LOGIC_B,NOT_SUPPORTED_ERR,NTH,N_TH,OPERATOR,PSEUDO_CLASS,PS_CLASS_SELECTOR,PS_ELEMENT_SELECTOR,SELECTOR,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SUB_TYPE_WO_PSEUDO,SYNTAX_ERR,TAG_ID_CLASS,TAG_TYPE,TAG_TYPE_I,TARGET_ALL,TARGET_FIRST,TARGET_LINEAL,TARGET_SELF,TEXT_NODE,TYPE_FROM,TYPE_SELECTOR,TYPE_TO,WALKER_FILTER});
//# sourceMappingURL=constant.js.map

@@ -1,2 +0,2 @@

var C=Object.create;var c=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var i in t)c(e,i,{get:t[i],enumerable:!0})},w=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of U(t))!I.call(e,n)&&n!==i&&c(e,n,{get:()=>t[n],enumerable:!(r=D(t,n))||r.enumerable});return e};var y=(e,t,i)=>(i=e!=null?C(_(e)):{},w(t||!e||!e.__esModule?c(i,"default",{value:e,enumerable:!0}):i,e)),k=e=>w(c({},"__esModule",{value:!0}),e);var H={};$(H,{filterSelector:()=>j,getDirectionality:()=>b,getNamespaceURI:()=>g,getSlottedTextContent:()=>p,getType:()=>u,initNwsapi:()=>X,isContentEditable:()=>m,isCustomElement:()=>S,isFocusVisible:()=>G,isFocusable:()=>F,isFocusableArea:()=>V,isNamespaceDeclared:()=>K,isPreceding:()=>O,isVisible:()=>v,resolveContent:()=>M,sortNodes:()=>Y,traverseNode:()=>P});module.exports=k(H);var E=y(require("@asamuzakjp/nwsapi"),1),h=y(require("bidi-js"),1),d=y(require("is-potential-custom-element-name"),1),s=require("./constant.js");const A=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH}|${s.LOGICAL_COMPLEX})`),L=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH}|${s.LOGICAL_COMPOUND})`),R=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH})`),u=e=>Object.prototype.toString.call(e).slice(s.TYPE_FROM,s.TYPE_TO),M=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);let t,i,r;switch(e.nodeType){case s.DOCUMENT_NODE:{t=e,i=e;break}case s.DOCUMENT_FRAGMENT_NODE:{const{host:n,mode:l,ownerDocument:a}=e;t=a,i=e,r=n&&(l==="close"||l==="open");break}case s.ELEMENT_NODE:{t=e.ownerDocument;let n=e;for(;n;){const{host:l,mode:a,nodeType:o,parentNode:f}=n;if(o===s.DOCUMENT_FRAGMENT_NODE){r=l&&(a==="close"||a==="open");break}else if(f)n=f;else break}i=n;break}default:throw new TypeError(`Unexpected node ${e.nodeName}`)}return[t,i,!!r]},P=(e,t,i=!1)=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(!t)return null;let r=t.currentNode;if(r===e)return r;if(i||r.contains(e)){for(r=t.nextNode();r&&r!==e;)r=t.nextNode();return r}else{if(r!==t.root){let n;for(;r;){if(r===e){n=!0;break}else if(r===t.root||r.contains(e))break;r=t.parentNode()}if(n)return r}if(e.nodeType===s.ELEMENT_NODE){let n;for(;r;){if(r===e){n=!0;break}r=t.nextNode()}if(n)return r}}return null},S=(e,t={})=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(e.nodeType!==s.ELEMENT_NODE)return!1;const{localName:i,ownerDocument:r}=e,{formAssociated:n}=t,l=r.defaultView;let a;const o=e.getAttribute("is");return o?a=(0,d.default)(o)&&l.customElements.get(o):a=(0,d.default)(i)&&l.customElements.get(i),a?n?!!a.formAssociated:!0:!1},p=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(typeof e.assignedNodes!="function")return null;const t=e.assignedNodes();if(t.length){let i;for(const r of t)if(i=r.textContent.trim(),i)break;return i}return e.textContent.trim()},b=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(e.nodeType!==s.ELEMENT_NODE)return null;const{dir:t,localName:i,parentNode:r}=e,{getEmbeddingLevels:n}=(0,h.default)();if(t==="ltr"||t==="rtl")return t;if(t==="auto"){let l;switch(i){case"input":{const a=[...s.KEY_INPUT_BUTTON,...s.KEY_INPUT_TEXT,"hidden"];if(!e.type||a.includes(e.type))l=e.value;else if(["checkbox","color","date","image","number","range","radio","time"].includes(e.type))return"ltr";break}case"slot":{l=p(e);break}case"textarea":{l=e.value;break}default:{const a=[].slice.call(e.childNodes);for(const o of a){const{dir:f,localName:T,nodeType:N,textContent:x}=o;if(N===s.TEXT_NODE?l=x.trim():N===s.ELEMENT_NODE&&!["bdi","script","style","textarea"].includes(T)&&(!f||f!=="ltr"&&f!=="rtl")&&(T==="slot"?l=p(o):l=x.trim()),l)break}}}if(l){const{paragraphs:[{level:a}]}=n(l);if(a%2===1)return"rtl"}else if(r){const{nodeType:a}=r;if(a===s.ELEMENT_NODE)return b(r)}}else{if(i==="input"&&e.type==="tel")return"ltr";if(i==="bdi"){const l=e.textContent.trim();if(l){const{paragraphs:[{level:a}]}=n(l);if(a%2===1)return"rtl"}}else if(r){if(i==="slot"){const a=p(e);if(a){const{paragraphs:[{level:o}]}=n(a);return o%2===1?"rtl":"ltr"}}const{nodeType:l}=r;if(l===s.ELEMENT_NODE)return b(r)}}return"ltr"},m=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(e.nodeType!==s.ELEMENT_NODE)return!1;if(typeof e.isContentEditable=="boolean")return e.isContentEditable;if(e.ownerDocument.designMode==="on")return!0;{let t;switch(e.hasAttribute("contenteditable")?t=e.getAttribute("contenteditable"):t="inherit",t){case"":case"true":return!0;case"plaintext-only":return!0;case"false":return!1;default:return e?.parentNode?.nodeType===s.ELEMENT_NODE?m(e.parentNode):!1}}},v=e=>{if(e?.nodeType!==s.ELEMENT_NODE)return!1;const t=e.ownerDocument.defaultView,{display:i,visibility:r}=t.getComputedStyle(e);return i!=="none"&&r==="visible"},G=e=>{if(e?.nodeType!==s.ELEMENT_NODE)return!1;const{localName:t,type:i}=e;switch(t){case"input":return!!(!i||s.KEY_INPUT_EDIT.includes(i));case"textarea":return!0;default:return m(e)}},V=e=>{if(e?.nodeType!==s.ELEMENT_NODE||!e.isConnected)return!1;const t=e.ownerDocument.defaultView;if(e instanceof t.HTMLElement){if(Number.isInteger(parseInt(e.getAttribute("tabindex")))||m(e))return!0;const{localName:i,parentNode:r}=e;switch(i){case"a":return!!(e.href||e.hasAttribute("href"));case"iframe":return!0;case"input":return!(e.disabled||e.hasAttribute("disabled")||e.hidden||e.hasAttribute("hidden"));case"summary":{if(r.localName==="details"){let n=r.firstElementChild,l=!1;for(;n;){if(n.localName==="summary"){l=n===e;break}n=n.nextElementSibling}return l}return!1}default:if(["button","select","textarea"].includes(i)&&!(e.disabled||e.hasAttribute("disabled")))return!0}}else if(e instanceof t.SVGElement){if(Number.isInteger(parseInt(e.getAttributeNS(null,"tabindex")))){const i=["clipPath","defs","desc","linearGradient","marker","mask","metadata","pattern","radialGradient","script","style","symbol","title"],r="http://www.w3.org/2000/svg";let n,l=e;for(;l.namespaceURI===r&&(n=i.includes(l.localName),!n);)if(l?.parentNode?.namespaceURI===r)l=l.parentNode;else break;return!n}if(e.localName==="a"&&(e.href||e.hasAttributeNS(null,"href")))return!0}return!1},F=e=>{if(e?.nodeType!==s.ELEMENT_NODE)return!1;const t=e.ownerDocument.defaultView;let i=e,r=!0;for(;i;){if(i.disabled||i.hasAttribute("disabled")){r=!1;break}(i.hidden||i.hasAttribute("hidden"))&&(r=!1);const{contentVisibility:n,display:l,visibility:a}=t.getComputedStyle(i);if(l==="none"||a!=="visible"||n==="hidden"&&i!==e?r=!1:r=!0,r&&i?.parentNode?.nodeType===s.ELEMENT_NODE)i=i.parentNode;else break}return r},g=(e,t)=>{if(typeof e!="string")throw new TypeError(`Unexpected type ${u(e)}`);if(!t?.nodeType)throw new TypeError(`Unexpected type ${u(t)}`);if(!e||t.nodeType!==s.ELEMENT_NODE)return null;const{attributes:i}=t;let r;for(const n of i){const{name:l,namespaceURI:a,prefix:o,value:f}=n;if(l===`xmlns:${e}`?r=f:o===e&&(r=a),r)break}return r??null},K=(e="",t={})=>{if(!e||typeof e!="string"||t?.nodeType!==s.ELEMENT_NODE)return!1;if(t.lookupNamespaceURI(e))return!0;const i=t.ownerDocument.documentElement;let r=t,n;for(;r&&(n=g(e,r),!(n||r===i));)r=r.parentNode;return!!n},O=(e,t)=>{if(e?.nodeType){if(!t?.nodeType)throw new TypeError(`Unexpected type ${u(t)}`)}else throw new TypeError(`Unexpected type ${u(e)}`);if(e.nodeType!==s.ELEMENT_NODE||t.nodeType!==s.ELEMENT_NODE)return!1;const i=t.compareDocumentPosition(e);return!!(i&s.DOCUMENT_POSITION_PRECEDING||i&s.DOCUMENT_POSITION_CONTAINS)},Y=(e=[])=>{const t=[...e];return t.length>1&&t.sort((i,r)=>{let n;return O(r,i)?n=1:n=-1,n}),t},X=(e,t)=>{if(!e?.DOMException)throw new TypeError(`Unexpected global object ${u(e)}`);t?.nodeType!==s.DOCUMENT_NODE&&(t=e.document);const i=(0,E.default)({document:t,DOMException:e.DOMException});return i.configure({LOGERRORS:!1}),i},j=(e,t={})=>{if(!e||typeof e!="string")return!1;const{complex:i,compound:r,descend:n,simple:l}=t;if(l||r)return!1;if(e.includes("[")){const a=e.lastIndexOf("[");if(e.substring(a).indexOf("]")<0)return!1}return/[|\\]|::|[^\u0021-\u007F\s]|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]|:(?:is|where)\(\s*\)/.test(e)?!1:e.includes(":")?n?!1:/:(?:is|not)\(/.test(e)?i?!A.test(e):!L.test(e):!R.test(e):!0};0&&(module.exports={filterSelector,getDirectionality,getNamespaceURI,getSlottedTextContent,getType,initNwsapi,isContentEditable,isCustomElement,isFocusVisible,isFocusable,isFocusableArea,isNamespaceDeclared,isPreceding,isVisible,resolveContent,sortNodes,traverseNode});
var C=Object.create;var c=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var i in t)c(e,i,{get:t[i],enumerable:!0})},x=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of D(t))!$.call(e,n)&&n!==i&&c(e,n,{get:()=>t[n],enumerable:!(r=_(t,n))||r.enumerable});return e};var y=(e,t,i)=>(i=e!=null?C(U(e)):{},x(t||!e||!e.__esModule?c(i,"default",{value:e,enumerable:!0}):i,e)),k=e=>x(c({},"__esModule",{value:!0}),e);var W={};I(W,{filterSelector:()=>j,getDirectionality:()=>b,getNamespaceURI:()=>g,getSlottedTextContent:()=>p,getType:()=>u,initNwsapi:()=>X,isContentEditable:()=>m,isCustomElement:()=>P,isFocusVisible:()=>F,isFocusable:()=>K,isFocusableArea:()=>V,isNamespaceDeclared:()=>Y,isPreceding:()=>O,isVisible:()=>v,resolveContent:()=>L,sortNodes:()=>H,traverseNode:()=>M});module.exports=k(W);var w=y(require("@asamuzakjp/nwsapi"),1),h=y(require("bidi-js"),1),d=y(require("is-potential-custom-element-name"),1),s=require("./constant.js");const A=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH}|${s.LOGIC_COMPLEX})`),R=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH}|${s.LOGIC_COMPOUND})`),S=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH}|${s.LOGIC_COMPOUND}|${s.HAS_COMPOUND})`),G=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH})`),u=e=>Object.prototype.toString.call(e).slice(s.TYPE_FROM,s.TYPE_TO),L=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);let t,i,r;switch(e.nodeType){case s.DOCUMENT_NODE:{t=e,i=e;break}case s.DOCUMENT_FRAGMENT_NODE:{const{host:n,mode:l,ownerDocument:a}=e;t=a,i=e,r=n&&(l==="close"||l==="open");break}case s.ELEMENT_NODE:{t=e.ownerDocument;let n=e;for(;n;){const{host:l,mode:a,nodeType:o,parentNode:f}=n;if(o===s.DOCUMENT_FRAGMENT_NODE){r=l&&(a==="close"||a==="open");break}else if(f)n=f;else break}i=n;break}default:throw new TypeError(`Unexpected node ${e.nodeName}`)}return[t,i,!!r]},M=(e,t,i=!1)=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(!t)return null;let r=t.currentNode;if(r===e)return r;if(i||r.contains(e)){for(r=t.nextNode();r&&r!==e;)r=t.nextNode();return r}else{if(r!==t.root){let n;for(;r;){if(r===e){n=!0;break}else if(r===t.root||r.contains(e))break;r=t.parentNode()}if(n)return r}if(e.nodeType===s.ELEMENT_NODE){let n;for(;r;){if(r===e){n=!0;break}r=t.nextNode()}if(n)return r}}return null},P=(e,t={})=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(e.nodeType!==s.ELEMENT_NODE)return!1;const{localName:i,ownerDocument:r}=e,{formAssociated:n}=t,l=r.defaultView;let a;const o=e.getAttribute("is");return o?a=(0,d.default)(o)&&l.customElements.get(o):a=(0,d.default)(i)&&l.customElements.get(i),a?n?!!a.formAssociated:!0:!1},p=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(typeof e.assignedNodes!="function")return null;const t=e.assignedNodes();if(t.length){let i;for(const r of t)if(i=r.textContent.trim(),i)break;return i}return e.textContent.trim()},b=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(e.nodeType!==s.ELEMENT_NODE)return null;const{dir:t,localName:i,parentNode:r}=e,{getEmbeddingLevels:n}=(0,h.default)();if(t==="ltr"||t==="rtl")return t;if(t==="auto"){let l;switch(i){case"input":{const a=[...s.KEY_INPUT_BUTTON,...s.KEY_INPUT_TEXT,"hidden"];if(!e.type||a.includes(e.type))l=e.value;else if(["checkbox","color","date","image","number","range","radio","time"].includes(e.type))return"ltr";break}case"slot":{l=p(e);break}case"textarea":{l=e.value;break}default:{const a=[].slice.call(e.childNodes);for(const o of a){const{dir:f,localName:T,nodeType:N,textContent:E}=o;if(N===s.TEXT_NODE?l=E.trim():N===s.ELEMENT_NODE&&!["bdi","script","style","textarea"].includes(T)&&(!f||f!=="ltr"&&f!=="rtl")&&(T==="slot"?l=p(o):l=E.trim()),l)break}}}if(l){const{paragraphs:[{level:a}]}=n(l);if(a%2===1)return"rtl"}else if(r){const{nodeType:a}=r;if(a===s.ELEMENT_NODE)return b(r)}}else{if(i==="input"&&e.type==="tel")return"ltr";if(i==="bdi"){const l=e.textContent.trim();if(l){const{paragraphs:[{level:a}]}=n(l);if(a%2===1)return"rtl"}}else if(r){if(i==="slot"){const a=p(e);if(a){const{paragraphs:[{level:o}]}=n(a);return o%2===1?"rtl":"ltr"}}const{nodeType:l}=r;if(l===s.ELEMENT_NODE)return b(r)}}return"ltr"},m=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${u(e)}`);if(e.nodeType!==s.ELEMENT_NODE)return!1;if(typeof e.isContentEditable=="boolean")return e.isContentEditable;if(e.ownerDocument.designMode==="on")return!0;{let t;switch(e.hasAttribute("contenteditable")?t=e.getAttribute("contenteditable"):t="inherit",t){case"":case"true":return!0;case"plaintext-only":return!0;case"false":return!1;default:return e?.parentNode?.nodeType===s.ELEMENT_NODE?m(e.parentNode):!1}}},v=e=>{if(e?.nodeType!==s.ELEMENT_NODE)return!1;const t=e.ownerDocument.defaultView,{display:i,visibility:r}=t.getComputedStyle(e);return i!=="none"&&r==="visible"},F=e=>{if(e?.nodeType!==s.ELEMENT_NODE)return!1;const{localName:t,type:i}=e;switch(t){case"input":return!!(!i||s.KEY_INPUT_EDIT.includes(i));case"textarea":return!0;default:return m(e)}},V=e=>{if(e?.nodeType!==s.ELEMENT_NODE||!e.isConnected)return!1;const t=e.ownerDocument.defaultView;if(e instanceof t.HTMLElement){if(Number.isInteger(parseInt(e.getAttribute("tabindex")))||m(e))return!0;const{localName:i,parentNode:r}=e;switch(i){case"a":return!!(e.href||e.hasAttribute("href"));case"iframe":return!0;case"input":return!(e.disabled||e.hasAttribute("disabled")||e.hidden||e.hasAttribute("hidden"));case"summary":{if(r.localName==="details"){let n=r.firstElementChild,l=!1;for(;n;){if(n.localName==="summary"){l=n===e;break}n=n.nextElementSibling}return l}return!1}default:if(["button","select","textarea"].includes(i)&&!(e.disabled||e.hasAttribute("disabled")))return!0}}else if(e instanceof t.SVGElement){if(Number.isInteger(parseInt(e.getAttributeNS(null,"tabindex")))){const i=["clipPath","defs","desc","linearGradient","marker","mask","metadata","pattern","radialGradient","script","style","symbol","title"],r="http://www.w3.org/2000/svg";let n,l=e;for(;l.namespaceURI===r&&(n=i.includes(l.localName),!n);)if(l?.parentNode?.namespaceURI===r)l=l.parentNode;else break;return!n}if(e.localName==="a"&&(e.href||e.hasAttributeNS(null,"href")))return!0}return!1},K=e=>{if(e?.nodeType!==s.ELEMENT_NODE)return!1;const t=e.ownerDocument.defaultView;let i=e,r=!0;for(;i;){if(i.disabled||i.hasAttribute("disabled")){r=!1;break}(i.hidden||i.hasAttribute("hidden"))&&(r=!1);const{contentVisibility:n,display:l,visibility:a}=t.getComputedStyle(i);if(l==="none"||a!=="visible"||n==="hidden"&&i!==e?r=!1:r=!0,r&&i?.parentNode?.nodeType===s.ELEMENT_NODE)i=i.parentNode;else break}return r},g=(e,t)=>{if(typeof e!="string")throw new TypeError(`Unexpected type ${u(e)}`);if(!t?.nodeType)throw new TypeError(`Unexpected type ${u(t)}`);if(!e||t.nodeType!==s.ELEMENT_NODE)return null;const{attributes:i}=t;let r;for(const n of i){const{name:l,namespaceURI:a,prefix:o,value:f}=n;if(l===`xmlns:${e}`?r=f:o===e&&(r=a),r)break}return r??null},Y=(e="",t={})=>{if(!e||typeof e!="string"||t?.nodeType!==s.ELEMENT_NODE)return!1;if(t.lookupNamespaceURI(e))return!0;const i=t.ownerDocument.documentElement;let r=t,n;for(;r&&(n=g(e,r),!(n||r===i));)r=r.parentNode;return!!n},O=(e,t)=>{if(e?.nodeType){if(!t?.nodeType)throw new TypeError(`Unexpected type ${u(t)}`)}else throw new TypeError(`Unexpected type ${u(e)}`);if(e.nodeType!==s.ELEMENT_NODE||t.nodeType!==s.ELEMENT_NODE)return!1;const i=t.compareDocumentPosition(e);return!!(i&s.DOCUMENT_POSITION_PRECEDING||i&s.DOCUMENT_POSITION_CONTAINS)},H=(e=[])=>{const t=[...e];return t.length>1&&t.sort((i,r)=>{let n;return O(r,i)?n=1:n=-1,n}),t},X=(e,t)=>{if(!e?.DOMException)throw new TypeError(`Unexpected global object ${u(e)}`);t?.nodeType!==s.DOCUMENT_NODE&&(t=e.document);const i=(0,w.default)({document:t,DOMException:e.DOMException});return i.configure({LOGERRORS:!1}),i},j=(e,t={})=>{if(!e||typeof e!="string")return!1;const{complex:i,compound:r,descend:n,simple:l,target:a}=t;if(l||r)return!1;if(e.includes("[")){const o=e.lastIndexOf("[");if(e.substring(o).indexOf("]")<0)return!1}return/[|\\]|::|[^\u0021-\u007F\s]|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]|:(?:is|where)\(\s*\)/.test(e)?!1:e.includes(":")?n?!1:(a===s.TARGET_SELF||a===s.TARGET_LINEAL)&&/:has\(/.test(e)?!S.test(e):/:(?:is|not)\(/.test(e)?i?!A.test(e):!R.test(e):!G.test(e):!0};0&&(module.exports={filterSelector,getDirectionality,getNamespaceURI,getSlottedTextContent,getType,initNwsapi,isContentEditable,isCustomElement,isFocusVisible,isFocusable,isFocusableArea,isNamespaceDeclared,isPreceding,isVisible,resolveContent,sortNodes,traverseNode});
//# sourceMappingURL=utility.js.map

@@ -26,5 +26,5 @@ {

"dependencies": {
"@asamuzakjp/nwsapi": "^2.2.24",
"@asamuzakjp/nwsapi": "^2.2.27",
"bidi-js": "^1.0.3",
"css-tree": "^3.0.1",
"css-tree": "^3.1.0",
"is-potential-custom-element-name": "^1.0.1"

@@ -35,20 +35,20 @@ },

"benchmark": "^2.1.4",
"c8": "^10.1.2",
"c8": "^10.1.3",
"chai": "^5.1.2",
"commander": "^12.1.0",
"esbuild": "^0.24.0",
"eslint": "^9.14.0",
"eslint-plugin-import-x": "^4.4.2",
"eslint-plugin-jsdoc": "^50.5.0",
"eslint-plugin-regexp": "^2.6.0",
"eslint-plugin-unicorn": "^56.0.0",
"globals": "^15.12.0",
"happy-dom": "^15.11.6",
"eslint": "^9.17.0",
"eslint-plugin-import-x": "^4.5.0",
"eslint-plugin-jsdoc": "^50.6.1",
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-unicorn": "^56.0.1",
"globals": "^15.13.0",
"happy-dom": "^15.11.7",
"jsdom": "^25.0.1",
"linkedom": "^0.18.5",
"mocha": "^10.8.2",
"neostandard": "^0.11.8",
"mocha": "^11.0.1",
"neostandard": "^0.12.0",
"sinon": "^19.0.2",
"typescript": "^5.6.3",
"wpt-runner": "^5.0.0"
"typescript": "^5.7.2",
"wpt-runner": "^6.0.0"
},

@@ -61,4 +61,4 @@ "overrides": {

"bench-sizzle": "node benchmark/bench-sizzle.js",
"build": "npm run tsc && npm run lint && npm test && npm run compat",
"compat": "esbuild --format=cjs --platform=node --outdir=dist/cjs/ --minify --sourcemap src/**/*.js",
"build": "npm run tsc && npm run lint && npm test && npm run bundle",
"bundle": "esbuild --format=cjs --platform=node --outdir=dist/cjs/ --minify --sourcemap src/**/*.js",
"lint": "eslint --fix .",

@@ -70,3 +70,3 @@ "test": "c8 --reporter=text mocha --exit test/**/*.test.js",

},
"version": "6.3.5"
"version": "6.3.7"
}

@@ -294,10 +294,10 @@ # DOM Selector

|:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
|simple selector:<br>`matches('.content')`|117,468 ops/sec ±4.45%|349,037 ops/sec ±2.71%|7,986 ops/sec ±0.83%|121,277 ops/sec ±0.58%|happydom is the fastest and 2.9 times faster than patched-jsdom. patched-jsdom is 1.0 times faster than jsdom.|
|compound selector:<br>`matches('p.content[id]:is(:last-child, :only-child)')`|109,103 ops/sec ±1.81%|323,742 ops/sec ±16.05%|7,826 ops/sec ±0.70%|89,905 ops/sec ±0.25%|happydom is the fastest and 3.6 times faster than patched-jsdom. jsdom is 1.2 times faster than patched-jsdom.|
|compound selector:<br>`matches('p.content[id]:is(:invalid-nth-child, :only-child)')`|F|350,215 ops/sec ±2.68%|F|44,510 ops/sec ±0.33%|happydom is the fastest and 7.9 times faster than patched-jsdom.|
|compound selector:<br>`matches('p.content[id]:not(:is(.foo, .bar))')`|106,858 ops/sec ±0.43%|352,297 ops/sec ±0.17%|7,639 ops/sec ±0.61%|87,013 ops/sec ±0.63%|happydom is the fastest and 4.0 times faster than patched-jsdom. jsdom is 1.2 times faster than patched-jsdom.|
|complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|70,868 ops/sec ±0.57%|F|4,876 ops/sec ±0.49%|64,719 ops/sec ±0.36%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
|complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|4,752 ops/sec ±0.54%|15,398 ops/sec ±3.41%|patched-jsdom is the fastest.|
|complex selector within logical pseudo-class:<br>`matches(':is(.box > .content, .block > .content)')`|99,626 ops/sec ±0.63%|F|5,129 ops/sec ±0.45%|95,577 ops/sec ±0.65%|jsdom is the fastest and 1.0 times faster than patched-jsdom.|
|nested and chained :not() selector:<br>`matches('p:not(:is(:not(.content))):not(.foo)')`|F|F|4,701 ops/sec ±13.49%|82,153 ops/sec ±0.68%|patched-jsdom is the fastest.|
|simple selector:<br>`matches('.content')`|115,054 ops/sec ±2.48%|356,979 ops/sec ±2.34%|8,556 ops/sec ±0.90%|118,715 ops/sec ±0.17%|happydom is the fastest and 3.0 times faster than patched-jsdom. patched-jsdom is 1.0 times faster than jsdom.|
|compound selector:<br>`matches('p.content[id]:is(:last-child, :only-child)')`|109,730 ops/sec ±0.63%|323,008 ops/sec ±18.02%|8,419 ops/sec ±0.66%|86,074 ops/sec ±0.97%|happydom is the fastest and 3.8 times faster than patched-jsdom. jsdom is 1.3 times faster than patched-jsdom.|
|compound selector:<br>`matches('p.content[id]:is(:invalid-nth-child, :only-child)')`|F|353,239 ops/sec ±2.73%|F|43,662 ops/sec ±1.86%|happydom is the fastest and 8.1 times faster than patched-jsdom.|
|compound selector:<br>`matches('p.content[id]:not(:is(.foo, .bar))')`|101,636 ops/sec ±1.59%|351,747 ops/sec ±0.59%|8,082 ops/sec ±0.61%|83,928 ops/sec ±0.66%|happydom is the fastest and 4.2 times faster than patched-jsdom. jsdom is 1.2 times faster than patched-jsdom.|
|complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|70,482 ops/sec ±0.38%|F|5,261 ops/sec ±0.72%|61,745 ops/sec ±0.56%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
|complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|31,671 ops/sec ±1.14%|F|5,288 ops/sec ±0.43%|42,614 ops/sec ±2.51%|patched-jsdom is the fastest. patched-jsdom is 1.3 times faster than jsdom.|
|complex selector within logical pseudo-class:<br>`matches(':is(.box > .content, .block > .content)')`|100,293 ops/sec ±0.67%|F|5,593 ops/sec ±0.40%|78,292 ops/sec ±26.38%|jsdom is the fastest and 1.3 times faster than patched-jsdom.|
|nested and chained :not() selector:<br>`matches('p:not(:is(:not(.content))):not(.foo)')`|F|299,143 ops/sec ±28.61%|5,538 ops/sec ±0.44%|84,061 ops/sec ±0.71%|happydom is the fastest and 3.6 times faster than patched-jsdom.|

@@ -308,8 +308,8 @@ ### closest()

|:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
|simple selector:<br>`closest('.container')`|93,212 ops/sec ±0.46%|263,009 ops/sec ±30.00%|7,996 ops/sec ±0.64%|91,205 ops/sec ±0.35%|happydom is the fastest and 2.9 times faster than patched-jsdom. jsdom is 1.0 times faster than patched-jsdom.|
|compound selector:<br>`closest('div.container[id]:not(.foo, .box)')`|64,257 ops/sec ±0.27%|F|7,412 ops/sec ±0.84%|55,072 ops/sec ±0.33%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
|complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|65,291 ops/sec ±0.22%|F|4,890 ops/sec ±0.41%|58,028 ops/sec ±0.64%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
|complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|4,703 ops/sec ±1.06%|13,256 ops/sec ±0.48%|patched-jsdom is the fastest.|
|complex selector within logical pseudo-class:<br>`closest(':is(.container > .content, .container > .box)')`|75,927 ops/sec ±0.36%|307,805 ops/sec ±0.48%|5,108 ops/sec ±0.41%|69,864 ops/sec ±0.18%|happydom is the fastest and 4.4 times faster than patched-jsdom. jsdom is 1.1 times faster than patched-jsdom.|
|nested and chained :not() selector:<br>`closest('div:not(:is(:not(.container))):not(.box)')`|F|F|7,399 ops/sec ±0.61%|70,308 ops/sec ±0.48%|patched-jsdom is the fastest.|
|simple selector:<br>`closest('.container')`|96,990 ops/sec ±0.60%|326,924 ops/sec ±0.52%|8,453 ops/sec ±0.65%|90,555 ops/sec ±1.70%|happydom is the fastest and 3.6 times faster than patched-jsdom. jsdom is 1.1 times faster than patched-jsdom.|
|compound selector:<br>`closest('div.container[id]:not(.foo, .box)')`|63,821 ops/sec ±0.74%|F|7,942 ops/sec ±0.47%|54,674 ops/sec ±0.83%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
|complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|65,863 ops/sec ±0.65%|F|5,336 ops/sec ±0.55%|57,088 ops/sec ±0.76%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
|complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|23,941 ops/sec ±1.24%|F|5,182 ops/sec ±1.02%|36,066 ops/sec ±0.48%|patched-jsdom is the fastest. patched-jsdom is 1.5 times faster than jsdom.|
|complex selector within logical pseudo-class:<br>`closest(':is(.container > .content, .container > .box)')`|76,340 ops/sec ±0.36%|235,292 ops/sec ±34.48%|5,533 ops/sec ±0.53%|68,793 ops/sec ±0.78%|happydom is the fastest and 3.4 times faster than patched-jsdom. jsdom is 1.1 times faster than patched-jsdom.|
|nested and chained :not() selector:<br>`closest('div:not(:is(:not(.container))):not(.box)')`|F|F|7,777 ops/sec ±0.65%|71,028 ops/sec ±0.55%|patched-jsdom is the fastest.|

@@ -320,8 +320,8 @@ ### querySelector()

|:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
|simple selector:<br>`querySelector('.content')`|22,886 ops/sec ±0.82%|193,155 ops/sec ±54.70%|9,439 ops/sec ±0.63%|78,132 ops/sec ±0.17%|happydom is the fastest and 2.5 times faster than patched-jsdom. patched-jsdom is 3.4 times faster than jsdom.|
|compound selector:<br>`querySelector('p.content[id]:is(:last-child, :only-child)')`|8,542 ops/sec ±0.62%|336,066 ops/sec ±0.67%|9,046 ops/sec ±0.77%|35,397 ops/sec ±1.69%|happydom is the fastest and 9.5 times faster than patched-jsdom. patched-jsdom is 4.1 times faster than jsdom.|
|complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|204 ops/sec ±0.44%|F|1,186 ops/sec ±0.50%|626 ops/sec ±0.57%|linkedom is the fastest and 1.9 times faster than patched-jsdom. patched-jsdom is 3.1 times faster than jsdom.|
|complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|1,476 ops/sec ±0.74%|453 ops/sec ±0.78%|linkedom is the fastest and 3.3 times faster than patched-jsdom.|
|complex selector within logical pseudo-class:<br>`querySelector(':is(.box > .content, .block > .content)')`|3,144 ops/sec ±0.45%|F|8,766 ops/sec ±0.78%|77,257 ops/sec ±0.50%|patched-jsdom is the fastest. patched-jsdom is 24.6 times faster than jsdom.|
|nested and chained :not() selector:<br>`querySelector('p:not(:is(:not(.content))):not(.foo)')`|F|F|8,972 ops/sec ±0.70%|70,248 ops/sec ±0.39%|patched-jsdom is the fastest.|
|simple selector:<br>`querySelector('.content')`|21,898 ops/sec ±1.84%|265,006 ops/sec ±42.03%|9,921 ops/sec ±0.56%|81,017 ops/sec ±1.27%|happydom is the fastest and 3.3 times faster than patched-jsdom. patched-jsdom is 3.7 times faster than jsdom.|
|compound selector:<br>`querySelector('p.content[id]:is(:last-child, :only-child)')`|8,676 ops/sec ±0.71%|327,427 ops/sec ±1.06%|9,507 ops/sec ±0.76%|37,303 ops/sec ±0.95%|happydom is the fastest and 8.8 times faster than patched-jsdom. patched-jsdom is 4.3 times faster than jsdom.|
|complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|197 ops/sec ±0.84%|F|1,230 ops/sec ±0.91%|616 ops/sec ±1.22%|linkedom is the fastest and 2.0 times faster than patched-jsdom. patched-jsdom is 3.1 times faster than jsdom.|
|complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|57.15 ops/sec ±2.55%|F|1,452 ops/sec ±0.62%|453 ops/sec ±0.95%|linkedom is the fastest and 3.2 times faster than patched-jsdom. patched-jsdom is 7.9 times faster than jsdom.|
|complex selector within logical pseudo-class:<br>`querySelector(':is(.box > .content, .block > .content)')`|3,045 ops/sec ±1.16%|F|9,229 ops/sec ±0.76%|74,154 ops/sec ±0.83%|patched-jsdom is the fastest. patched-jsdom is 24.4 times faster than jsdom.|
|nested and chained :not() selector:<br>`querySelector('p:not(:is(:not(.content))):not(.foo)')`|F|323,503 ops/sec ±0.95%|9,383 ops/sec ±0.63%|68,866 ops/sec ±0.70%|happydom is the fastest and 4.7 times faster than patched-jsdom.|

@@ -332,8 +332,8 @@ ### querySelectorAll()

|:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
|simple selector:<br>`querySelectorAll('.content')`|1,292 ops/sec ±0.58%|494 ops/sec ±44.77%|1,091 ops/sec ±0.72%|1,226 ops/sec ±0.45%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
|compound selector:<br>`querySelectorAll('p.content[id]:is(:last-child, :only-child)')`|688 ops/sec ±0.91%|455 ops/sec ±42.98%|1,096 ops/sec ±0.90%|656 ops/sec ±0.50%|linkedom is the fastest and 1.7 times faster than patched-jsdom. jsdom is 1.0 times faster than patched-jsdom.|
|complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|206 ops/sec ±0.58%|F|393 ops/sec ±0.62%|209 ops/sec ±0.58%|linkedom is the fastest and 1.9 times faster than patched-jsdom. patched-jsdom is 1.0 times faster than jsdom.|
|complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|421 ops/sec ±0.83%|186 ops/sec ±0.49%|linkedom is the fastest and 2.3 times faster than patched-jsdom.|
|complex selector within logical pseudo-class:<br>`querySelectorAll(':is(.box > .content, .block > .content)')`|288 ops/sec ±0.64%|F|471 ops/sec ±0.71%|796 ops/sec ±2.11%|patched-jsdom is the fastest. patched-jsdom is 2.8 times faster than jsdom.|
|nested and chained :not() selector:<br>`querySelectorAll('p:not(:is(:not(.content))):not(.foo)')`|F|F|1,108 ops/sec ±0.45%|1,316 ops/sec ±0.48%|patched-jsdom is the fastest.|
|simple selector:<br>`querySelectorAll('.content')`|973 ops/sec ±49.13%|477 ops/sec ±43.91%|1,134 ops/sec ±0.38%|1,221 ops/sec ±0.69%|patched-jsdom is the fastest. patched-jsdom is 1.3 times faster than jsdom.|
|compound selector:<br>`querySelectorAll('p.content[id]:is(:last-child, :only-child)')`|681 ops/sec ±0.58%|572 ops/sec ±3.54%|1,124 ops/sec ±0.80%|640 ops/sec ±0.62%|linkedom is the fastest and 1.8 times faster than patched-jsdom. jsdom is 1.1 times faster than patched-jsdom.|
|complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|198 ops/sec ±0.92%|F|386 ops/sec ±0.74%|206 ops/sec ±0.70%|linkedom is the fastest and 1.9 times faster than patched-jsdom. patched-jsdom is 1.0 times faster than jsdom.|
|complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|56.19 ops/sec ±1.54%|F|419 ops/sec ±0.47%|183 ops/sec ±0.57%|linkedom is the fastest and 2.3 times faster than patched-jsdom. patched-jsdom is 3.2 times faster than jsdom.|
|complex selector within logical pseudo-class:<br>`querySelectorAll(':is(.box > .content, .block > .content)')`|276 ops/sec ±0.97%|F|468 ops/sec ±0.74%|811 ops/sec ±1.18%|patched-jsdom is the fastest. patched-jsdom is 2.9 times faster than jsdom.|
|nested and chained :not() selector:<br>`querySelectorAll('p:not(:is(:not(.content))):not(.foo)')`|F|523 ops/sec ±5.90%|1,160 ops/sec ±1.16%|1,321 ops/sec ±0.52%|patched-jsdom is the fastest.|

@@ -340,0 +340,0 @@

@@ -57,3 +57,4 @@ /*!

const document = node.ownerDocument;
if (document === this.#document && document.contentType === 'text/html') {
if (document === this.#document && document.contentType === 'text/html' &&
node.parentNode) {
const filterOpt = {

@@ -102,3 +103,4 @@ complex: REG_COMPLEX.test(selector),

const document = node.ownerDocument;
if (document === this.#document && document.contentType === 'text/html') {
if (document === this.#document && document.contentType === 'text/html' &&
node.parentNode) {
const filterOpt = {

@@ -105,0 +107,0 @@ complex: REG_COMPLEX.test(selector),

@@ -68,2 +68,3 @@ /**

export const SUB_TYPE = '\\[[^|\\]]+\\]|[#.:][\\w-]+';
export const SUB_TYPE_WO_PSEUDO = '\\[[^|\\]]+\\]|[#.][\\w-]+';
// TAG_TYPE: *, tag

@@ -74,20 +75,23 @@ export const TAG_ID_CLASS = '(?:[A-Za-z][\\w-]*|[#.][\\w-]+)';

export const COMPOUND = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE})+)`;
export const COMPOUND_WO_PSEUDO =
`(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE_WO_PSEUDO})+)`;
export const COMBO = '\\s?[\\s>~+]\\s?';
export const COMPLEX = `${COMPOUND}(?:${COMBO}${COMPOUND})*`;
export const DESCEND = '\\s?[\\s>]\\s?';
export const NESTED_LOGICAL_A =
export const NESTED_LOGIC_A =
`:is\\(\\s*${COMPOUND}(?:\\s*,\\s*${COMPOUND})*\\s*\\)`;
export const NESTED_LOGICAL_B =
export const NESTED_LOGIC_B =
`:is\\(\\s*${COMPLEX}(?:\\s*,\\s*${COMPLEX})*\\s*\\)`;
export const COMPOUND_A =
`(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_A})+)`;
`(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGIC_A})+)`;
export const COMPOUND_B =
`(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_B})+)`;
`(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGIC_B})+)`;
export const COMPOUND_I =
`(?:${TAG_TYPE_I}|(?:${TAG_TYPE_I})?(?:${SUB_TYPE})+)`;
export const COMPLEX_L = `${COMPOUND_B}(?:${COMBO}${COMPOUND_B})*`;
export const LOGICAL_COMPLEX =
export const LOGIC_COMPLEX =
`(?:is|not)\\(\\s*${COMPLEX_L}(?:\\s*,\\s*${COMPLEX_L})*\\s*\\)`;
export const LOGICAL_COMPOUND =
export const LOGIC_COMPOUND =
`(?:is|not)\\(\\s*${COMPOUND_A}(?:\\s*,\\s*${COMPOUND_A})*\\s*\\)`;
export const HAS_COMPOUND = `has\\([\\s>~+]?\\s*${COMPOUND_WO_PSEUDO}\\s*\\)`;

@@ -94,0 +98,0 @@ /* array */

@@ -13,10 +13,12 @@ /**

DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINS,
DOCUMENT_POSITION_PRECEDING, ELEMENT_NODE, KEY_INPUT_BUTTON, KEY_INPUT_EDIT,
KEY_INPUT_TEXT, LOGICAL_COMPLEX, LOGICAL_COMPOUND, N_TH, PSEUDO_CLASS,
TEXT_NODE, TYPE_FROM, TYPE_TO
DOCUMENT_POSITION_PRECEDING, ELEMENT_NODE, HAS_COMPOUND, KEY_INPUT_BUTTON,
KEY_INPUT_EDIT, KEY_INPUT_TEXT, LOGIC_COMPLEX, LOGIC_COMPOUND, N_TH,
PSEUDO_CLASS, TARGET_LINEAL, TARGET_SELF, TEXT_NODE, TYPE_FROM, TYPE_TO
} from './constant.js';
const REG_LOGICAL_COMPLEX =
new RegExp(`:(?!${PSEUDO_CLASS}|${N_TH}|${LOGICAL_COMPLEX})`);
const REG_LOGICAL_COMPOUND =
new RegExp(`:(?!${PSEUDO_CLASS}|${N_TH}|${LOGICAL_COMPOUND})`);
const REG_LOGIC_COMPLEX =
new RegExp(`:(?!${PSEUDO_CLASS}|${N_TH}|${LOGIC_COMPLEX})`);
const REG_LOGIC_COMPOUND =
new RegExp(`:(?!${PSEUDO_CLASS}|${N_TH}|${LOGIC_COMPOUND})`);
const REG_LOGIC_HAS_COMPOUND =
new RegExp(`:(?!${PSEUDO_CLASS}|${N_TH}|${LOGIC_COMPOUND}|${HAS_COMPOUND})`);
const REG_WO_LOGICAL = new RegExp(`:(?!${PSEUDO_CLASS}|${N_TH})`);

@@ -675,3 +677,3 @@

}
const { complex, compound, descend, simple } = opt;
const { complex, compound, descend, simple, target } = opt;
// exclude simple selector and compound selector

@@ -700,7 +702,10 @@ if (simple || compound) {

return false;
} else if ((target === TARGET_SELF || target === TARGET_LINEAL) &&
/:has\(/.test(selector)) {
return !REG_LOGIC_HAS_COMPOUND.test(selector);
} else if (/:(?:is|not)\(/.test(selector)) {
if (complex) {
return !REG_LOGICAL_COMPLEX.test(selector);
return !REG_LOGIC_COMPLEX.test(selector);
} else {
return !REG_LOGICAL_COMPOUND.test(selector);
return !REG_LOGIC_COMPOUND.test(selector);
}

@@ -707,0 +712,0 @@ } else {

@@ -51,2 +51,3 @@ export const ATTR_SELECTOR: "AttributeSelector";

export const SUB_TYPE: "\\[[^|\\]]+\\]|[#.:][\\w-]+";
export const SUB_TYPE_WO_PSEUDO: "\\[[^|\\]]+\\]|[#.][\\w-]+";
export const TAG_ID_CLASS: "(?:[A-Za-z][\\w-]*|[#.][\\w-]+)";

@@ -56,7 +57,8 @@ export const TAG_TYPE: "\\*|[A-Za-z][\\w-]*";

export const COMPOUND: "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)";
export const COMPOUND_WO_PSEUDO: "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.][\\w-]+)+)";
export const COMBO: "\\s?[\\s>~+]\\s?";
export const COMPLEX: "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*";
export const DESCEND: "\\s?[\\s>]\\s?";
export const NESTED_LOGICAL_A: ":is\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*\\s*\\)";
export const NESTED_LOGICAL_B: ":is\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-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|[#.:][\\w-]+)+))*\\s*\\))+)(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*\\s*\\))+))*\\s*\\)";
export const HAS_COMPOUND: "has\\([\\s>~+]?\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.][\\w-]+)+)\\s*\\)";
export const KEY_FORM_FOCUS: readonly string[];

@@ -70,0 +73,0 @@ export const KEY_INPUT_BUTTON: readonly string[];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc