Comparing version 2.0.0-beta3 to 2.0.0-beta4
{ | ||
"name": "nwsapi", | ||
"version": "2.0.0beta3", | ||
"version": "2.0.0beta4", | ||
"homepage": "https://github.com/dperini/nwsapi", | ||
@@ -5,0 +5,0 @@ "authors": [ |
{ | ||
"name": "nwsapi", | ||
"version": "2.0.0beta3", | ||
"version": "2.0.0beta4", | ||
"description": "Fast CSS Selectors API Engine", | ||
@@ -5,0 +5,0 @@ "homepage": "http://javascript.nwbox.com/nwsapi/", |
@@ -84,10 +84,4 @@ # [NWSAPI](http://dperini.github.io/nwsapi/) | ||
* `ESCAPECHR`: true - true to allow CSS escaped identifiers, false to disallow | ||
* `NON_ASCII`: true - true to allow identifiers containing non-ASCII (utf-8) chars | ||
* `SELECTOR3`: true - switch syntax RE, true to use Level 3, false to use Level 2 | ||
* `UNICODE16`: true - true to allow identifiers containing Unicode (utf-16) chars | ||
* `BUGFIX_ID`: true - true to bugfix forms when using reserved words for controls | ||
* `DUPLICATE`: true - true to allow multiple elements having the same id (strict) | ||
* `SIMPLENOT`: true - true to disallow complex selectors nested in ':not()' classes | ||
* `SVG_LCASE`: false - false to disallow lowercase SVG elements in HTML documents | ||
* `USE_HTML5`: true - true to use HTML5 specs for ":checked" and similar UI states | ||
@@ -94,0 +88,0 @@ * `VERBOSITY`: true - true to throw exceptions, false to skip throwing exceptions |
@@ -8,5 +8,5 @@ /* | ||
* Author: Diego Perini <diego.perini at gmail com> | ||
* Version: 2.0.0beta3 | ||
* Version: 2.0.0beta4 | ||
* Created: 20070722 | ||
* Release: 20180514 | ||
* Release: 20180515 | ||
* | ||
@@ -34,3 +34,3 @@ * License: | ||
var version = 'nwsapi-2.0.0beta3', | ||
var version = 'nwsapi-2.0.0beta4', | ||
@@ -107,3 +107,2 @@ doc = global.document, | ||
HTML_DOCUMENT, | ||
CASE_SENSITIVE, | ||
@@ -318,11 +317,2 @@ ATTR_ID = 'e.id', | ||
// detect case sensitivity of the nodeName property | ||
// for elements created in the context owner document | ||
isCaseSensitive = | ||
function(context) { | ||
var d = context.ownerDocument || context; | ||
return d.createElement('div').nodeName == | ||
d.createElement('DIV').nodeName; | ||
}, | ||
// check context for mixed content | ||
@@ -333,3 +323,2 @@ hasMixedNamespace = | ||
dns, all_nodes, dns_nodes; | ||
if (root) { | ||
@@ -346,4 +335,3 @@ // the root element namespace | ||
dns_nodes = d.getElementsByTagNameNS(dns, '*').length; | ||
return (all_nodes - dns_nodes) > 0; | ||
return all_nodes != dns_nodes; | ||
}, | ||
@@ -576,14 +564,2 @@ | ||
// elements inherit ancestor properties | ||
inherit = | ||
function(element, tag, property) { | ||
var name = element.nodeName; | ||
while(element.parentElement) { | ||
if (name == tag) { break; } | ||
element = element.parentElement; | ||
name = element.nodeName.toLowerCase(); | ||
} | ||
return name == tag ? element : null; | ||
}, | ||
// check if the document type is HTML | ||
@@ -772,4 +748,4 @@ isHTML = | ||
// detect case sensitivity of element nodeName | ||
CASE_SENSITIVE = isCaseSensitive(lastContext); | ||
// detect contexts having mixed namespaces elements | ||
MIXED_NS = hasMixedNamespace(lastContext); | ||
@@ -844,4 +820,2 @@ selector = groups.join(', '); | ||
// ensure selector has single whitespaces | ||
selector = selector.replace(/[\n\r\f]{1,2}/g, ' '); | ||
// isolate selector combinators/components | ||
@@ -880,6 +854,7 @@ selector = selector.replace(/\s?([>+~])\s?/g, '$1'); | ||
match = selector.match(Patterns.tagName); | ||
compat = HTML_DOCUMENT ? match[1].toUpperCase() : match[1]; | ||
source = 'if(' + N + '(' + | ||
(!HTML_DOCUMENT || CASE_SENSITIVE ? | ||
(!HTML_DOCUMENT || MIXED_NS || lastContext.nodeType == 11 ? | ||
'/^' + match[1] + '$/i.test(e.nodeName)' : | ||
'e.nodeName=="' + match[1].toUpperCase() + '"') + | ||
'e.nodeName=="' + compat + '"') + | ||
')){' + source + '}'; | ||
@@ -1076,12 +1051,8 @@ break; | ||
// https://www.w3.org/TR/html5/forms.html#enabling-and-disabling-form-controls:-the-disabled-attribute | ||
source = | ||
'if(' + N + '(("form" in e||/^optgroup$/i.test(e.nodeName))&&' + | ||
'"disabled" in e &&(e.disabled===true||' + | ||
'(n=s.inherit(e,"fieldset"))&&(n=s.first("legend",n))&&!n.contains(e))' + | ||
source = 'if(' + N + '(("form" in e||/^optgroup$/i.test(e.nodeName))&&"disabled" in e&&' + | ||
'(e.disabled===true||(n=s.ancestor("fieldset",e))&&(n=s.first("legend",n))&&!n.contains(e))' + | ||
')){' + source + '}'; | ||
break; | ||
case 'enabled': | ||
source = | ||
'if(' + N + '(("form" in e||/^optgroup$/i.test(e.nodeName))&&' + | ||
'"disabled" in e &&e.disabled===false' + | ||
source = 'if(' + N + '(("form" in e||/^optgroup$/i.test(e.nodeName))&&"disabled" in e &&e.disabled===false' + | ||
')){' + source + '}'; | ||
@@ -1223,3 +1194,3 @@ break; | ||
'(/^input|textarea$/i.test(e.nodeName))&&e.hasAttribute("placeholder")&&' + | ||
'("|textarea|password|number|search|email|text|tel|url".includes("|"+e.type+"|"))&&' + | ||
'("|textarea|password|number|search|email|text|tel|url|".includes("|"+e.type+"|"))&&' + | ||
'(!s.match(":focus",e))' + | ||
@@ -1414,3 +1385,2 @@ ')){' + source + '}'; | ||
HAS_DUPE_IDS = hasDuplicateId(context); | ||
MIXED_NS = hasMixedNamespace(context); | ||
domapi = set_domapi(); | ||
@@ -1484,3 +1454,3 @@ } | ||
function(selector, context, callback, resolvers) { | ||
var i, j, l, done, items, prev, builder, ident, symbol, token; | ||
var i, l, items, builder, ident, symbol, token; | ||
if (typeof selector == 'string') { | ||
@@ -1498,8 +1468,2 @@ if ((token = selector.match(reOptimizer)) && (ident = token[2])) { | ||
symbol = token[1] || '*'; | ||
if (prev == ident) { | ||
j = i - 1; | ||
selector[j] = optimize(selector[j], token); | ||
selector[i] = optimize(selector[i], token); | ||
} | ||
if (!done && (done = true)) { prev = ident; } | ||
} | ||
@@ -1632,3 +1596,3 @@ if (items[symbol]) items[symbol].push(ident); | ||
inherit: inherit, | ||
ancestor: ancestor, | ||
@@ -1635,0 +1599,0 @@ nthOfType: nthOfType, |
@@ -14,2 +14,5 @@ /* | ||
'nwsapi.PRE': | ||
'NW.Dom.select(s, d)', | ||
'nwmatcher': | ||
@@ -16,0 +19,0 @@ 'NW.Dom.select(s, d)' |
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
Sorry, the diff of this file is not supported yet
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
16459253
273
48693
111