@asamuzakjp/nwsapi
Advanced tools
Comparing version 2.2.21 to 2.2.22
{ | ||
"name": "@asamuzakjp/nwsapi", | ||
"version": "2.2.21", | ||
"version": "2.2.22", | ||
"description": "Fast CSS Selectors API Engine", | ||
@@ -5,0 +5,0 @@ "homepage": "http://javascript.nwbox.com/nwsapi/", |
@@ -142,3 +142,8 @@ /** | ||
const ATTR_STD_OPS = { | ||
'=': 1, '^=': 1, '$=': 1, '|=': 1, '*=': 1, '~=': 1 | ||
'=': 1, | ||
'^=': 1, | ||
'$=': 1, | ||
'|=': 1, | ||
'*=': 1, | ||
'~=': 1 | ||
}; | ||
@@ -233,3 +238,5 @@ | ||
const concatCall = function (nodes, callback) { | ||
let i = 0; const l = nodes.length; const list = Array(l); | ||
let i = 0; | ||
const l = nodes.length; | ||
const list = Array(l); | ||
while (l > i) { | ||
@@ -245,3 +252,4 @@ if (callback(list[i] = nodes[i]) === false) { | ||
const concatList = function (list, nodes) { | ||
let i = -1; let l = nodes.length; | ||
let i = -1; | ||
let l = nodes.length; | ||
while (l--) { | ||
@@ -264,3 +272,5 @@ list[list.length] = nodes[++i]; | ||
const unique = function (nodes) { | ||
let i = 0; let j = -1; let l = nodes.length + 1; | ||
let i = 0; | ||
let j = -1; | ||
let l = nodes.length + 1; | ||
const list = []; | ||
@@ -384,3 +394,5 @@ while (--l) { | ||
const byIdRaw = function (id, context) { | ||
let node = context; const nodes = []; let next = node.firstElementChild; | ||
let node = context; | ||
const nodes = []; | ||
let next = node.firstElementChild; | ||
while ((node = next)) { | ||
@@ -400,3 +412,4 @@ node.id === id && nodes.push(node); | ||
const byId = function (id, context) { | ||
let e; const api = method['#']; | ||
let e; | ||
const api = method['#']; | ||
@@ -434,3 +447,6 @@ // duplicates id allowed | ||
const byTag = function (tag, context) { | ||
let e; let nodes; const api = method['*']; | ||
let e; | ||
let nodes; | ||
const api = method['*']; | ||
// DOCUMENT_NODE (9) & ELEMENT_NODE (1) | ||
@@ -463,3 +479,6 @@ if (api in context) { | ||
const byClass = function (cls, context) { | ||
let e; let nodes; const api = method['.']; let reCls; | ||
let e; | ||
let nodes; | ||
const api = method['.']; | ||
let reCls; | ||
// DOCUMENT_NODE (9) & ELEMENT_NODE (1) | ||
@@ -518,6 +537,10 @@ if (api in context) { | ||
const hasAttributeNS = function (e, name) { | ||
let i; let l; const attr = e.getAttributeNames(); | ||
let i; | ||
let l; | ||
const attr = e.getAttributeNames(); | ||
name = RegExp(':?' + name + '$', HTML_DOCUMENT ? 'i' : ''); | ||
for (i = 0, l = attr.length; l > i; ++i) { | ||
if (name.test(attr[i])) return true; | ||
if (name.test(attr[i])) { | ||
return true; | ||
} | ||
} | ||
@@ -529,3 +552,8 @@ return false; | ||
const nthElement = (function () { | ||
let idx = 0; let len = 0; let set = 0; let parent; let parents = []; let nodes = []; | ||
let idx = 0; | ||
let len = 0; | ||
let set = 0; | ||
let parent; | ||
let parents = []; | ||
let nodes = []; | ||
return function (element, dir) { | ||
@@ -544,4 +572,10 @@ // ensure caches are emptied after each run, invoking with dir = 2 | ||
for (i = -1, j = 0, k = l - 1; l > j; ++j, --k) { | ||
if (parents[j] === parent) { i = j; break; } | ||
if (parents[k] === parent) { i = k; break; } | ||
if (parents[j] === parent) { | ||
i = j; | ||
break; | ||
} | ||
if (parents[k] === parent) { | ||
i = k; | ||
break; | ||
} | ||
} | ||
@@ -552,5 +586,14 @@ if (i < 0) { | ||
e = (parent && parent.firstElementChild) || element; | ||
while (e) { nodes[i][l] = e; if (e === element) j = l; e = e.nextElementSibling; ++l; } | ||
while (e) { | ||
nodes[i][l] = e; | ||
if (e === element) { | ||
j = l; | ||
} | ||
e = e.nextElementSibling; | ||
++l; | ||
} | ||
set = i; idx = 0; len = l; | ||
if (l < 2) return l; | ||
if (l < 2) { | ||
return l; | ||
} | ||
} else { | ||
@@ -563,4 +606,9 @@ l = nodes[i].length; | ||
for (j = 0, e = nodes[i], k = l - 1; l > j; ++j, --k) { | ||
if (e[j] === element) { break; } | ||
if (e[k] === element) { j = k; break; } | ||
if (e[j] === element) { | ||
break; | ||
} | ||
if (e[k] === element) { | ||
j = k; | ||
break; | ||
} | ||
} | ||
@@ -575,3 +623,8 @@ } | ||
const nthOfType = (function () { | ||
let idx = 0; let len = 0; let set = 0; let parent; let parents = []; let nodes = []; | ||
let idx = 0; | ||
let len = 0; | ||
let set = 0; | ||
let parent; | ||
let parents = []; | ||
let nodes = []; | ||
return function (element, dir) { | ||
@@ -588,5 +641,11 @@ // ensure caches are emptied after each run, invoking with dir = 2 | ||
} | ||
let e; let i; let j; let k; let l; | ||
let e; | ||
let i; | ||
let j; | ||
let k; | ||
let l; | ||
if (nodes[set] && nodes[set][name] && parent === element.parentElement) { | ||
i = set; j = idx; l = len; | ||
i = set; | ||
j = idx; | ||
l = len; | ||
} else { | ||
@@ -596,4 +655,10 @@ l = parents.length; | ||
for (i = -1, j = 0, k = l - 1; l > j; ++j, --k) { | ||
if (parents[j] === parent) { i = j; break; } | ||
if (parents[k] === parent) { i = k; break; } | ||
if (parents[j] === parent) { | ||
i = j; | ||
break; | ||
} | ||
if (parents[k] === parent) { | ||
i = k; | ||
break; | ||
} | ||
} | ||
@@ -606,3 +671,5 @@ if (i < 0 || !nodes[i][name]) { | ||
while (e) { | ||
if (e === element) j = l; | ||
if (e === element) { | ||
j = l; | ||
} | ||
if (e.localName === name && e.namespaceURI === nsURI) { | ||
@@ -615,3 +682,5 @@ nodes[i][name][l] = e; | ||
set = i; idx = j; len = l; | ||
if (l < 2) return l; | ||
if (l < 2) { | ||
return l; | ||
} | ||
} else { | ||
@@ -624,4 +693,9 @@ l = nodes[i][name].length; | ||
for (j = 0, e = nodes[i][name], k = l - 1; l > j; ++j, --k) { | ||
if (e[j] === element) { break; } | ||
if (e[k] === element) { j = k; break; } | ||
if (e[j] === element) { | ||
break; | ||
} | ||
if (e[k] === element) { | ||
j = k; | ||
break; | ||
} | ||
} | ||
@@ -808,4 +882,8 @@ } | ||
const configure = function (option, clear) { | ||
if (typeof option === 'string') { return !!Config[option]; } | ||
if (typeof option !== 'object') { return Config; } | ||
if (typeof option === 'string') { | ||
return !!Config[option]; | ||
} | ||
if (typeof option !== 'object') { | ||
return Config; | ||
} | ||
for (const i in option) { | ||
@@ -906,5 +984,20 @@ Config[i] = !!option[i]; | ||
// D is the default inverted negation flag | ||
let a; let b; let n; let f; let name; let NS; const N = ''; const D = '!'; | ||
let compat; let expr; let match; let result; let status; let symbol; let test; | ||
let type; let selector = expression; let vars; | ||
let a; | ||
let b; | ||
let n; | ||
let f; | ||
let name; | ||
let NS; | ||
const N = ''; | ||
const D = '!'; | ||
let compat; | ||
let expr; | ||
let match; | ||
let result; | ||
let status; | ||
let symbol; | ||
let test; | ||
let type; | ||
let selector = expression; | ||
let vars; | ||
@@ -915,3 +1008,3 @@ // original 'select' or 'match' selector string before normalization | ||
// isolate selector combinators/components and normalize whitespace | ||
selector = selector.replace(STD.combinator, '$1');// .replace(STD.whitespace, ' '); | ||
selector = selector.replace(STD.combinator, '$1'); // .replace(STD.whitespace, ' '); | ||
@@ -1105,4 +1198,8 @@ let selectorRecursion = true; | ||
b = parseInt(n[1], 10) || 0; | ||
if (n[0] === '-') { a = -1; } | ||
if (n[0] === '+') { a = +1; } | ||
if (n[0] === '-') { | ||
a = -1; | ||
} | ||
if (n[0] === '+') { | ||
a = +1; | ||
} | ||
test = (b ? '(n' + (b > 0 ? '-' : '+') + Math.abs(b) + ')' : 'n') + '%' + a + '==0'; | ||
@@ -1463,4 +1560,12 @@ test = a >= +1 | ||
const collect = function (selectors, context, callback) { | ||
let i; let l; const seen = { }; let token = ['', '*', '*']; const optimized = selectors; | ||
const factory = []; const htmlset = []; const nodeset = []; let results = []; let type; | ||
let i; | ||
let l; | ||
const seen = { }; | ||
let token = ['', '*', '*']; | ||
const optimized = selectors; | ||
const factory = []; | ||
const htmlset = []; | ||
const nodeset = []; | ||
let results = []; | ||
let type; | ||
@@ -1607,3 +1712,5 @@ for (i = 0, l = selectors.length; l > i; ++i) { | ||
if (resolver.context === context && resolver.callback === callback) { | ||
const f = resolver.factory; const h = resolver.htmlset; const n = resolver.nodeset; | ||
const f = resolver.factory; | ||
const h = resolver.htmlset; | ||
const n = resolver.nodeset; | ||
if (n.length > 1) { | ||
@@ -1610,0 +1717,0 @@ const l = n.length; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67354
1690