Comparing version 4.0.1 to 4.0.2
@@ -0,1 +1,16 @@ | ||
function _mergeNamespaces(n, m) { | ||
m.forEach(function (e) { | ||
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) { | ||
if (k !== 'default' && !(k in n)) { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
}); | ||
return Object.freeze(n); | ||
} | ||
/** | ||
@@ -304,3 +319,46 @@ * Flatten array, one level deep. | ||
var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent', | ||
unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent', | ||
prefix = bind$1 !== 'addEventListener' ? 'on' : ''; | ||
/** | ||
* 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 = componentEvent.bind = 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 = componentEvent.unbind = function(el, type, fn, capture){ | ||
el[unbind$1](prefix + type, fn, capture || false); | ||
return fn; | ||
}; | ||
var event = /*#__PURE__*/_mergeNamespaces({ | ||
__proto__: null, | ||
bind: bind_1, | ||
unbind: unbind_1, | ||
'default': componentEvent | ||
}, [componentEvent]); | ||
/** | ||
* Module dependencies. | ||
@@ -332,3 +390,3 @@ */ | ||
return componentEvent.bind(el, type, function(e) { | ||
return event.bind(el, type, function(e) { | ||
var target = e.target || e.srcElement; | ||
@@ -356,3 +414,3 @@ e.delegateTarget = closest(target, selector, true); | ||
return componentEvent.unbind(el, type, fn, capture); | ||
return event.unbind(el, type, fn, capture); | ||
} | ||
@@ -495,2 +553,3 @@ | ||
export { assign as assignStyle, attr, classes, clear, closest, delegate, domify$1 as domify, componentEvent as event, matches, query, all as queryAll, remove }; | ||
export { assign as assignStyle, attr, classes, clear, closest, delegate, domify$1 as domify, event, matches, query, all as queryAll, remove }; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -5,2 +5,17 @@ 'use strict'; | ||
function _mergeNamespaces(n, m) { | ||
m.forEach(function (e) { | ||
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) { | ||
if (k !== 'default' && !(k in n)) { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
}); | ||
return Object.freeze(n); | ||
} | ||
/** | ||
@@ -309,3 +324,46 @@ * Flatten array, one level deep. | ||
var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent', | ||
unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent', | ||
prefix = bind$1 !== 'addEventListener' ? 'on' : ''; | ||
/** | ||
* 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 = componentEvent.bind = 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 = componentEvent.unbind = function(el, type, fn, capture){ | ||
el[unbind$1](prefix + type, fn, capture || false); | ||
return fn; | ||
}; | ||
var event = /*#__PURE__*/_mergeNamespaces({ | ||
__proto__: null, | ||
bind: bind_1, | ||
unbind: unbind_1, | ||
'default': componentEvent | ||
}, [componentEvent]); | ||
/** | ||
* Module dependencies. | ||
@@ -337,3 +395,3 @@ */ | ||
return componentEvent.bind(el, type, function(e) { | ||
return event.bind(el, type, function(e) { | ||
var target = e.target || e.srcElement; | ||
@@ -361,3 +419,3 @@ e.delegateTarget = closest(target, selector, true); | ||
return componentEvent.unbind(el, type, fn, capture); | ||
return event.unbind(el, type, fn, capture); | ||
} | ||
@@ -507,3 +565,3 @@ | ||
exports.domify = domify$1; | ||
exports.event = componentEvent; | ||
exports.event = event; | ||
exports.matches = matches; | ||
@@ -513,1 +571,2 @@ exports.query = query; | ||
exports.remove = remove; | ||
//# sourceMappingURL=index.js.map |
@@ -7,2 +7,17 @@ (function (global, factory) { | ||
function _mergeNamespaces(n, m) { | ||
m.forEach(function (e) { | ||
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) { | ||
if (k !== 'default' && !(k in n)) { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
}); | ||
return Object.freeze(n); | ||
} | ||
/** | ||
@@ -311,3 +326,46 @@ * Flatten array, one level deep. | ||
var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent', | ||
unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent', | ||
prefix = bind$1 !== 'addEventListener' ? 'on' : ''; | ||
/** | ||
* 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 = componentEvent.bind = 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 = componentEvent.unbind = function(el, type, fn, capture){ | ||
el[unbind$1](prefix + type, fn, capture || false); | ||
return fn; | ||
}; | ||
var event = /*#__PURE__*/_mergeNamespaces({ | ||
__proto__: null, | ||
bind: bind_1, | ||
unbind: unbind_1, | ||
'default': componentEvent | ||
}, [componentEvent]); | ||
/** | ||
* Module dependencies. | ||
@@ -339,3 +397,3 @@ */ | ||
return componentEvent.bind(el, type, function(e) { | ||
return event.bind(el, type, function(e) { | ||
var target = e.target || e.srcElement; | ||
@@ -363,3 +421,3 @@ e.delegateTarget = closest(target, selector, true); | ||
return componentEvent.unbind(el, type, fn, capture); | ||
return event.unbind(el, type, fn, capture); | ||
} | ||
@@ -509,3 +567,3 @@ | ||
exports.domify = domify$1; | ||
exports.event = componentEvent; | ||
exports.event = event; | ||
exports.matches = matches; | ||
@@ -512,0 +570,0 @@ exports.query = query; |
@@ -1,1 +0,1 @@ | ||
!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})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MinDom={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}var n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;function o(e,t){return r.call(e,t)}function i(e,t){var r;if(void 0!==e){var i=function(e){return"[object Array]"===n.call(e)}(e)?u:l;for(var c in e)if(o(e,c)&&!1===t(r=e[c],i(c)))return r}}function l(e){return e}function u(e){return Number(e)}const c=Object.prototype.toString;function a(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function d(e,t){return e&&"function"==typeof e.matches&&e.matches(t)}function s(e,t,n){for(var r=n?e:e.parentNode;r&&r.nodeType!==document.DOCUMENT_NODE&&r.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(d(r,t))return r;r=r.parentNode}return d(r,t)?r:null}a.prototype.add=function(e){return this.list.add(e),this},a.prototype.remove=function(e){return"[object RegExp]"==c.call(e)?this.removeMatching(e):(this.list.remove(e),this)},a.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},a.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},a.prototype.array=function(){return Array.from(this.list)},a.prototype.has=a.prototype.contains=function(e){return this.list.contains(e)};var f={},p=window.addEventListener?"addEventListener":"attachEvent",h=window.removeEventListener?"removeEventListener":"detachEvent",y="addEventListener"!==p?"on":"",v=t({__proto__:null,bind:f.bind=function(e,t,n,r){return e[p](y+t,n,r||!1),n},unbind:f.unbind=function(e,t,n,r){return e[h](y+t,n,r||!1),n},default:f},[f]),g=["focus","blur"];var b,m={bind:function(e,t,n,r,o){return-1!==g.indexOf(n)&&(o=!0),v.bind(e,n,(function(n){var o=n.target||n.srcElement;n.delegateTarget=s(o,t,!0),n.delegateTarget&&r.call(e,n)}),o)},unbind:function(e,t,n,r){return-1!==g.indexOf(t)&&(r=!0),v.unbind(e,t,n,r)}},E=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var r=n[1];if("body"==r){return(o=t.createElement("html")).innerHTML=e,o.removeChild(o.lastChild)}var o,i=Object.prototype.hasOwnProperty.call(w,r)?w[r]:w._default,l=i[0],u=i[1],c=i[2];(o=t.createElement("div")).innerHTML=u+e+c;for(;l--;)o=o.lastChild;if(o.firstChild==o.lastChild)return o.removeChild(o.firstChild);var a=t.createDocumentFragment();for(;o.firstChild;)a.appendChild(o.removeChild(o.firstChild));return a},O=!1;"undefined"!=typeof document&&((b=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',O=!b.getElementsByTagName("link").length,b=void 0);var w={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:O?[1,"X<div>","</div>"]:[0,"",""]};w.td=w.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],w.option=w.optgroup=[1,'<select multiple="multiple">',"</select>"],w.thead=w.tbody=w.colgroup=w.caption=w.tfoot=[1,"<table>","</table>"],w.polyline=w.ellipse=w.polygon=w.circle=w.text=w.line=w.path=w.rect=w.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var T=E;e.assignStyle=function(e,...t){const n=e.style;return i(t,(function(e){e&&i(e,(function(e,t){n[t]=e}))})),e},e.attr=function(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)},e.classes=function(e){return new a(e)},e.clear=function(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e},e.closest=s,e.delegate=m,e.domify=T,e.event=v,e.matches=d,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})})); |
{ | ||
"name": "min-dom", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "A minimal dom utility toolbelt", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
120616
10
1481