Socket
Socket
Sign inDemoInstall

min-dom

Package Overview
Dependencies
Maintainers
9
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

min-dom - npm Package Compare versions

Comparing version 3.2.1 to 4.0.0

243

dist/index.esm.js

@@ -76,10 +76,6 @@ /**

*/
function assign$1(element) {
var target = element.style;
function assign(element, ...styleSources) {
const target = element.style;
for (var _len = arguments.length, styleSources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
styleSources[_key - 1] = arguments[_key];
}
forEach(styleSources, function (style) {
forEach(styleSources, function(style) {
if (!style) {

@@ -89,3 +85,3 @@ return;

forEach(style, function (value, key) {
forEach(style, function(value, key) {
target[key] = value;

@@ -107,2 +103,3 @@ });

function attr(el, name, val) {
// get

@@ -124,12 +121,2 @@ if (arguments.length == 2) {

var indexOf = [].indexOf;
var indexof = function(arr, obj){
if (indexOf) return arr.indexOf(obj);
for (var i = 0; i < arr.length; ++i) {
if (arr[i] === obj) return i;
}
return -1;
};
/**

@@ -142,12 +129,6 @@ * Taken from https://github.com/component/classes

/**
* Whitespace regexp.
*/
var re = /\s+/;
/**
* toString reference.
*/
var toString = Object.prototype.toString;
const toString = Object.prototype.toString;

@@ -189,14 +170,4 @@ /**

ClassList.prototype.add = function (name) {
// classList
if (this.list) {
this.list.add(name);
return this;
}
// fallback
var arr = this.array();
var i = indexof(arr, name);
if (!~i) arr.push(name);
this.el.className = arr.join(' ');
ClassList.prototype.add = function(name) {
this.list.add(name);
return this;

@@ -215,3 +186,3 @@ };

ClassList.prototype.remove = function (name) {
ClassList.prototype.remove = function(name) {
if ('[object RegExp]' == toString.call(name)) {

@@ -221,13 +192,3 @@ return this.removeMatching(name);

// classList
if (this.list) {
this.list.remove(name);
return this;
}
// fallback
var arr = this.array();
var i = indexof(arr, name);
if (~i) arr.splice(i, 1);
this.el.className = arr.join(' ');
this.list.remove(name);
return this;

@@ -244,5 +205,5 @@ };

ClassList.prototype.removeMatching = function (re) {
var arr = this.array();
for (var i = 0; i < arr.length; i++) {
ClassList.prototype.removeMatching = function(re) {
const arr = this.array();
for (let i = 0; i < arr.length; i++) {
if (re.test(arr[i])) {

@@ -267,30 +228,10 @@ this.remove(arr[i]);

ClassList.prototype.toggle = function (name, force) {
// classList
if (this.list) {
if ('undefined' !== typeof force) {
if (force !== this.list.toggle(name, force)) {
this.list.toggle(name); // toggle again to correct
}
} else {
this.list.toggle(name);
}
return this;
}
// fallback
ClassList.prototype.toggle = function(name, force) {
if ('undefined' !== typeof force) {
if (!force) {
this.remove(name);
} else {
this.add(name);
if (force !== this.list.toggle(name, force)) {
this.list.toggle(name); // toggle again to correct
}
} else {
if (this.has(name)) {
this.remove(name);
} else {
this.add(name);
}
this.list.toggle(name);
}
return this;

@@ -306,8 +247,4 @@ };

ClassList.prototype.array = function () {
var className = this.el.getAttribute('class') || '';
var str = className.replace(/^\s+|\s+$/g, '');
var arr = str.split(re);
if ('' === arr[0]) arr.shift();
return arr;
ClassList.prototype.array = function() {
return Array.from(this.list);
};

@@ -323,4 +260,5 @@

ClassList.prototype.has = ClassList.prototype.contains = function (name) {
return this.list ? this.list.contains(name) : !!~indexof(this.array(), name);
ClassList.prototype.has =
ClassList.prototype.contains = function(name) {
return this.list.contains(name);
};

@@ -343,29 +281,10 @@

var proto = typeof Element !== 'undefined' ? Element.prototype : {};
var vendor = proto.matches
|| proto.matchesSelector
|| proto.webkitMatchesSelector
|| proto.mozMatchesSelector
|| proto.msMatchesSelector
|| proto.oMatchesSelector;
var matchesSelector = match;
/**
* Match `el` to `selector`.
* @param { HTMLElement } element
* @param { String } selector
*
* @param {Element} el
* @param {String} selector
* @return {Boolean}
* @api public
* @return { boolean }
*/
function match(el, selector) {
if (!el || el.nodeType !== 1) return false;
if (vendor) return vendor.call(el, selector);
var nodes = el.parentNode.querySelectorAll(selector);
for (var i = 0; i < nodes.length; i++) {
if (nodes[i] == el) return true;
}
return false;
function matches(element, selector) {
return element && typeof element.matches === 'function' && element.matches(selector);
}

@@ -380,8 +299,9 @@

*/
function closest (element, selector, checkYourSelf) {
function closest(element, selector, checkYourSelf) {
var currentElem = checkYourSelf ? element : element.parentNode;
while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE &&
currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
if (matchesSelector(currentElem, selector)) {
if (matches(currentElem, selector)) {
return currentElem;

@@ -393,47 +313,8 @@ }

return matchesSelector(currentElem, selector) ? currentElem : null;
return matches(currentElem, selector) ? currentElem : null;
}
var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
prefix = bind$1 !== 'addEventListener' ? 'on' : '';
var componentEvent = {};
/**
* Bind `el` event `type` to `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
var bind_1 = function(el, type, fn, capture){
el[bind$1](prefix + type, fn, capture || false);
return fn;
};
/**
* Unbind `el` event `type`'s callback `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
var unbind_1 = function(el, type, fn, capture){
el[unbind](prefix + type, fn, capture || false);
return fn;
};
var componentEvent = {
bind: bind_1,
unbind: unbind_1
};
/**
* Module dependencies.

@@ -458,5 +339,5 @@ */

// when delegating.
var forceCaptureEvents = ['focus', 'blur'];
var forceCaptureEvents = [ 'focus', 'blur' ];
function bind$2(el, selector, type, fn, capture) {
function bind(el, selector, type, fn, capture) {
if (forceCaptureEvents.indexOf(type) !== -1) {

@@ -466,5 +347,5 @@ capture = true;

return componentEvent.bind(el, type, function (e) {
return componentEvent.bind(el, type, function(e) {
var target = e.target || e.srcElement;
e.delegateTarget = closest(target, selector, true, el);
e.delegateTarget = closest(target, selector, true);
if (e.delegateTarget) {

@@ -485,3 +366,3 @@ fn.call(el, e);

*/
function unbind$1(el, type, fn, capture) {
function unbind(el, type, fn, capture) {
if (forceCaptureEvents.indexOf(type) !== -1) {

@@ -495,4 +376,4 @@ capture = true;

var delegate = {
bind: bind$2,
unbind: unbind$1
bind,
unbind
};

@@ -526,3 +407,3 @@

var map$1 = {
var map = {
legend: [1, '<fieldset>', '</fieldset>'],

@@ -536,23 +417,23 @@ tr: [2, '<table><tbody>', '</tbody></table>'],

map$1.td =
map$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map.td =
map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map$1.option =
map$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
map.option =
map.optgroup = [1, '<select multiple="multiple">', '</select>'];
map$1.thead =
map$1.tbody =
map$1.colgroup =
map$1.caption =
map$1.tfoot = [1, '<table>', '</table>'];
map.thead =
map.tbody =
map.colgroup =
map.caption =
map.tfoot = [1, '<table>', '</table>'];
map$1.polyline =
map$1.ellipse =
map$1.polygon =
map$1.circle =
map$1.text =
map$1.line =
map$1.path =
map$1.rect =
map$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
map.polyline =
map.ellipse =
map.polygon =
map.circle =
map.text =
map.line =
map.path =
map.rect =
map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];

@@ -592,3 +473,3 @@ /**

// wrap map
var wrap = map$1[tag] || map$1._default;
var wrap = Object.prototype.hasOwnProperty.call(map, tag) ? map[tag] : map._default;
var depth = wrap[0];

@@ -615,2 +496,4 @@ var prefix = wrap[1];

var domify$1 = domify;
function query(selector, el) {

@@ -632,2 +515,2 @@ el = el || document;

export { assign$1 as assignStyle, attr, classes, clear, closest, delegate, domify, componentEvent as event, matchesSelector as matches, query, all as queryAll, remove };
export { assign as assignStyle, attr, classes, clear, closest, delegate, domify$1 as domify, componentEvent as event, matches, query, all as queryAll, remove };

@@ -80,10 +80,6 @@ 'use strict';

*/
function assign$1(element) {
var target = element.style;
function assign(element, ...styleSources) {
const target = element.style;
for (var _len = arguments.length, styleSources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
styleSources[_key - 1] = arguments[_key];
}
forEach(styleSources, function (style) {
forEach(styleSources, function(style) {
if (!style) {

@@ -93,3 +89,3 @@ return;

forEach(style, function (value, key) {
forEach(style, function(value, key) {
target[key] = value;

@@ -111,2 +107,3 @@ });

function attr(el, name, val) {
// get

@@ -128,12 +125,2 @@ if (arguments.length == 2) {

var indexOf = [].indexOf;
var indexof = function(arr, obj){
if (indexOf) return arr.indexOf(obj);
for (var i = 0; i < arr.length; ++i) {
if (arr[i] === obj) return i;
}
return -1;
};
/**

@@ -146,12 +133,6 @@ * Taken from https://github.com/component/classes

/**
* Whitespace regexp.
*/
var re = /\s+/;
/**
* toString reference.
*/
var toString = Object.prototype.toString;
const toString = Object.prototype.toString;

@@ -193,14 +174,4 @@ /**

ClassList.prototype.add = function (name) {
// classList
if (this.list) {
this.list.add(name);
return this;
}
// fallback
var arr = this.array();
var i = indexof(arr, name);
if (!~i) arr.push(name);
this.el.className = arr.join(' ');
ClassList.prototype.add = function(name) {
this.list.add(name);
return this;

@@ -219,3 +190,3 @@ };

ClassList.prototype.remove = function (name) {
ClassList.prototype.remove = function(name) {
if ('[object RegExp]' == toString.call(name)) {

@@ -225,13 +196,3 @@ return this.removeMatching(name);

// classList
if (this.list) {
this.list.remove(name);
return this;
}
// fallback
var arr = this.array();
var i = indexof(arr, name);
if (~i) arr.splice(i, 1);
this.el.className = arr.join(' ');
this.list.remove(name);
return this;

@@ -248,5 +209,5 @@ };

ClassList.prototype.removeMatching = function (re) {
var arr = this.array();
for (var i = 0; i < arr.length; i++) {
ClassList.prototype.removeMatching = function(re) {
const arr = this.array();
for (let i = 0; i < arr.length; i++) {
if (re.test(arr[i])) {

@@ -271,30 +232,10 @@ this.remove(arr[i]);

ClassList.prototype.toggle = function (name, force) {
// classList
if (this.list) {
if ('undefined' !== typeof force) {
if (force !== this.list.toggle(name, force)) {
this.list.toggle(name); // toggle again to correct
}
} else {
this.list.toggle(name);
}
return this;
}
// fallback
ClassList.prototype.toggle = function(name, force) {
if ('undefined' !== typeof force) {
if (!force) {
this.remove(name);
} else {
this.add(name);
if (force !== this.list.toggle(name, force)) {
this.list.toggle(name); // toggle again to correct
}
} else {
if (this.has(name)) {
this.remove(name);
} else {
this.add(name);
}
this.list.toggle(name);
}
return this;

@@ -310,8 +251,4 @@ };

ClassList.prototype.array = function () {
var className = this.el.getAttribute('class') || '';
var str = className.replace(/^\s+|\s+$/g, '');
var arr = str.split(re);
if ('' === arr[0]) arr.shift();
return arr;
ClassList.prototype.array = function() {
return Array.from(this.list);
};

@@ -327,4 +264,5 @@

ClassList.prototype.has = ClassList.prototype.contains = function (name) {
return this.list ? this.list.contains(name) : !!~indexof(this.array(), name);
ClassList.prototype.has =
ClassList.prototype.contains = function(name) {
return this.list.contains(name);
};

@@ -347,29 +285,10 @@

var proto = typeof Element !== 'undefined' ? Element.prototype : {};
var vendor = proto.matches
|| proto.matchesSelector
|| proto.webkitMatchesSelector
|| proto.mozMatchesSelector
|| proto.msMatchesSelector
|| proto.oMatchesSelector;
var matchesSelector = match;
/**
* Match `el` to `selector`.
* @param { HTMLElement } element
* @param { String } selector
*
* @param {Element} el
* @param {String} selector
* @return {Boolean}
* @api public
* @return { boolean }
*/
function match(el, selector) {
if (!el || el.nodeType !== 1) return false;
if (vendor) return vendor.call(el, selector);
var nodes = el.parentNode.querySelectorAll(selector);
for (var i = 0; i < nodes.length; i++) {
if (nodes[i] == el) return true;
}
return false;
function matches(element, selector) {
return element && typeof element.matches === 'function' && element.matches(selector);
}

@@ -384,8 +303,9 @@

*/
function closest (element, selector, checkYourSelf) {
function closest(element, selector, checkYourSelf) {
var currentElem = checkYourSelf ? element : element.parentNode;
while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE &&
currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
if (matchesSelector(currentElem, selector)) {
if (matches(currentElem, selector)) {
return currentElem;

@@ -397,47 +317,8 @@ }

return matchesSelector(currentElem, selector) ? currentElem : null;
return matches(currentElem, selector) ? currentElem : null;
}
var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
prefix = bind$1 !== 'addEventListener' ? 'on' : '';
var componentEvent = {};
/**
* Bind `el` event `type` to `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
var bind_1 = function(el, type, fn, capture){
el[bind$1](prefix + type, fn, capture || false);
return fn;
};
/**
* Unbind `el` event `type`'s callback `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
var unbind_1 = function(el, type, fn, capture){
el[unbind](prefix + type, fn, capture || false);
return fn;
};
var componentEvent = {
bind: bind_1,
unbind: unbind_1
};
/**
* Module dependencies.

@@ -462,5 +343,5 @@ */

// when delegating.
var forceCaptureEvents = ['focus', 'blur'];
var forceCaptureEvents = [ 'focus', 'blur' ];
function bind$2(el, selector, type, fn, capture) {
function bind(el, selector, type, fn, capture) {
if (forceCaptureEvents.indexOf(type) !== -1) {

@@ -470,5 +351,5 @@ capture = true;

return componentEvent.bind(el, type, function (e) {
return componentEvent.bind(el, type, function(e) {
var target = e.target || e.srcElement;
e.delegateTarget = closest(target, selector, true, el);
e.delegateTarget = closest(target, selector, true);
if (e.delegateTarget) {

@@ -489,3 +370,3 @@ fn.call(el, e);

*/
function unbind$1(el, type, fn, capture) {
function unbind(el, type, fn, capture) {
if (forceCaptureEvents.indexOf(type) !== -1) {

@@ -499,4 +380,4 @@ capture = true;

var delegate = {
bind: bind$2,
unbind: unbind$1
bind,
unbind
};

@@ -530,3 +411,3 @@

var map$1 = {
var map = {
legend: [1, '<fieldset>', '</fieldset>'],

@@ -540,23 +421,23 @@ tr: [2, '<table><tbody>', '</tbody></table>'],

map$1.td =
map$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map.td =
map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map$1.option =
map$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
map.option =
map.optgroup = [1, '<select multiple="multiple">', '</select>'];
map$1.thead =
map$1.tbody =
map$1.colgroup =
map$1.caption =
map$1.tfoot = [1, '<table>', '</table>'];
map.thead =
map.tbody =
map.colgroup =
map.caption =
map.tfoot = [1, '<table>', '</table>'];
map$1.polyline =
map$1.ellipse =
map$1.polygon =
map$1.circle =
map$1.text =
map$1.line =
map$1.path =
map$1.rect =
map$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
map.polyline =
map.ellipse =
map.polygon =
map.circle =
map.text =
map.line =
map.path =
map.rect =
map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];

@@ -596,3 +477,3 @@ /**

// wrap map
var wrap = map$1[tag] || map$1._default;
var wrap = Object.prototype.hasOwnProperty.call(map, tag) ? map[tag] : map._default;
var depth = wrap[0];

@@ -619,2 +500,4 @@ var prefix = wrap[1];

var domify$1 = domify;
function query(selector, el) {

@@ -636,3 +519,3 @@ el = el || document;

exports.assignStyle = assign$1;
exports.assignStyle = assign;
exports.attr = attr;

@@ -643,7 +526,7 @@ exports.classes = classes;

exports.delegate = delegate;
exports.domify = domify;
exports.domify = domify$1;
exports.event = componentEvent;
exports.matches = matchesSelector;
exports.matches = matches;
exports.query = query;
exports.queryAll = all;
exports.remove = remove;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.MinDom = {})));
}(this, (function (exports) { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MinDom = {}));
})(this, (function (exports) { 'use strict';

@@ -82,10 +82,6 @@ /**

*/
function assign$1(element) {
var target = element.style;
function assign(element, ...styleSources) {
const target = element.style;
for (var _len = arguments.length, styleSources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
styleSources[_key - 1] = arguments[_key];
}
forEach(styleSources, function (style) {
forEach(styleSources, function(style) {
if (!style) {

@@ -95,3 +91,3 @@ return;

forEach(style, function (value, key) {
forEach(style, function(value, key) {
target[key] = value;

@@ -113,2 +109,3 @@ });

function attr(el, name, val) {
// get

@@ -130,12 +127,2 @@ if (arguments.length == 2) {

var indexOf = [].indexOf;
var indexof = function(arr, obj){
if (indexOf) return arr.indexOf(obj);
for (var i = 0; i < arr.length; ++i) {
if (arr[i] === obj) return i;
}
return -1;
};
/**

@@ -148,12 +135,6 @@ * Taken from https://github.com/component/classes

/**
* Whitespace regexp.
*/
var re = /\s+/;
/**
* toString reference.
*/
var toString = Object.prototype.toString;
const toString = Object.prototype.toString;

@@ -195,14 +176,4 @@ /**

ClassList.prototype.add = function (name) {
// classList
if (this.list) {
this.list.add(name);
return this;
}
// fallback
var arr = this.array();
var i = indexof(arr, name);
if (!~i) arr.push(name);
this.el.className = arr.join(' ');
ClassList.prototype.add = function(name) {
this.list.add(name);
return this;

@@ -221,3 +192,3 @@ };

ClassList.prototype.remove = function (name) {
ClassList.prototype.remove = function(name) {
if ('[object RegExp]' == toString.call(name)) {

@@ -227,13 +198,3 @@ return this.removeMatching(name);

// classList
if (this.list) {
this.list.remove(name);
return this;
}
// fallback
var arr = this.array();
var i = indexof(arr, name);
if (~i) arr.splice(i, 1);
this.el.className = arr.join(' ');
this.list.remove(name);
return this;

@@ -250,5 +211,5 @@ };

ClassList.prototype.removeMatching = function (re) {
var arr = this.array();
for (var i = 0; i < arr.length; i++) {
ClassList.prototype.removeMatching = function(re) {
const arr = this.array();
for (let i = 0; i < arr.length; i++) {
if (re.test(arr[i])) {

@@ -273,30 +234,10 @@ this.remove(arr[i]);

ClassList.prototype.toggle = function (name, force) {
// classList
if (this.list) {
if ('undefined' !== typeof force) {
if (force !== this.list.toggle(name, force)) {
this.list.toggle(name); // toggle again to correct
}
} else {
this.list.toggle(name);
}
return this;
}
// fallback
ClassList.prototype.toggle = function(name, force) {
if ('undefined' !== typeof force) {
if (!force) {
this.remove(name);
} else {
this.add(name);
if (force !== this.list.toggle(name, force)) {
this.list.toggle(name); // toggle again to correct
}
} else {
if (this.has(name)) {
this.remove(name);
} else {
this.add(name);
}
this.list.toggle(name);
}
return this;

@@ -312,8 +253,4 @@ };

ClassList.prototype.array = function () {
var className = this.el.getAttribute('class') || '';
var str = className.replace(/^\s+|\s+$/g, '');
var arr = str.split(re);
if ('' === arr[0]) arr.shift();
return arr;
ClassList.prototype.array = function() {
return Array.from(this.list);
};

@@ -329,4 +266,5 @@

ClassList.prototype.has = ClassList.prototype.contains = function (name) {
return this.list ? this.list.contains(name) : !!~indexof(this.array(), name);
ClassList.prototype.has =
ClassList.prototype.contains = function(name) {
return this.list.contains(name);
};

@@ -349,29 +287,10 @@

var proto = typeof Element !== 'undefined' ? Element.prototype : {};
var vendor = proto.matches
|| proto.matchesSelector
|| proto.webkitMatchesSelector
|| proto.mozMatchesSelector
|| proto.msMatchesSelector
|| proto.oMatchesSelector;
var matchesSelector = match;
/**
* Match `el` to `selector`.
* @param { HTMLElement } element
* @param { String } selector
*
* @param {Element} el
* @param {String} selector
* @return {Boolean}
* @api public
* @return { boolean }
*/
function match(el, selector) {
if (!el || el.nodeType !== 1) return false;
if (vendor) return vendor.call(el, selector);
var nodes = el.parentNode.querySelectorAll(selector);
for (var i = 0; i < nodes.length; i++) {
if (nodes[i] == el) return true;
}
return false;
function matches(element, selector) {
return element && typeof element.matches === 'function' && element.matches(selector);
}

@@ -386,8 +305,9 @@

*/
function closest (element, selector, checkYourSelf) {
function closest(element, selector, checkYourSelf) {
var currentElem = checkYourSelf ? element : element.parentNode;
while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE && currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE &&
currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
if (matchesSelector(currentElem, selector)) {
if (matches(currentElem, selector)) {
return currentElem;

@@ -399,47 +319,8 @@ }

return matchesSelector(currentElem, selector) ? currentElem : null;
return matches(currentElem, selector) ? currentElem : null;
}
var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
prefix = bind$1 !== 'addEventListener' ? 'on' : '';
var componentEvent = {};
/**
* Bind `el` event `type` to `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
var bind_1 = function(el, type, fn, capture){
el[bind$1](prefix + type, fn, capture || false);
return fn;
};
/**
* Unbind `el` event `type`'s callback `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
var unbind_1 = function(el, type, fn, capture){
el[unbind](prefix + type, fn, capture || false);
return fn;
};
var componentEvent = {
bind: bind_1,
unbind: unbind_1
};
/**
* Module dependencies.

@@ -464,5 +345,5 @@ */

// when delegating.
var forceCaptureEvents = ['focus', 'blur'];
var forceCaptureEvents = [ 'focus', 'blur' ];
function bind$2(el, selector, type, fn, capture) {
function bind(el, selector, type, fn, capture) {
if (forceCaptureEvents.indexOf(type) !== -1) {

@@ -472,5 +353,5 @@ capture = true;

return componentEvent.bind(el, type, function (e) {
return componentEvent.bind(el, type, function(e) {
var target = e.target || e.srcElement;
e.delegateTarget = closest(target, selector, true, el);
e.delegateTarget = closest(target, selector, true);
if (e.delegateTarget) {

@@ -491,3 +372,3 @@ fn.call(el, e);

*/
function unbind$1(el, type, fn, capture) {
function unbind(el, type, fn, capture) {
if (forceCaptureEvents.indexOf(type) !== -1) {

@@ -501,4 +382,4 @@ capture = true;

var delegate = {
bind: bind$2,
unbind: unbind$1
bind,
unbind
};

@@ -532,3 +413,3 @@

var map$1 = {
var map = {
legend: [1, '<fieldset>', '</fieldset>'],

@@ -542,23 +423,23 @@ tr: [2, '<table><tbody>', '</tbody></table>'],

map$1.td =
map$1.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map.td =
map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map$1.option =
map$1.optgroup = [1, '<select multiple="multiple">', '</select>'];
map.option =
map.optgroup = [1, '<select multiple="multiple">', '</select>'];
map$1.thead =
map$1.tbody =
map$1.colgroup =
map$1.caption =
map$1.tfoot = [1, '<table>', '</table>'];
map.thead =
map.tbody =
map.colgroup =
map.caption =
map.tfoot = [1, '<table>', '</table>'];
map$1.polyline =
map$1.ellipse =
map$1.polygon =
map$1.circle =
map$1.text =
map$1.line =
map$1.path =
map$1.rect =
map$1.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
map.polyline =
map.ellipse =
map.polygon =
map.circle =
map.text =
map.line =
map.path =
map.rect =
map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];

@@ -598,3 +479,3 @@ /**

// wrap map
var wrap = map$1[tag] || map$1._default;
var wrap = Object.prototype.hasOwnProperty.call(map, tag) ? map[tag] : map._default;
var depth = wrap[0];

@@ -621,2 +502,4 @@ var prefix = wrap[1];

var domify$1 = domify;
function query(selector, el) {

@@ -638,3 +521,3 @@ el = el || document;

exports.assignStyle = assign$1;
exports.assignStyle = assign;
exports.attr = attr;

@@ -645,5 +528,5 @@ exports.classes = classes;

exports.delegate = delegate;
exports.domify = domify;
exports.domify = domify$1;
exports.event = componentEvent;
exports.matches = matchesSelector;
exports.matches = matches;
exports.query = query;

@@ -655,2 +538,2 @@ exports.queryAll = all;

})));
}));

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.MinDom={})}(this,function(e){"use strict";var s=Object.prototype.toString,u=Object.prototype.hasOwnProperty;function o(e,t){var r;if(void 0!==e){var n,i,o,l=(n=e,"[object Array]"===s.call(n)?d:c);for(var a in e)if(i=e,o=a,u.call(i,o)&&!1===t(r=e[a],l(a)))return r}}function c(e){return e}function d(e){return Number(e)}function n(e,t){if(i)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1}var i=[].indexOf,t=/\s+/,l=Object.prototype.toString;function r(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}r.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~n(t,e)||t.push(e),this.el.className=t.join(" "),this},r.prototype.remove=function(e){if("[object RegExp]"==l.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),r=n(t,e);return~r&&t.splice(r,1),this.el.className=t.join(" "),this},r.prototype.removeMatching=function(e){for(var t=this.array(),r=0;r<t.length;r++)e.test(t[r])&&this.remove(t[r]);return this},r.prototype.toggle=function(e,t){return this.list?void 0!==t&&t===this.list.toggle(e,t)||this.list.toggle(e):void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this},r.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(t);return""===e[0]&&e.shift(),e},r.prototype.has=r.prototype.contains=function(e){return this.list?this.list.contains(e):!!~n(this.array(),e)};var a="undefined"!=typeof Element?Element.prototype:{},f=a.matches||a.matchesSelector||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector,h=function(e,t){if(!e||1!==e.nodeType)return!1;if(f)return f.call(e,t);for(var r=e.parentNode.querySelectorAll(t),n=0;n<r.length;n++)if(r[n]==e)return!0;return!1};function p(e,t,r){for(var n=r?e:e.parentNode;n&&n.nodeType!==document.DOCUMENT_NODE&&n.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(h(n,t))return n;n=n.parentNode}return h(n,t)?n:null}var v=window.addEventListener?"addEventListener":"attachEvent",y=window.removeEventListener?"removeEventListener":"detachEvent",m="addEventListener"!=v?"on":"",g={bind:function(e,t,r,n){return e[v](m+t,r,n||!1),r},unbind:function(e,t,r,n){return e[y](m+t,r,n||!1),r}},b=["focus","blur"];function E(e,t){if("string"!=typeof e)throw new TypeError("String expected");t=t||document;var r=/<([\w:]+)/.exec(e);if(!r)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var n=r[1];if("body"==n){return(i=t.createElement("html")).innerHTML=e,i.removeChild(i.lastChild)}var i,o=M[n]||M._default,l=o[0],a=o[1],s=o[2];for((i=t.createElement("div")).innerHTML=a+e+s;l--;)i=i.lastChild;if(i.firstChild==i.lastChild)return i.removeChild(i.firstChild);for(var u=t.createDocumentFragment();i.firstChild;)u.appendChild(i.removeChild(i.firstChild));return u}var N,w={bind:function(r,n,e,i,t){return-1!==b.indexOf(e)&&(t=!0),g.bind(r,e,function(e){var t=e.target||e.srcElement;e.delegateTarget=p(t,n,!0),e.delegateTarget&&i.call(r,e)},t)},unbind:function(e,t,r,n){return-1!==b.indexOf(t)&&(n=!0),g.unbind(e,t,r,n)}},C=!1;"undefined"!=typeof document&&((N=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',C=!N.getElementsByTagName("link").length,N=void 0);var M={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:C?[1,"X<div>","</div>"]:[0,"",""]};M.td=M.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],M.option=M.optgroup=[1,'<select multiple="multiple">',"</select>"],M.thead=M.tbody=M.colgroup=M.caption=M.tfoot=[1,"<table>","</table>"],M.polyline=M.ellipse=M.polygon=M.circle=M.text=M.line=M.path=M.rect=M.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"],e.assignStyle=function(e){for(var r=e.style,t=arguments.length,n=Array(1<t?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return o(n,function(e){e&&o(e,function(e,t){r[t]=e})}),e},e.attr=function(e,t,r){return 2==arguments.length?e.getAttribute(t):null===r?e.removeAttribute(t):(e.setAttribute(t,r),e)},e.classes=function(e){return new r(e)},e.clear=function(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e},e.closest=p,e.delegate=w,e.domify=E,e.event=g,e.matches=h,e.query=function(e,t){return(t=t||document).querySelector(e)},e.queryAll=function(e,t){return(t=t||document).querySelectorAll(e)},e.remove=function(e){e.parentNode&&e.parentNode.removeChild(e)},Object.defineProperty(e,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).MinDom={})}(this,(function(t){"use strict";var e=Object.prototype.toString,r=Object.prototype.hasOwnProperty;function n(t,e){return r.call(t,e)}function o(t,r){var o;if(void 0!==t){var u=function(t){return"[object Array]"===e.call(t)}(t)?l:i;for(var c in t)if(n(t,c)&&!1===r(o=t[c],u(c)))return o}}function i(t){return t}function l(t){return Number(t)}const u=Object.prototype.toString;function c(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}function a(t,e){return t&&"function"==typeof t.matches&&t.matches(e)}function d(t,e,r){for(var n=r?t:t.parentNode;n&&n.nodeType!==document.DOCUMENT_NODE&&n.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(a(n,e))return n;n=n.parentNode}return a(n,e)?n:null}c.prototype.add=function(t){return this.list.add(t),this},c.prototype.remove=function(t){return"[object RegExp]"==u.call(t)?this.removeMatching(t):(this.list.remove(t),this)},c.prototype.removeMatching=function(t){const e=this.array();for(let r=0;r<e.length;r++)t.test(e[r])&&this.remove(e[r]);return this},c.prototype.toggle=function(t,e){return void 0!==e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this},c.prototype.array=function(){return Array.from(this.list)},c.prototype.has=c.prototype.contains=function(t){return this.list.contains(t)};var s={},f=["focus","blur"];var p,h={bind:function(t,e,r,n,o){return-1!==f.indexOf(r)&&(o=!0),s.bind(t,r,(function(r){var o=r.target||r.srcElement;r.delegateTarget=d(o,e,!0),r.delegateTarget&&n.call(t,r)}),o)},unbind:function(t,e,r,n){return-1!==f.indexOf(e)&&(n=!0),s.unbind(t,e,r,n)}},y=function(t,e){if("string"!=typeof t)throw new TypeError("String expected");e||(e=document);var r=/<([\w:]+)/.exec(t);if(!r)return e.createTextNode(t);t=t.replace(/^\s+|\s+$/g,"");var n=r[1];if("body"==n){return(o=e.createElement("html")).innerHTML=t,o.removeChild(o.lastChild)}var o,i=Object.prototype.hasOwnProperty.call(m,n)?m[n]:m._default,l=i[0],u=i[1],c=i[2];(o=e.createElement("div")).innerHTML=u+t+c;for(;l--;)o=o.lastChild;if(o.firstChild==o.lastChild)return o.removeChild(o.firstChild);var a=e.createDocumentFragment();for(;o.firstChild;)a.appendChild(o.removeChild(o.firstChild));return a},g=!1;"undefined"!=typeof document&&((p=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',g=!p.getElementsByTagName("link").length,p=void 0);var m={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:g?[1,"X<div>","</div>"]:[0,"",""]};m.td=m.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],m.option=m.optgroup=[1,'<select multiple="multiple">',"</select>"],m.thead=m.tbody=m.colgroup=m.caption=m.tfoot=[1,"<table>","</table>"],m.polyline=m.ellipse=m.polygon=m.circle=m.text=m.line=m.path=m.rect=m.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var v=y;t.assignStyle=function(t,...e){const r=t.style;return o(e,(function(t){t&&o(t,(function(t,e){r[e]=t}))})),t},t.attr=function(t,e,r){return 2==arguments.length?t.getAttribute(e):null===r?t.removeAttribute(e):(t.setAttribute(e,r),t)},t.classes=function(t){return new c(t)},t.clear=function(t){for(var e;t.childNodes.length;)e=t.childNodes[0],t.removeChild(e);return t},t.closest=d,t.delegate=h,t.domify=v,t.event=s,t.matches=a,t.query=function(t,e){return(e=e||document).querySelector(t)},t.queryAll=function(t,e){return(e=e||document).querySelectorAll(t)},t.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)},Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "min-dom",
"version": "3.2.1",
"version": "4.0.0",
"description": "A minimal dom utility toolbelt",

@@ -12,5 +12,5 @@ "main": "dist/index.js",

"copy": "cpx -v lib/*.d.ts dist",
"distro": "run-s copy bundle test:integration",
"distro": "run-s bundle test:integration",
"lint": "eslint .",
"prepublishOnly": "run-s distro",
"prepare": "run-s distro",
"test": "karma start",

@@ -39,35 +39,32 @@ "test:types": "tsc --project test/integration --pretty --noEmit",

"component-event": "^0.1.4",
"domify": "^1.3.1",
"domify": "^1.4.1",
"indexof": "0.0.1",
"matches-selector": "^1.2.0",
"min-dash": "^3.8.1"
},
"devDependencies": {
"@types/chai": "^4.3.1",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^14.1.0",
"@types/chai": "^4.3.3",
"@types/mocha": "^9.1.1",
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babelify": "^8.0.0",
"browserify": "^16.2.3",
"chai": "^4.2.0",
"cpx": "^1.5.0",
"eslint": "^5.6.1",
"eslint-plugin-bpmn-io": "^0.6.0",
"karma": "^4.4.1",
"karma-browserify": "^7.0.0",
"chai": "^4.3.6",
"eslint": "^8.23.1",
"eslint-plugin-bpmn-io": "^0.15.1",
"karma": "^6.4.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-firefox-launcher": "^1.3.0",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"mocha": "^5.2.0",
"karma-chrome-launcher": "^3.1.1",
"karma-firefox-launcher": "^2.1.2",
"karma-mocha": "^2.0.1",
"karma-webpack": "^5.0.0",
"mocha": "^10.0.0",
"npm-run-all": "^4.1.2",
"rollup": "^0.66.5",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-commonjs": "^9.1.8",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-uglify": "^6.0.0",
"typescript": "^4.6.4",
"watchify": "^3.9.0"
}
"puppeteer": "^17.1.3",
"rollup": "^2.79.0",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.8.3",
"webpack": "^5.74.0"
},
"files": [
"dist"
]
}

@@ -32,3 +32,3 @@ # min-dom

* `event` - event binding; [component-event](https://github.com/component/event)
* `matches` - selector match check; [matches-selector](https://github.com/ForbesLindesay/matches-selector)
* `matches` - selector match check
* `query` - native selector query support

@@ -35,0 +35,0 @@ * `remove` - detach a node from its parent

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