Comparing version 3.0.0-beta.3 to 3.0.0-beta.4
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -330,3 +330,3 @@ * Released under the MIT License. | ||
return dir(dom, '', function (elem, method, cb) { | ||
childNodes(cb); | ||
childNodes(elem, cb); | ||
}); | ||
@@ -365,3 +365,3 @@ } | ||
computed = computed || getStyles(elem); | ||
var ret; | ||
var ret = ''; | ||
if (computed) { | ||
@@ -429,32 +429,32 @@ ret = computed.getPropertyValue(name) || computed[name]; | ||
* @param {String} key | ||
* @param {*} val | ||
* @param {*} value | ||
*/ | ||
function data (dom, key, value) { | ||
checkDom(dom, function (element) { | ||
var data = expandoStore(element, 'data'); | ||
var isSetter = !isUndefined(value); | ||
var keyDefined = !isSetter && !isUndefined(key); | ||
var isSimpleGetter = keyDefined && !isObject(key); | ||
if (!data && !isSimpleGetter) { | ||
expandoStore(element, 'data', data = {}); | ||
} | ||
if (isSetter) { | ||
if (isObject(key)) { // setter | ||
checkDom(dom, function (element) { | ||
var data = expandoStore(element, 'data'); | ||
if (!data) { | ||
expandoStore(dom, 'data', data = {}); | ||
} | ||
forIn(key, function (n, k) { | ||
data[k] = n; | ||
}); | ||
}); | ||
return dom; | ||
} else if (isNil(key)) { // get all | ||
dom = firstNode(dom); | ||
return dom && expandoStore(dom, 'data'); | ||
} else if (isUndefined(value)) { // getter | ||
var data = expandoStore(dom, 'data'); | ||
return data && data[key]; | ||
} else { | ||
checkDom(dom, function (element) { | ||
var data = expandoStore(element, 'data'); | ||
if (!data) { | ||
expandoStore(element, 'data', data = {}); | ||
} | ||
data[key] = value; | ||
} else { | ||
if (keyDefined) { | ||
if (isSimpleGetter) { | ||
return data && data[key]; | ||
} else { | ||
forIn$1(key, function (n, k) { | ||
data[k] = n; | ||
}); | ||
} | ||
} else { | ||
return data; | ||
} | ||
} | ||
}); | ||
return dom; | ||
}); | ||
return dom; | ||
} | ||
} | ||
@@ -854,2 +854,6 @@ | ||
function removeData () { | ||
} | ||
/** | ||
@@ -924,2 +928,3 @@ * 删除属性 | ||
removeClass: removeClass$1, | ||
removeData: removeData, | ||
removeProp: removeProp, | ||
@@ -926,0 +931,0 @@ show: show, |
65
dom.js
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
@@ -334,3 +334,3 @@ * Released under the MIT License. | ||
return dir(dom, '', function (elem, method, cb) { | ||
childNodes(cb); | ||
childNodes(elem, cb); | ||
}); | ||
@@ -369,3 +369,3 @@ } | ||
computed = computed || getStyles(elem); | ||
var ret; | ||
var ret = ''; | ||
if (computed) { | ||
@@ -433,32 +433,32 @@ ret = computed.getPropertyValue(name) || computed[name]; | ||
* @param {String} key | ||
* @param {*} val | ||
* @param {*} value | ||
*/ | ||
function data (dom, key, value) { | ||
checkDom(dom, function (element) { | ||
var data = expandoStore(element, 'data'); | ||
var isSetter = !isUndefined(value); | ||
var keyDefined = !isSetter && !isUndefined(key); | ||
var isSimpleGetter = keyDefined && !isObject(key); | ||
if (!data && !isSimpleGetter) { | ||
expandoStore(element, 'data', data = {}); | ||
} | ||
if (isSetter) { | ||
if (isObject(key)) { // setter | ||
checkDom(dom, function (element) { | ||
var data = expandoStore(element, 'data'); | ||
if (!data) { | ||
expandoStore(dom, 'data', data = {}); | ||
} | ||
forIn(key, function (n, k) { | ||
data[k] = n; | ||
}); | ||
}); | ||
return dom; | ||
} else if (isNil(key)) { // get all | ||
dom = firstNode(dom); | ||
return dom && expandoStore(dom, 'data'); | ||
} else if (isUndefined(value)) { // getter | ||
var data = expandoStore(dom, 'data'); | ||
return data && data[key]; | ||
} else { | ||
checkDom(dom, function (element) { | ||
var data = expandoStore(element, 'data'); | ||
if (!data) { | ||
expandoStore(element, 'data', data = {}); | ||
} | ||
data[key] = value; | ||
} else { | ||
if (keyDefined) { | ||
if (isSimpleGetter) { | ||
return data && data[key]; | ||
} else { | ||
forIn$1(key, function (n, k) { | ||
data[k] = n; | ||
}); | ||
} | ||
} else { | ||
return data; | ||
} | ||
} | ||
}); | ||
return dom; | ||
}); | ||
return dom; | ||
} | ||
} | ||
@@ -858,2 +858,6 @@ | ||
function removeData () { | ||
} | ||
/** | ||
@@ -928,2 +932,3 @@ * 删除属性 | ||
removeClass: removeClass$1, | ||
removeData: removeData, | ||
removeProp: removeProp, | ||
@@ -930,0 +935,0 @@ show: show, |
/*! | ||
* celia.js v3.0.0-beta.3 | ||
* celia.js v3.0.0-beta.4 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
"use strict";var fragmentRE=/^\s*<(\w+|!)[^>]*>/,singleTagRE=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,rnothtmlwhiteRE=/[^\x20\t\r\n\f]+/g;function isString(e){return"string"==typeof e}function classesToArray(e){return Array.isArray(e)?e:isString(e)&&e.match(rnothtmlwhiteRE)||[]}var classListSupported=!!document.body.classList,propFix={for:"htmlFor",class:"className"};["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"].forEach(function(e){propFix[e.toLowerCase()]=e});var testEl=document.createElement("div"),cssPrefixes=["Webkit","Moz","ms"],emptyStyle=testEl.style;function vendorPropName(e){if(e in emptyStyle)return e;for(var n=e[0].toUpperCase()+e.slice(1),t=cssPrefixes.length;t--;)if((e=cssPrefixes[t]+n)in emptyStyle)return e}var siblingHooker={nextElementSibling:"nextSibling",previousElementSibling:"previousSibling"};function iteratorCallback(e,n){return n?e.bind(n):e}function forEach(e,n,t){for(var r=iteratorCallback(n,t),o=0,i=e.length,a=void 0;!1!==a&&o<i;o++)a=r(e[o],o,e)}function firstNode(e){return e&&(-1<e.length?e[0]:e)}function checkDom(e,n){return e&&(-1<e.length?forEach(e,n):n(e)),e}function append(e,n){e[e.length]=n}var addClass=classListSupported?function(n,e){e.forEach(function(e){n.classList.add(e)})}:function(e,n){var t=classesToArray(e.className),r=t.slice(0);n.forEach(function(e){-1===r.indexOf(e)&&append(r,e)}),(t=t.join(" "))!==(r=r.join(" "))&&(e.className=r)};function addClass$1(e,n){var t=classesToArray(n);return checkDom(e,function(e){addClass(e,t)}),e}function isNil(e){return null==e}function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}function isArrayLike(e){return!isNil(e)&&isNumber(e.length)&&!isFunction(e)}function forIn(e,n,t){var r=iteratorCallback(n,t);for(var o in e)if(!1===r(e[o],o,e))break}function forIn$1(e,n,t){return e&&forIn(e,n,t)}function childNodes(e,n){var t=[],r=n||function(e){append(t,e)};return forEach(e.childNodes,function(e,n){var t=0;1===e.nodeType&&r(e,++t,n)}),t}function fragment(e,n,t){var r=e.match(singleTagRE);if(r){var o=document.createElement(r[1]);forIn$1(n,function(e,n){o.setAttribute(n,e)}),t(o)}else fragmentRE.test(e)?(testEl.innerHTML=e,childNodes(testEl,t)):t(document.createTextNode(e))}function fragmentForList(e){var n=document.createDocumentFragment();return forEach(e,function(e){1===e.nodeType?n.appendChild(e):!isString(e)&&isArrayLike(e)?forEach(e,function(e){n.appendChild(e)}):fragment(e,null,function(e){n.appendChild(e)})}),n}function domManip(e,n,t,r){if(e){document.body[t]&&(r=function(e,n){e[t](n)});var o=fragmentForList(n),i=e.length;if(i){for(var a=i-1,c=0,u=a;c<u;c++)r(e[c],o.cloneNode(!0));r(e[a],o)}else r(e,o)}return e}function after(e){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];return domManip(e,n,"after",function(e,n){var t=e.parentNode;t&&t.insertBefore(n,e.nextSibling)})}function append$1(e){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];return domManip(e,n,"appendChild")}function isUndefined(e){return void 0===e}function getAttribute(e,n){return(e=firstNode(e))&&e.getAttribute(n)}function setAttribute(e,n,t){return checkDom(e,function(e){e.setAttribute(n,t)}),e}function attr(e,n,t){return isUndefined(t)?getAttribute(e,n):setAttribute(e,n,t)}function before(e){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];return domManip(e,n,"before",function(e,n){var t=e.parentNode;t&&t.insertBefore(n,e)})}function append$2(e,n){e&&(e[e.length]=n)}function dir(e,n,t){var r=[];return checkDom(e,function(e){t(e,n,function(e){append$2(r,e)})}),r}function children(e){return dir(e,"",function(e,n,t){childNodes(t)})}var DASH_ALPHA_REGEX=/-([a-z])/g;function camelCase(e){return e.replace(DASH_ALPHA_REGEX,function(e,n){return n.toUpperCase()})}var cssProps={};function style(e,n,t){var r=e.style;if(n=cssProps[n]||(cssProps[n]=vendorPropName(n)||n),isNil(t))return r[n];r[n]=t}function getStyles(e){var n=e.ownerDocument.defaultView;return n&&n.opener||(n=window),n.getComputedStyle(e)}function curCSS(e,n,t){var r;return(t=t||getStyles(e))&&(r=t.getPropertyValue(n)||t[n]),r}function getter(e,n){return(e=firstNode(e))?curCSS(e,n):""}function setter(e,n,t){return checkDom(e,function(e){style(e,n,t)}),e}function css(e,n,t){return n=camelCase(n),isUndefined(t)?getter(e,n):setter(e,n,t)}function isObject(e){return!isNil(e)&&"object"==typeof e}var expandoSequence=1,expandoKey="expando9527",cache={};function nextId(){return++expandoSequence}function expandoStore(e,n,t){var r=e[expandoKey],o=cache[r||-1];if(isUndefined(t))return o&&o[n];o||(e[expandoKey]=r=nextId(),o=cache[r]={}),o[n]=t}function data(e,i,a){return checkDom(e,function(e){var t=expandoStore(e,"data"),n=!isUndefined(a),r=!n&&!isUndefined(i),o=r&&!isObject(i);if(t||o||expandoStore(e,"data",t={}),n)t[i]=a;else{if(!r)return t;if(o)return t&&t[i];forIn$1(i,function(e,n){t[n]=e})}}),e}function empty(){}function hasClass(e,n){var t=!1,r=classesToArray(e.className);return forEach(n,function(e){if(-1<r.indexOf(e))return!(t=!0)}),t}function hasClass$1(e,n){var t=!1;return checkDom(e,function(e){if(hasClass(e,n))return!(t=!0)}),t}function showHide(e,r){return checkDom(e,function(e){var n=e.style.display||"",t=expandoStore(e,"display");(isUndefined(t)&&(expandoStore(e,"display",n),t=n),r)?n?"none"===n&&(e.style.display=t):"none"===curCSS(e,"display")&&(e.style.display="block"):e.style.display="none"}),e}function hide(e){return showHide(e)}function html(e,n){isNil(n)||checkDom(e,1===n.nodeType?function(e){append$1(e,n)}:function(e){e.innerHTML=String(n)});return e}function sibling(e,n,t){var r=e[n];if(r)t(r);else{for(n=siblingHooker[n];(e=e[n])&&1!==e.nodeType;);e&&t(e)}}function next(e){return dir(e,"nextElementSibling",sibling)}function siblings(e,n,t){if(n in e)for(;e=e[n];)t(e);else for(n=siblingHooker[n];(e=e[n])&&1===e.nodeType;)t(e)}function nextAll(e){return dir(e,"nextElementSibling",siblings)}function forEach$1(e,n,t){return e&&forEach(e,n,t)}function inArray(e,n,t){if(n){if(n.indexOf)return n.indexOf(e,t);for(var r=n.length,o=t?t<0?Math.max(0,r+t):t:0;o<r;o++)if(o in n&&n[o]===e)return o}return-1}function removeAt(e,n){return e.splice(n,1),n}function remove(e,n){var t=inArray(n,e);return 0<=t?(removeAt(e,t),n):null}var removeEventListenerFn=window.removeEventListener?function(e,n,t){e.removeEventListener(n,t,!1)}:function(e,n,t){e.detachEvent("on"+n,t)};function off(e,n,o){return checkDom(e,function(t){var r=expandoStore(t,"events");expandoStore(t,"handle")&&(isUndefined(n)?forEach$1(r,function(e,n){removeEventListenerFn(t,n,e),delete r[n]}):forEach$1(n.split(" "),function(e){isUndefined(o)?(removeEventListenerFn(t,e,r[e]),delete r[e]):remove(r[e],o)}))}),e}var addEventListenerFn=window.addEventListener?function(e,n,t){e.addEventListener(n,t,!1)}:function(e,n,t){e.attachEvent("on"+n,t)};function createEventHandler(t,r){var e=function(n){if(n.preventDefault||(n.preventDefault=function(){n.returnValue=!1}),n.stopPropagation||(n.stopPropagation=function(){n.cancelBubble=!0}),n.target||(n.target=n.srcElement||document),isUndefined(n.defaultPrevented)){var e=n.preventDefault;e=e.bind(n),n.preventDefault=function(){n.defaultPrevented=!0,e()},n.defaultPrevented=!1}n.isDefaultPrevented=function(){return n.defaultPrevented||!1===n.returnValue},forEach$1(r[n.type],function(e){return e.call(t,n)});try{delete n.preventDefault,delete n.stopPropagation,delete n.isDefaultPrevented}catch(e){n.preventDefault=null,n.stopPropagation=null,n.isDefaultPrevented=null}};return e.elem=t,e}function on(e,n,i){return checkDom(e,function(t){var r=expandoStore(t,"events"),o=expandoStore(t,"handle");r||expandoStore(t,"events",r={}),o||expandoStore(t,"handle",o=createEventHandler(t,r)),n.split(" ").forEach(function(e){var n=r[e];n||(addEventListenerFn(t,e,o),n=r[e]=[]),n[n.length]=i})}),e}function parent(e){return dir(e,"",function(e,n,t){var r=e.parentNode;r&&t(r)})}function prepend(e){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];return domManip(e,n,"prepend",function(e,n){1!==e.nodeType&&11!==e.nodeType&&9!==e.nodeType||e.insertBefore(n,e.firstChild)})}function prev(e){return dir(e,"previousElementSibling",sibling)}function prevAll(e){return dir(e,"previousElementSibling",siblings)}function getProperty(e,n){return(e=firstNode(e))&&e[n]}function setProperty(e,n,t){return n=propFix[n]||n,checkDom(e,function(e){e[n]=t}),e}function prop(e,n,t){return isUndefined(t)?getProperty(e,n):setProperty(e,n,t)}function remove$1(e){return checkDom(e,function(e){var n=e.parentNode;n&&n.removeChild(e)}),e}function removeAttr(e,n){var t=classesToArray(n);return checkDom(e,function(n){t.forEach(function(e){n.removeAttribute(e)})}),e}var removeClass=classListSupported?function(n,e){e.forEach(function(e){n.classList.remove(e)})}:function(e,n){var t=classesToArray(e.className),r=t.slice(0);n.forEach(function(e){var n=r.indexOf(e);-1<n&&r.splice(n,1)}),(t=t.join(" "))!==(r=r.join(" "))&&(e.className=r)};function removeClass$1(e,n){if(!arguments.length)return prop(e,"className","");var t=classesToArray(n);return checkDom(e,function(e){removeClass(e,t)}),e}function removeProp(e,n){return checkDom(e,function(e){delete e[propFix[n]||n]}),e}function show(e){return showHide(e,!0)}function wrap(e){e.wrap=function(o){return o?(fragment(o,null,function(e){return o=e,!1}),checkDom(function(e,n){var t=o;n&&(t=o.cloneNode(!0));var r=e.parentNode;r&&r.replaceChild(t,e),t.appendChild(e)})):this}}var dom={addClass:addClass$1,after:after,append:append$1,attr:attr,before:before,children:children,css:css,data:data,empty:empty,hasClass:hasClass$1,hide:hide,html:html,next:next,nextAll:nextAll,off:off,on:on,parent:parent,prepend:prepend,prev:prev,prevAll:prevAll,prop:prop,remove:remove$1,removeAttr:removeAttr,removeClass:removeClass$1,removeProp:removeProp,show:show,wrap:wrap};module.exports=dom; | ||
"use strict";var fragmentRE=/^\s*<(\w+|!)[^>]*>/,singleTagRE=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,rnothtmlwhiteRE=/[^\x20\t\r\n\f]+/g;function isString(e){return"string"==typeof e}function classesToArray(e){return Array.isArray(e)?e:isString(e)&&e.match(rnothtmlwhiteRE)||[]}var classListSupported=!!document.body.classList,propFix={for:"htmlFor",class:"className"};["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"].forEach(function(e){propFix[e.toLowerCase()]=e});var testEl=document.createElement("div"),cssPrefixes=["Webkit","Moz","ms"],emptyStyle=testEl.style;function vendorPropName(e){if(e in emptyStyle)return e;for(var n=e[0].toUpperCase()+e.slice(1),t=cssPrefixes.length;t--;)if((e=cssPrefixes[t]+n)in emptyStyle)return e}var siblingHooker={nextElementSibling:"nextSibling",previousElementSibling:"previousSibling"};function iteratorCallback(e,n){return n?e.bind(n):e}function forEach(e,n,t){for(var r=iteratorCallback(n,t),o=0,i=e.length,a=void 0;!1!==a&&o<i;o++)a=r(e[o],o,e)}function firstNode(e){return e&&(-1<e.length?e[0]:e)}function checkDom(e,n){return e&&(-1<e.length?forEach(e,n):n(e)),e}function append(e,n){e[e.length]=n}var addClass=classListSupported?function(n,e){e.forEach(function(e){n.classList.add(e)})}:function(e,n){var t=classesToArray(e.className),r=t.slice(0);n.forEach(function(e){-1===r.indexOf(e)&&append(r,e)}),(t=t.join(" "))!==(r=r.join(" "))&&(e.className=r)};function addClass$1(e,n){var t=classesToArray(n);return checkDom(e,function(e){addClass(e,t)}),e}function isNil(e){return null==e}function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}function isArrayLike(e){return!isNil(e)&&isNumber(e.length)&&!isFunction(e)}function forIn(e,n,t){var r=iteratorCallback(n,t);for(var o in e)if(!1===r(e[o],o,e))break}function forIn$1(e,n,t){return e&&forIn(e,n,t)}function childNodes(e,n){var t=[],r=n||function(e){append(t,e)};return forEach(e.childNodes,function(e,n){var t=0;1===e.nodeType&&r(e,++t,n)}),t}function fragment(e,n,t){var r=e.match(singleTagRE);if(r){var o=document.createElement(r[1]);forIn$1(n,function(e,n){o.setAttribute(n,e)}),t(o)}else fragmentRE.test(e)?(testEl.innerHTML=e,childNodes(testEl,t)):t(document.createTextNode(e))}function fragmentForList(e){var n=document.createDocumentFragment();return forEach(e,function(e){1===e.nodeType?n.appendChild(e):!isString(e)&&isArrayLike(e)?forEach(e,function(e){n.appendChild(e)}):fragment(e,null,function(e){n.appendChild(e)})}),n}function domManip(e,n,t,r){if(e){document.body[t]&&(r=function(e,n){e[t](n)});var o=fragmentForList(n),i=e.length;if(i){for(var a=i-1,c=0,u=a;c<u;c++)r(e[c],o.cloneNode(!0));r(e[a],o)}else r(e,o)}return e}function after(e){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];return domManip(e,n,"after",function(e,n){var t=e.parentNode;t&&t.insertBefore(n,e.nextSibling)})}function append$1(e){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];return domManip(e,n,"appendChild")}function isUndefined(e){return void 0===e}function getAttribute(e,n){return(e=firstNode(e))&&e.getAttribute(n)}function setAttribute(e,n,t){return checkDom(e,function(e){e.setAttribute(n,t)}),e}function attr(e,n,t){return isUndefined(t)?getAttribute(e,n):setAttribute(e,n,t)}function before(e){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];return domManip(e,n,"before",function(e,n){var t=e.parentNode;t&&t.insertBefore(n,e)})}function append$2(e,n){e&&(e[e.length]=n)}function dir(e,n,t){var r=[];return checkDom(e,function(e){t(e,n,function(e){append$2(r,e)})}),r}function children(e){return dir(e,"",function(e,n,t){childNodes(e,t)})}var DASH_ALPHA_REGEX=/-([a-z])/g;function camelCase(e){return e.replace(DASH_ALPHA_REGEX,function(e,n){return n.toUpperCase()})}var cssProps={};function style(e,n,t){var r=e.style;if(n=cssProps[n]||(cssProps[n]=vendorPropName(n)||n),isNil(t))return r[n];r[n]=t}function getStyles(e){var n=e.ownerDocument.defaultView;return n&&n.opener||(n=window),n.getComputedStyle(e)}function curCSS(e,n,t){var r="";return(t=t||getStyles(e))&&(r=t.getPropertyValue(n)||t[n]),r}function getter(e,n){return(e=firstNode(e))?curCSS(e,n):""}function setter(e,n,t){return checkDom(e,function(e){style(e,n,t)}),e}function css(e,n,t){return n=camelCase(n),isUndefined(t)?getter(e,n):setter(e,n,t)}function isObject(e){return!isNil(e)&&"object"==typeof e}var expandoSequence=1,expandoKey="expando9527",cache={};function nextId(){return++expandoSequence}function expandoStore(e,n,t){var r=e[expandoKey],o=cache[r||-1];if(isUndefined(t))return o&&o[n];o||(e[expandoKey]=r=nextId(),o=cache[r]={}),o[n]=t}function data(n,r,t){if(isObject(r))return checkDom(n,function(e){var t=expandoStore(e,"data");t||expandoStore(n,"data",t={}),forIn(r,function(e,n){t[n]=e})}),n;if(isNil(r))return(n=firstNode(n))&&expandoStore(n,"data");if(isUndefined(t)){var e=expandoStore(n,"data");return e&&e[r]}return checkDom(n,function(e){var n=expandoStore(e,"data");n||expandoStore(e,"data",n={}),n[r]=t}),n}function empty(){}function hasClass(e,n){var t=!1,r=classesToArray(e.className);return forEach(n,function(e){if(-1<r.indexOf(e))return!(t=!0)}),t}function hasClass$1(e,n){var t=!1;return checkDom(e,function(e){if(hasClass(e,n))return!(t=!0)}),t}function showHide(e,r){return checkDom(e,function(e){var n=e.style.display||"",t=expandoStore(e,"display");(isUndefined(t)&&(expandoStore(e,"display",n),t=n),r)?n?"none"===n&&(e.style.display=t):"none"===curCSS(e,"display")&&(e.style.display="block"):e.style.display="none"}),e}function hide(e){return showHide(e)}function html(e,n){isNil(n)||checkDom(e,1===n.nodeType?function(e){append$1(e,n)}:function(e){e.innerHTML=String(n)});return e}function sibling(e,n,t){var r=e[n];if(r)t(r);else{for(n=siblingHooker[n];(e=e[n])&&1!==e.nodeType;);e&&t(e)}}function next(e){return dir(e,"nextElementSibling",sibling)}function siblings(e,n,t){if(n in e)for(;e=e[n];)t(e);else for(n=siblingHooker[n];(e=e[n])&&1===e.nodeType;)t(e)}function nextAll(e){return dir(e,"nextElementSibling",siblings)}function forEach$1(e,n,t){return e&&forEach(e,n,t)}function inArray(e,n,t){if(n){if(n.indexOf)return n.indexOf(e,t);for(var r=n.length,o=t?t<0?Math.max(0,r+t):t:0;o<r;o++)if(o in n&&n[o]===e)return o}return-1}function removeAt(e,n){return e.splice(n,1),n}function remove(e,n){var t=inArray(n,e);return 0<=t?(removeAt(e,t),n):null}var removeEventListenerFn=window.removeEventListener?function(e,n,t){e.removeEventListener(n,t,!1)}:function(e,n,t){e.detachEvent("on"+n,t)};function off(e,n,o){return checkDom(e,function(t){var r=expandoStore(t,"events");expandoStore(t,"handle")&&(isUndefined(n)?forEach$1(r,function(e,n){removeEventListenerFn(t,n,e),delete r[n]}):forEach$1(n.split(" "),function(e){isUndefined(o)?(removeEventListenerFn(t,e,r[e]),delete r[e]):remove(r[e],o)}))}),e}var addEventListenerFn=window.addEventListener?function(e,n,t){e.addEventListener(n,t,!1)}:function(e,n,t){e.attachEvent("on"+n,t)};function createEventHandler(t,r){var e=function(n){if(n.preventDefault||(n.preventDefault=function(){n.returnValue=!1}),n.stopPropagation||(n.stopPropagation=function(){n.cancelBubble=!0}),n.target||(n.target=n.srcElement||document),isUndefined(n.defaultPrevented)){var e=n.preventDefault;e=e.bind(n),n.preventDefault=function(){n.defaultPrevented=!0,e()},n.defaultPrevented=!1}n.isDefaultPrevented=function(){return n.defaultPrevented||!1===n.returnValue},forEach$1(r[n.type],function(e){return e.call(t,n)});try{delete n.preventDefault,delete n.stopPropagation,delete n.isDefaultPrevented}catch(e){n.preventDefault=null,n.stopPropagation=null,n.isDefaultPrevented=null}};return e.elem=t,e}function on(e,n,i){return checkDom(e,function(t){var r=expandoStore(t,"events"),o=expandoStore(t,"handle");r||expandoStore(t,"events",r={}),o||expandoStore(t,"handle",o=createEventHandler(t,r)),n.split(" ").forEach(function(e){var n=r[e];n||(addEventListenerFn(t,e,o),n=r[e]=[]),n[n.length]=i})}),e}function parent(e){return dir(e,"",function(e,n,t){var r=e.parentNode;r&&t(r)})}function prepend(e){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];return domManip(e,n,"prepend",function(e,n){1!==e.nodeType&&11!==e.nodeType&&9!==e.nodeType||e.insertBefore(n,e.firstChild)})}function prev(e){return dir(e,"previousElementSibling",sibling)}function prevAll(e){return dir(e,"previousElementSibling",siblings)}function getProperty(e,n){return(e=firstNode(e))&&e[n]}function setProperty(e,n,t){return n=propFix[n]||n,checkDom(e,function(e){e[n]=t}),e}function prop(e,n,t){return isUndefined(t)?getProperty(e,n):setProperty(e,n,t)}function remove$1(e){return checkDom(e,function(e){var n=e.parentNode;n&&n.removeChild(e)}),e}function removeAttr(e,n){var t=classesToArray(n);return checkDom(e,function(n){t.forEach(function(e){n.removeAttribute(e)})}),e}var removeClass=classListSupported?function(n,e){e.forEach(function(e){n.classList.remove(e)})}:function(e,n){var t=classesToArray(e.className),r=t.slice(0);n.forEach(function(e){var n=r.indexOf(e);-1<n&&r.splice(n,1)}),(t=t.join(" "))!==(r=r.join(" "))&&(e.className=r)};function removeClass$1(e,n){if(!arguments.length)return prop(e,"className","");var t=classesToArray(n);return checkDom(e,function(e){removeClass(e,t)}),e}function removeData(){}function removeProp(e,n){return checkDom(e,function(e){delete e[propFix[n]||n]}),e}function show(e){return showHide(e,!0)}function wrap(e){e.wrap=function(o){return o?(fragment(o,null,function(e){return o=e,!1}),checkDom(function(e,n){var t=o;n&&(t=o.cloneNode(!0));var r=e.parentNode;r&&r.replaceChild(t,e),t.appendChild(e)})):this}}var dom={addClass:addClass$1,after:after,append:append$1,attr:attr,before:before,children:children,css:css,data:data,empty:empty,hasClass:hasClass$1,hide:hide,html:html,next:next,nextAll:nextAll,off:off,on:on,parent:parent,prepend:prepend,prev:prev,prevAll:prevAll,prop:prop,remove:remove$1,removeAttr:removeAttr,removeClass:removeClass$1,removeData:removeData,removeProp:removeProp,show:show,wrap:wrap};module.exports=dom; |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).celia=e()}(this,function(){"use strict";var o=/^\s*<(\w+|!)[^>]*>/,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,e=/[^\x20\t\r\n\f]+/g;function r(n){return"string"==typeof n}function f(n){return Array.isArray(n)?n:r(n)&&n.match(e)||[]}var n=!!document.body.classList,a={for:"htmlFor",class:"className"};["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"].forEach(function(n){a[n.toLowerCase()]=n});var c=document.createElement("div"),i=["Webkit","Moz","ms"],l=c.style;var d={nextElementSibling:"nextSibling",previousElementSibling:"previousSibling"};function s(n,e){return e?n.bind(e):n}function v(n,e,t){for(var r=s(e,t),i=0,o=n.length,u=void 0;!1!==u&&i<o;i++)u=r(n[i],i,n)}function p(n){return n&&(-1<n.length?n[0]:n)}function m(n,e){return n&&(-1<n.length?v(n,e):e(n)),n}function h(n,e){n[n.length]=e}var g=n?function(e,n){n.forEach(function(n){e.classList.add(n)})}:function(n,e){var t=f(n.className),r=t.slice(0);e.forEach(function(n){-1===r.indexOf(n)&&h(r,n)}),(t=t.join(" "))!==(r=r.join(" "))&&(n.className=r)};function y(n){return null==n}function b(n,e,t){return n&&function(n,e,t){var r=s(e,t);for(var i in n)if(!1===r(n[i],i,n))break}(n,e,t)}function E(n,e){var t=[],r=e||function(n){h(t,n)};return v(n.childNodes,function(n,e){var t=0;1===n.nodeType&&r(n,++t,e)}),t}function x(n,e,t){var r=n.match(u);if(r){var i=document.createElement(r[1]);b(e,function(n,e){i.setAttribute(e,n)}),t(i)}else o.test(n)?(c.innerHTML=n,E(c,t)):t(document.createTextNode(n))}function N(n){var t=document.createDocumentFragment();return v(n,function(n){var e;1===n.nodeType?t.appendChild(n):r(n)||(y(e=n)||"number"!=typeof e.length||"function"==typeof e)?x(n,null,function(n){t.appendChild(n)}):v(n,function(n){t.appendChild(n)})}),t}function w(n,e,t,r){if(n){document.body[t]&&(r=function(n,e){n[t](e)});var i=N(e),o=n.length;if(o){for(var u=o-1,f=0,a=u;f<a;f++)r(n[f],i.cloneNode(!0));r(n[u],i)}else r(n,i)}return n}function t(n){for(var e=[],t=arguments.length-1;0<t--;)e[t]=arguments[t+1];return w(n,e,"appendChild")}function C(n){return void 0===n}function P(n,e,t){var r=[];return m(n,function(n){t(n,e,function(n){var e,t;t=n,(e=r)&&(e[e.length]=t)})}),r}var S=/-([a-z])/g;var D={};function L(n,e,t){var r=n.style;if(e=D[e]||(D[e]=function(n){if(n in l)return n;for(var e=n[0].toUpperCase()+n.slice(1),t=i.length;t--;)if((n=i[t]+e)in l)return n}(e)||e),y(t))return r[e];r[e]=t}function T(n,e,t){var r,i,o;return(t=t||((i=(r=n).ownerDocument.defaultView)&&i.opener||(i=window),i.getComputedStyle(r)))&&(o=t.getPropertyValue(e)||t[e]),o}var A=1,j="expando9527",O={};function B(n,e,t){var r=n[j],i=O[r||-1];if(C(t))return i&&i[e];i||(n[j]=r=++A,i=O[r]={}),i[e]=t}function M(n,r){return m(n,function(n){var e=n.style.display||"",t=B(n,"display");(C(t)&&(B(n,"display",e),t=e),r)?e?"none"===e&&(n.style.display=t):"none"===T(n,"display")&&(n.style.display="block"):n.style.display="none"}),n}function V(n,e,t){var r=n[e];if(r)t(r);else{for(e=d[e];(n=n[e])&&1!==n.nodeType;);n&&t(n)}}function k(n,e,t){if(e in n)for(;n=n[e];)t(n);else for(e=d[e];(n=n[e])&&1===n.nodeType;)t(n)}function z(n,e,t){return n&&v(n,e,t)}function F(n,e){var t,r=function(n,e,t){if(e){if(e.indexOf)return e.indexOf(n,t);for(var r=e.length,i=t?t<0?Math.max(0,r+t):t:0;i<r;i++)if(i in e&&e[i]===n)return i}return-1}(e,n);return 0<=r?(t=r,n.splice(t,1),e):null}var H=window.removeEventListener?function(n,e,t){n.removeEventListener(e,t,!1)}:function(n,e,t){n.detachEvent("on"+e,t)};var U=window.addEventListener?function(n,e,t){n.addEventListener(e,t,!1)}:function(n,e,t){n.attachEvent("on"+e,t)};function I(n,e,t){return C(t)?(f=e,(u=p(u=n))&&u[f]):(r=n,o=t,i=a[i=e]||i,m(r,function(n){n[i]=o}),r);var r,i,o,u,f}var W=n?function(e,n){n.forEach(function(n){e.classList.remove(n)})}:function(n,e){var t=f(n.className),r=t.slice(0);e.forEach(function(n){var e=r.indexOf(n);-1<e&&r.splice(e,1)}),(t=t.join(" "))!==(r=r.join(" "))&&(n.className=r)};return{addClass:function(n,e){var t=f(e);return m(n,function(n){g(n,t)}),n},after:function(n){for(var e=[],t=arguments.length-1;0<t--;)e[t]=arguments[t+1];return w(n,e,"after",function(n,e){var t=n.parentNode;t&&t.insertBefore(e,n.nextSibling)})},append:t,attr:function(n,e,t){return C(t)?(f=e,(u=p(u=n))&&u.getAttribute(f)):(i=e,o=t,m(r=n,function(n){n.setAttribute(i,o)}),r);var r,i,o,u,f},before:function(n){for(var e=[],t=arguments.length-1;0<t--;)e[t]=arguments[t+1];return w(n,e,"before",function(n,e){var t=n.parentNode;t&&t.insertBefore(e,n)})},children:function(n){return P(n,"",function(n,e,t){E(t)})},css:function(n,e,t){var r,i,o,u,f;return e=e.replace(S,function(n,e){return e.toUpperCase()}),C(t)?(f=e,(u=p(u=n))?T(u,f):""):(i=e,o=t,m(r=n,function(n){L(n,i,o)}),r)},data:function(n,u,f){return m(n,function(n){var e,t=B(n,"data"),r=!C(f),i=!r&&!C(u),o=i&&!(!y(e=u)&&"object"==typeof e);if(t||o||B(n,"data",t={}),r)t[u]=f;else{if(!i)return t;if(o)return t&&t[u];b(u,function(n,e){t[e]=n})}}),n},empty:function(){},hasClass:function(n,i){var o=!1;return m(n,function(n){if(e=i,t=!1,r=f(n.className),v(e,function(n){if(-1<r.indexOf(n))return!(t=!0)}),t)return!(o=!0);var e,t,r}),o},hide:function(n){return M(n)},html:function(n,e){return y(e)||m(n,1===e.nodeType?function(n){t(n,e)}:function(n){n.innerHTML=String(e)}),n},next:function(n){return P(n,"nextElementSibling",V)},nextAll:function(n){return P(n,"nextElementSibling",k)},off:function(n,e,i){return m(n,function(t){var r=B(t,"events");B(t,"handle")&&(C(e)?z(r,function(n,e){H(t,e,n),delete r[e]}):z(e.split(" "),function(n){C(i)?(H(t,n,r[n]),delete r[n]):F(r[n],i)}))}),n},on:function(n,e,f){return m(n,function(t){var r,i,n,o=B(t,"events"),u=B(t,"handle");o||B(t,"events",o={}),u||B(t,"handle",(i=o,(n=function(e){if(e.preventDefault||(e.preventDefault=function(){e.returnValue=!1}),e.stopPropagation||(e.stopPropagation=function(){e.cancelBubble=!0}),e.target||(e.target=e.srcElement||document),C(e.defaultPrevented)){var n=e.preventDefault;n=n.bind(e),e.preventDefault=function(){e.defaultPrevented=!0,n()},e.defaultPrevented=!1}e.isDefaultPrevented=function(){return e.defaultPrevented||!1===e.returnValue},z(i[e.type],function(n){return n.call(r,e)});try{delete e.preventDefault,delete e.stopPropagation,delete e.isDefaultPrevented}catch(n){e.preventDefault=null,e.stopPropagation=null,e.isDefaultPrevented=null}}).elem=r=t,u=n)),e.split(" ").forEach(function(n){var e=o[n];e||(U(t,n,u),e=o[n]=[]),e[e.length]=f})}),n},parent:function(n){return P(n,"",function(n,e,t){var r=n.parentNode;r&&t(r)})},prepend:function(n){for(var e=[],t=arguments.length-1;0<t--;)e[t]=arguments[t+1];return w(n,e,"prepend",function(n,e){1!==n.nodeType&&11!==n.nodeType&&9!==n.nodeType||n.insertBefore(e,n.firstChild)})},prev:function(n){return P(n,"previousElementSibling",V)},prevAll:function(n){return P(n,"previousElementSibling",k)},prop:I,remove:function(n){return m(n,function(n){var e=n.parentNode;e&&e.removeChild(n)}),n},removeAttr:function(n,e){var t=f(e);return m(n,function(e){t.forEach(function(n){e.removeAttribute(n)})}),n},removeClass:function(n,e){if(!arguments.length)return I(n,"className","");var t=f(e);return m(n,function(n){W(n,t)}),n},removeProp:function(n,e){return m(n,function(n){delete n[a[e]||e]}),n},show:function(n){return M(n,!0)},wrap:function(n){n.wrap=function(i){return i?(x(i,null,function(n){return i=n,!1}),m(function(n,e){var t=i;e&&(t=i.cloneNode(!0));var r=n.parentNode;r&&r.replaceChild(t,n),t.appendChild(n)})):this}}}}); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).celia=e()}(this,function(){"use strict";var f=/^\s*<(\w+|!)[^>]*>/,c=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,e=/[^\x20\t\r\n\f]+/g;function r(n){return"string"==typeof n}function u(n){return Array.isArray(n)?n:r(n)&&n.match(e)||[]}var n=!!document.body.classList,l={for:"htmlFor",class:"className"};["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"].forEach(function(n){l[n.toLowerCase()]=n});var d=document.createElement("div"),i=["Webkit","Moz","ms"],o=d.style;var a={nextElementSibling:"nextSibling",previousElementSibling:"previousSibling"};function s(n,e){return e?n.bind(e):n}function v(n,e,t){for(var r=s(e,t),i=0,o=n.length,u=void 0;!1!==u&&i<o;i++)u=r(n[i],i,n)}function p(n){return n&&(-1<n.length?n[0]:n)}function m(n,e){return n&&(-1<n.length?v(n,e):e(n)),n}function h(n,e){n[n.length]=e}var g=n?function(e,n){n.forEach(function(n){e.classList.add(n)})}:function(n,e){var t=u(n.className),r=t.slice(0);e.forEach(function(n){-1===r.indexOf(n)&&h(r,n)}),(t=t.join(" "))!==(r=r.join(" "))&&(n.className=r)};function y(n){return null==n}function b(n,e,t){var r=s(e,t);for(var i in n)if(!1===r(n[i],i,n))break}function E(n,e){var t=[],r=e||function(n){h(t,n)};return v(n.childNodes,function(n,e){var t=0;1===n.nodeType&&r(n,++t,e)}),t}function x(n,e,t){var r,i,o,u=n.match(c);if(u){var a=document.createElement(u[1]);i=function(n,e){a.setAttribute(e,n)},(r=e)&&b(r,i,o),t(a)}else f.test(n)?(d.innerHTML=n,E(d,t)):t(document.createTextNode(n))}function N(n){var t=document.createDocumentFragment();return v(n,function(n){var e;1===n.nodeType?t.appendChild(n):r(n)||(y(e=n)||"number"!=typeof e.length||"function"==typeof e)?x(n,null,function(n){t.appendChild(n)}):v(n,function(n){t.appendChild(n)})}),t}function w(n,e,t,r){if(n){document.body[t]&&(r=function(n,e){n[t](e)});var i=N(e),o=n.length;if(o){for(var u=o-1,a=0,f=u;a<f;a++)r(n[a],i.cloneNode(!0));r(n[u],i)}else r(n,i)}return n}function t(n){for(var e=[],t=arguments.length-1;0<t--;)e[t]=arguments[t+1];return w(n,e,"appendChild")}function C(n){return void 0===n}function P(n,e,t){var r=[];return m(n,function(n){t(n,e,function(n){var e,t;t=n,(e=r)&&(e[e.length]=t)})}),r}var S=/-([a-z])/g;var D={};function L(n,e,t){var r=n.style;if(e=D[e]||(D[e]=function(n){if(n in o)return n;for(var e=n[0].toUpperCase()+n.slice(1),t=i.length;t--;)if((n=i[t]+e)in o)return n}(e)||e),y(t))return r[e];r[e]=t}function T(n,e,t){var r,i,o="";return(t=t||((i=(r=n).ownerDocument.defaultView)&&i.opener||(i=window),i.getComputedStyle(r)))&&(o=t.getPropertyValue(e)||t[e]),o}var A=1,j="expando9527",O={};function B(n,e,t){var r=n[j],i=O[r||-1];if(C(t))return i&&i[e];i||(n[j]=r=++A,i=O[r]={}),i[e]=t}function M(n,r){return m(n,function(n){var e=n.style.display||"",t=B(n,"display");(C(t)&&(B(n,"display",e),t=e),r)?e?"none"===e&&(n.style.display=t):"none"===T(n,"display")&&(n.style.display="block"):n.style.display="none"}),n}function V(n,e,t){var r=n[e];if(r)t(r);else{for(e=a[e];(n=n[e])&&1!==n.nodeType;);n&&t(n)}}function k(n,e,t){if(e in n)for(;n=n[e];)t(n);else for(e=a[e];(n=n[e])&&1===n.nodeType;)t(n)}function z(n,e,t){return n&&v(n,e,t)}function F(n,e){var t,r=function(n,e,t){if(e){if(e.indexOf)return e.indexOf(n,t);for(var r=e.length,i=t?t<0?Math.max(0,r+t):t:0;i<r;i++)if(i in e&&e[i]===n)return i}return-1}(e,n);return 0<=r?(t=r,n.splice(t,1),e):null}var H=window.removeEventListener?function(n,e,t){n.removeEventListener(e,t,!1)}:function(n,e,t){n.detachEvent("on"+e,t)};var U=window.addEventListener?function(n,e,t){n.addEventListener(e,t,!1)}:function(n,e,t){n.attachEvent("on"+e,t)};function I(n,e,t){return C(t)?(a=e,(u=p(u=n))&&u[a]):(r=n,o=t,i=l[i=e]||i,m(r,function(n){n[i]=o}),r);var r,i,o,u,a}var W=n?function(e,n){n.forEach(function(n){e.classList.remove(n)})}:function(n,e){var t=u(n.className),r=t.slice(0);e.forEach(function(n){var e=r.indexOf(n);-1<e&&r.splice(e,1)}),(t=t.join(" "))!==(r=r.join(" "))&&(n.className=r)};return{addClass:function(n,e){var t=u(e);return m(n,function(n){g(n,t)}),n},after:function(n){for(var e=[],t=arguments.length-1;0<t--;)e[t]=arguments[t+1];return w(n,e,"after",function(n,e){var t=n.parentNode;t&&t.insertBefore(e,n.nextSibling)})},append:t,attr:function(n,e,t){return C(t)?(a=e,(u=p(u=n))&&u.getAttribute(a)):(i=e,o=t,m(r=n,function(n){n.setAttribute(i,o)}),r);var r,i,o,u,a},before:function(n){for(var e=[],t=arguments.length-1;0<t--;)e[t]=arguments[t+1];return w(n,e,"before",function(n,e){var t=n.parentNode;t&&t.insertBefore(e,n)})},children:function(n){return P(n,"",function(n,e,t){E(n,t)})},css:function(n,e,t){var r,i,o,u,a;return e=e.replace(S,function(n,e){return e.toUpperCase()}),C(t)?(a=e,(u=p(u=n))?T(u,a):""):(i=e,o=t,m(r=n,function(n){L(n,i,o)}),r)},data:function(e,r,t){if(y(i=r)||"object"!=typeof i){if(y(r))return(e=p(e))&&B(e,"data");if(C(t)){var n=B(e,"data");return n&&n[r]}return m(e,function(n){var e=B(n,"data");e||B(n,"data",e={}),e[r]=t}),e}return m(e,function(n){var t=B(n,"data");t||B(e,"data",t={}),b(r,function(n,e){t[e]=n})}),e;var i},empty:function(){},hasClass:function(n,i){var o=!1;return m(n,function(n){if(e=i,t=!1,r=u(n.className),v(e,function(n){if(-1<r.indexOf(n))return!(t=!0)}),t)return!(o=!0);var e,t,r}),o},hide:function(n){return M(n)},html:function(n,e){return y(e)||m(n,1===e.nodeType?function(n){t(n,e)}:function(n){n.innerHTML=String(e)}),n},next:function(n){return P(n,"nextElementSibling",V)},nextAll:function(n){return P(n,"nextElementSibling",k)},off:function(n,e,i){return m(n,function(t){var r=B(t,"events");B(t,"handle")&&(C(e)?z(r,function(n,e){H(t,e,n),delete r[e]}):z(e.split(" "),function(n){C(i)?(H(t,n,r[n]),delete r[n]):F(r[n],i)}))}),n},on:function(n,e,a){return m(n,function(t){var r,i,n,o=B(t,"events"),u=B(t,"handle");o||B(t,"events",o={}),u||B(t,"handle",(i=o,(n=function(e){if(e.preventDefault||(e.preventDefault=function(){e.returnValue=!1}),e.stopPropagation||(e.stopPropagation=function(){e.cancelBubble=!0}),e.target||(e.target=e.srcElement||document),C(e.defaultPrevented)){var n=e.preventDefault;n=n.bind(e),e.preventDefault=function(){e.defaultPrevented=!0,n()},e.defaultPrevented=!1}e.isDefaultPrevented=function(){return e.defaultPrevented||!1===e.returnValue},z(i[e.type],function(n){return n.call(r,e)});try{delete e.preventDefault,delete e.stopPropagation,delete e.isDefaultPrevented}catch(n){e.preventDefault=null,e.stopPropagation=null,e.isDefaultPrevented=null}}).elem=r=t,u=n)),e.split(" ").forEach(function(n){var e=o[n];e||(U(t,n,u),e=o[n]=[]),e[e.length]=a})}),n},parent:function(n){return P(n,"",function(n,e,t){var r=n.parentNode;r&&t(r)})},prepend:function(n){for(var e=[],t=arguments.length-1;0<t--;)e[t]=arguments[t+1];return w(n,e,"prepend",function(n,e){1!==n.nodeType&&11!==n.nodeType&&9!==n.nodeType||n.insertBefore(e,n.firstChild)})},prev:function(n){return P(n,"previousElementSibling",V)},prevAll:function(n){return P(n,"previousElementSibling",k)},prop:I,remove:function(n){return m(n,function(n){var e=n.parentNode;e&&e.removeChild(n)}),n},removeAttr:function(n,e){var t=u(e);return m(n,function(e){t.forEach(function(n){e.removeAttribute(n)})}),n},removeClass:function(n,e){if(!arguments.length)return I(n,"className","");var t=u(e);return m(n,function(n){W(n,t)}),n},removeData:function(){},removeProp:function(n,e){return m(n,function(n){delete n[l[e]||e]}),n},show:function(n){return M(n,!0)},wrap:function(n){n.wrap=function(i){return i?(x(i,null,function(n){return i=n,!1}),m(function(n,e){var t=i;e&&(t=i.cloneNode(!0));var r=n.parentNode;r&&r.replaceChild(t,n),t.appendChild(n)})):this}}}}); |
@@ -5,3 +5,3 @@ import getStyles from './_getStyles'; | ||
computed = computed || getStyles(elem); | ||
let ret; | ||
let ret = ''; | ||
if (computed) { | ||
@@ -8,0 +8,0 @@ ret = computed.getPropertyValue(name) || computed[name]; |
@@ -25,2 +25,3 @@ import addClass from './dom/addClass.js'; | ||
import removeClass from './dom/removeClass.js'; | ||
import removeData from './dom/removeData.js'; | ||
import removeProp from './dom/removeProp.js'; | ||
@@ -54,2 +55,3 @@ import show from './dom/show.js'; | ||
removeClass, | ||
removeData, | ||
removeProp, | ||
@@ -56,0 +58,0 @@ show, |
@@ -6,4 +6,4 @@ import dir from '../_internal/_dom/_dir'; | ||
return dir(dom, '', (elem, method, cb) => { | ||
childNodes(cb); | ||
childNodes(elem, cb); | ||
}); | ||
} |
import isUndefined from '../isUndefined'; | ||
import isNil from '../isNil'; | ||
import isObject from '../isObject'; | ||
import forIn from '../forIn'; | ||
import forIn from '../_internal/_forIn'; | ||
import checkDom, { firstNode } from '../_internal/_dom/_checkDom'; | ||
import expandoStore from '../_internal/_dom/_expandoStore'; | ||
import checkDom from '../_internal/_dom/_checkDom'; | ||
@@ -11,32 +12,32 @@ /** | ||
* @param {String} key | ||
* @param {*} val | ||
* @param {*} value | ||
*/ | ||
export default function (dom, key, value) { | ||
checkDom(dom, (element) => { | ||
let data = expandoStore(element, 'data'); | ||
const isSetter = !isUndefined(value); | ||
const keyDefined = !isSetter && !isUndefined(key); | ||
const isSimpleGetter = keyDefined && !isObject(key); | ||
if (!data && !isSimpleGetter) { | ||
expandoStore(element, 'data', data = {}); | ||
} | ||
if (isSetter) { | ||
if (isObject(key)) { // setter | ||
checkDom(dom, (element) => { | ||
let data = expandoStore(element, 'data'); | ||
if (!data) { | ||
expandoStore(dom, 'data', data = {}); | ||
} | ||
forIn(key, (n, k) => { | ||
data[k] = n; | ||
}); | ||
}); | ||
return dom; | ||
} else if (isNil(key)) { // get all | ||
dom = firstNode(dom); | ||
return dom && expandoStore(dom, 'data'); | ||
} else if (isUndefined(value)) { // getter | ||
let data = expandoStore(dom, 'data'); | ||
return data && data[key]; | ||
} else { | ||
checkDom(dom, (element) => { | ||
let data = expandoStore(element, 'data'); | ||
if (!data) { | ||
expandoStore(element, 'data', data = {}); | ||
} | ||
data[key] = value; | ||
} else { | ||
if (keyDefined) { | ||
if (isSimpleGetter) { | ||
return data && data[key]; | ||
} else { | ||
forIn(key, (n, k) => { | ||
data[k] = n; | ||
}); | ||
} | ||
} else { | ||
return data; | ||
} | ||
} | ||
}); | ||
return dom; | ||
}); | ||
return dom; | ||
} | ||
} |
{ | ||
"name": "celia", | ||
"version": "3.0.0-beta.3", | ||
"version": "3.0.0-beta.4", | ||
"description": "A modern JavaScript utility library delivering modularity, performance, & extras.", | ||
@@ -5,0 +5,0 @@ "main": "./celia.common.js", |
@@ -131,2 +131,3 @@ # celia | ||
- dom/removeClass | ||
- dom/removeData | ||
- dom/removeProp | ||
@@ -133,0 +134,0 @@ - dom/show |
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
250683
127
7317
138