Comparing version 1.11.0 to 1.11.1
@@ -324,3 +324,3 @@ var Domassist = (function (exports) { | ||
function closest(el, selector) { | ||
var parent = el.parentElement; | ||
var parent = el.tagName.toLowerCase() === 'svg' ? el.parentNode : el.parentElement; | ||
while (parent.parentElement && !matches(parent, selector)) { | ||
@@ -327,0 +327,0 @@ parent = parent.parentElement; |
import matches from './matches'; | ||
function closest(el, selector) { | ||
let parent = el.parentElement; | ||
let parent = el.tagName.toLowerCase() === 'svg' ? el.parentNode : el.parentElement; | ||
while (parent.parentElement && !matches(parent, selector)) { | ||
@@ -6,0 +6,0 @@ parent = parent.parentElement; |
{ | ||
"name": "domassist", | ||
"version": "1.11.0", | ||
"version": "1.11.1", | ||
"description": "Various dom helpers", | ||
@@ -5,0 +5,0 @@ "main": "dist/domassist.js", |
@@ -107,2 +107,14 @@ /* eslint no-console: 0 */ | ||
test('closest of an SVG element', assert => { | ||
const node = document.createElement('div'); | ||
node.className = 'svg-wrapper'; | ||
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); | ||
node.appendChild(svg); | ||
const closest = domassist.closest(svg, '.svg-wrapper'); | ||
assert.equal(closest, node, 'Found closest'); | ||
assert.end(); | ||
}); | ||
test('Events - delegate', assert => { | ||
@@ -109,0 +121,0 @@ const el = domassist.findOne('#domassist'); |
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
66875
1782