@asamuzakjp/dom-selector
Advanced tools
Comparing version 0.12.2 to 0.12.3
@@ -45,3 +45,3 @@ { | ||
}, | ||
"version": "0.12.2" | ||
"version": "0.12.3" | ||
} |
@@ -28,2 +28,3 @@ /** | ||
const HTML_INTERACT = /^d(?:etails|ialog)$/; | ||
const INPUT_TYPE_BARRED = /^(?:(?:butto|hidde)n|reset)$/; | ||
const PSEUDO_FUNC = /^(?:(?:ha|i)s|not|where)$/; | ||
@@ -97,3 +98,3 @@ const PSEUDO_NTH = /^nth-(?:last-)?(?:child|of-type)$/; | ||
const l = arr.length; | ||
for (let i = 0; i < l; i++) { | ||
for (let i = 1; i < l; i++) { | ||
let item = arr[i]; | ||
@@ -119,3 +120,7 @@ if (i === l - 1 && item === '') { | ||
} | ||
item = item.replace(`${hex}`, str); | ||
let postStr = ''; | ||
if (item.length > hex.length) { | ||
postStr = item.substring(hex.length); | ||
} | ||
item = `${str}${postStr}`; | ||
} else if (WHITESPACE.test(item)) { | ||
@@ -971,16 +976,17 @@ item = '\\' + item; | ||
case 'in-range': | ||
if (localName === 'input' && | ||
node.hasAttribute('min') && node.hasAttribute('max')) { | ||
if (!(node.validity.rangeUnderflow || | ||
node.validity.rangeOverflow)) { | ||
matched.push(node); | ||
} | ||
if (localName === 'input' && !node.readonly && | ||
!(node.hasAttribute('type') && | ||
INPUT_TYPE_BARRED.test(node.getAttribute('type'))) && | ||
node.hasAttribute('min') && node.hasAttribute('max') && | ||
!(node.validity.rangeUnderflow || node.validity.rangeOverflow)) { | ||
matched.push(node); | ||
} | ||
break; | ||
case 'out-of-range': | ||
if (localName === 'input' && | ||
node.hasAttribute('min') && node.hasAttribute('max')) { | ||
if (node.validity.rangeUnderflow || node.validity.rangeOverflow) { | ||
matched.push(node); | ||
} | ||
if (localName === 'input' && !node.readonly && | ||
!(node.hasAttribute('type') && | ||
INPUT_TYPE_BARRED.test(node.getAttribute('type'))) && | ||
node.hasAttribute('min') && node.hasAttribute('max') && | ||
(node.validity.rangeUnderflow || node.validity.rangeOverflow)) { | ||
matched.push(node); | ||
} | ||
@@ -987,0 +993,0 @@ break; |
@@ -26,12 +26,12 @@ /** | ||
let [selector] = args; | ||
if (typeof selector !== 'string') { | ||
if (selector === undefined || selector === null) { | ||
selector = Object.prototype.toString.call(selector) | ||
.slice(TYPE_FROM, TYPE_TO).toLowerCase(); | ||
} else { | ||
throw new DOMException(`invalid selector ${selector}`, 'SyntaxError'); | ||
} | ||
if (typeof selector === 'string') { | ||
selector = selector.replace(/\f|\r\n?/g, '\n') | ||
.replace(/[\0\uD800-\uDFFF]|\\$/g, '\uFFFD').trim(); | ||
} else if (selector === undefined || selector === null) { | ||
selector = Object.prototype.toString.call(selector) | ||
.slice(TYPE_FROM, TYPE_TO).toLowerCase(); | ||
} else { | ||
throw new DOMException(`invalid selector ${selector}`, 'SyntaxError'); | ||
} | ||
return selector.replace(/\f|\r\n?/g, '\n') | ||
.replace(/[\0\uD800-\uDFFF]/g, '\uFFFD').trim(); | ||
return selector; | ||
}; | ||
@@ -38,0 +38,0 @@ |
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
68799
2024