Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pluginjs/dom

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pluginjs/dom - npm Package Compare versions

Comparing version 0.7.13 to 0.7.14

8

dist/dom.common.js
/*!
* @pluginjs/dom v0.7.13 (https://pluginjs.com)
* @pluginjs/dom v0.7.14 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited

@@ -306,3 +306,3 @@ * Released under the GPL-3.0 License.

const attr = utils.curryWith((args, value, el) => {
if ((is.isElement(value) || is.isDomNode(value)) && typeof el === 'undefined') {
if (is.isElement(value) && typeof el === 'undefined') {
el = value;

@@ -329,5 +329,3 @@ value = undefined;

return el;
}, el => {
return is.isElement(el) || is.isDomNode(el);
});
}, is.isElement);
const removeAttr = utils.curry((attrs, el) => {

@@ -334,0 +332,0 @@ attrs.split(' ').forEach(attr => {

/*!
* @pluginjs/dom v0.7.13 (https://pluginjs.com)
* @pluginjs/dom v0.7.14 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var utils=require("@pluginjs/utils"),is=require("@pluginjs/is");function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArrayLimit(e,t){var r=[],i=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(e){n=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw s}}return r}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}const parseHTML=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=Array.isArray(t[0])?t[0].reduce((e,r,i)=>e+t[i]+r):t[0],n=document.createElement("div");if(n.innerHTML=i,1===n.children.length)return n.children[0];const s=document.createDocumentFragment();if(n.children.length)for(;n.children.length>0;)s.appendChild(n.children[0]);else for(;n.childNodes.length>0;)s.appendChild(n.childNodes[0]);return s},query=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector(e)},queryAll=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(t.querySelectorAll(e))},find=utils.curry((e,t)=>t.querySelector(e)),findAll=utils.curry((e,t)=>Array.from(t.querySelectorAll(e))),has=(e,t)=>is.isString(e)?Boolean(queryAll(e,t).length):t.contains(e),contents=e=>"IFRAME"===e.tagName?[e.contentDocument]:e.childNodes,children=(e,t)=>(is.isString(e)||void 0!==t||(t=e,e=void 0),is.isElement(t)?is.isString(e)?Array.from(t.children).filter(t=>t.matches(e)):Array.from(t.children):[]),siblings=(e,t)=>(is.isString(e)||void 0!==t||(t=e,e=void 0),is.isElement(t)?children(e,t.parentNode).filter(e=>e!==t):[]),prev=e=>e.previousElementSibling,next=e=>e.nextElementSibling,prevWith=utils.curry((e,t)=>{const r=t.previousElementSibling;return r?e(r)?r:prevWith(e,r):null}),nextWith=utils.curry((e,t)=>{const r=t.nextElementSibling;return r?e(r)?r:nextWith(e,r):null}),parent=e=>e.parentNode,parents=(e,t)=>{is.isString(e)||void 0!==t||(t=e,e=void 0);const r=[];let i=t;for(;is.isElement(i)&&i.parentNode&&i!==document.body.parentNode;)i=i.parentNode,(!e||e&&i.matches(e))&&r.push(i);return r},parentWith=utils.curry((e,t)=>{const r=t.parentNode;return!(!r||r===document)&&(e(r)?r:parentWith(e,r))}),closest=(e,t)=>t.matches(e)?t:parentWith(t=>t.matches(e),t),offsetParent=e=>{let t=e.offsetParent;for(;t&&"static"===t.style.position;)t=t.offsetParent;return t||document.documentElement},scrollParent=e=>parentWith(e=>e.scrollHeight>e.clientHeight,e),indexOf=e=>[...e.parentElement.children].indexOf(e),dataStore="__pluginjsData",getCachedData=e=>e[dataStore]=e[dataStore]||{},getData=(e,t)=>{is.isElement(e)&&void 0===t&&(t=e,e=void 0);const r=getCachedData(t);if(e){if(!(e in r)){let i=t.dataset[e]||t.dataset[utils.camelize(e,!1)];if(void 0!==i){try{i=JSON.parse(i)}catch(e){}r[e]=i}}return r[e]}return r},setData=(e,t,r)=>(getCachedData(r)[e]=t,r),removeData=(e,t)=>(is.isElement(e)&&void 0===t&&(t=e,e=void 0),void 0===e?delete t[dataStore]:delete getCachedData(t)[e],t),hasData=e=>dataStore in e&&!is.isEmptyObject(e[dataStore]),data=utils.curryWith((e,t,r)=>{if(is.isElement(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return getData(e,r);setData(e,t,r)}else Object.entries(e).forEach(e=>{let t=_slicedToArray(e,2),i=t[0],n=t[1];return setData(i,n,r)});return r},is.isElement),attr=utils.curryWith((e,t,r)=>{if((is.isElement(t)||is.isDomNode(t))&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return r.getAttribute(e);r.setAttribute(e,t)}else Object.entries(e).forEach(e=>{let t=_slicedToArray(e,2),i=t[0],n=t[1];return r.setAttribute(i,n)});return r},e=>is.isElement(e)||is.isDomNode(e)),removeAttr=utils.curry((e,t)=>(e.split(" ").forEach(e=>{t.removeAttribute(e)}),t)),propMap={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop=utils.curryWith((e,t,r)=>{if(is.isElement(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return r[propMap[e]||e];r[propMap[e]||e]=t}else Object.entries(e).forEach(e=>{let t=_slicedToArray(e,2),i=t[0],n=t[1];r[propMap[i]||i]=n});return r},is.isElement),removeProp=utils.curry((e,t)=>(e.split(" ").forEach(e=>{delete t[e=propMap[e]||e]}),t)),clone=utils.curry(e=>e.cloneNode(!0)),detach=utils.curry(e=>(e.parentNode&&e.parentNode.removeChild(e),e)),remove=utils.curry(e=>e.remove()),empty=utils.curry(e=>{for(;e.lastChild;)e.removeChild(e.lastChild);return e}),html=utils.curryWith((e,t)=>(is.isString(e)||void 0!==t||(t=e,e=void 0),void 0===e?t.innerHTML:(t.innerHTML=e,t)),is.isElement),text=utils.curryWith((e,t)=>(is.isString(e)||void 0!==t||(t=e,e=void 0),void 0===e?t.textContent:(t.textContent=e,t)),is.isElement),append=utils.curry((e,t)=>(is.isString(e)?t.insertAdjacentHTML("beforeend",e):t.append(e),t)),appendTo=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),t.append(e),e)),prepend=utils.curry((e,t)=>(is.isString(e)?t.insertAdjacentHTML("afterbegin",e):t.prepend(e),t)),prependTo=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),t.prepend(e),e)),before=utils.curry((e,t)=>(is.isString(e)?t.insertAdjacentHTML("beforebegin",e):t.parentNode.insertBefore(e,t),t)),insertBefore=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(e=>{t.parentNode.insertBefore(e,t)}):t.parentNode.insertBefore(e,t),e)),after=utils.curry((e,t)=>(is.isString(e)?t.insertAdjacentHTML("afterend",e):t.parentNode.insertBefore(e,t.nextElementSibling),t)),insertAfter=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(e=>{t.parentNode.insertBefore(e,t.nextElementSibling)}):t.parentNode.insertBefore(e,t.nextElementSibling),e)),wrap=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),insertBefore(e,t),append(t,e),e)),wrapInner=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),e.innerHTML=t.innerHTML,t.innerHTML="",t.append(e),t)),wrapAll=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),insertBefore(e,t[0]),e.append(...t),e)),unwrap=utils.curryWith((e,t)=>{is.isString(e)||void 0!==t||(t=e,e=void 0);const r=t.parentNode;return e&&!r.matches(e)||(children(r).forEach(e=>{insertBefore(e,r)}),r.remove()),t},is.isElement),replace=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),t.parentNode.replaceChild(e,t),t.remove(),e));exports.after=after,exports.append=append,exports.appendTo=appendTo,exports.attr=attr,exports.before=before,exports.children=children,exports.clone=clone,exports.closest=closest,exports.contents=contents,exports.data=data,exports.detach=detach,exports.empty=empty,exports.find=find,exports.findAll=findAll,exports.getData=getData,exports.has=has,exports.hasData=hasData,exports.html=html,exports.indexOf=indexOf,exports.insertAfter=insertAfter,exports.insertBefore=insertBefore,exports.next=next,exports.nextWith=nextWith,exports.offsetParent=offsetParent,exports.parent=parent,exports.parentWith=parentWith,exports.parents=parents,exports.parseHTML=parseHTML,exports.prepend=prepend,exports.prependTo=prependTo,exports.prev=prev,exports.prevWith=prevWith,exports.prop=prop,exports.query=query,exports.queryAll=queryAll,exports.remove=remove,exports.removeAttr=removeAttr,exports.removeData=removeData,exports.removeProp=removeProp,exports.replace=replace,exports.scrollParent=scrollParent,exports.setData=setData,exports.siblings=siblings,exports.text=text,exports.unwrap=unwrap,exports.wrap=wrap,exports.wrapAll=wrapAll,exports.wrapInner=wrapInner;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var utils=require("@pluginjs/utils"),is=require("@pluginjs/is");function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArrayLimit(e,t){var r=[],i=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(e){n=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw s}}return r}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}const parseHTML=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=Array.isArray(t[0])?t[0].reduce((e,r,i)=>e+t[i]+r):t[0],n=document.createElement("div");if(n.innerHTML=i,1===n.children.length)return n.children[0];const s=document.createDocumentFragment();if(n.children.length)for(;n.children.length>0;)s.appendChild(n.children[0]);else for(;n.childNodes.length>0;)s.appendChild(n.childNodes[0]);return s},query=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector(e)},queryAll=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(t.querySelectorAll(e))},find=utils.curry((e,t)=>t.querySelector(e)),findAll=utils.curry((e,t)=>Array.from(t.querySelectorAll(e))),has=(e,t)=>is.isString(e)?Boolean(queryAll(e,t).length):t.contains(e),contents=e=>"IFRAME"===e.tagName?[e.contentDocument]:e.childNodes,children=(e,t)=>(is.isString(e)||void 0!==t||(t=e,e=void 0),is.isElement(t)?is.isString(e)?Array.from(t.children).filter(t=>t.matches(e)):Array.from(t.children):[]),siblings=(e,t)=>(is.isString(e)||void 0!==t||(t=e,e=void 0),is.isElement(t)?children(e,t.parentNode).filter(e=>e!==t):[]),prev=e=>e.previousElementSibling,next=e=>e.nextElementSibling,prevWith=utils.curry((e,t)=>{const r=t.previousElementSibling;return r?e(r)?r:prevWith(e,r):null}),nextWith=utils.curry((e,t)=>{const r=t.nextElementSibling;return r?e(r)?r:nextWith(e,r):null}),parent=e=>e.parentNode,parents=(e,t)=>{is.isString(e)||void 0!==t||(t=e,e=void 0);const r=[];let i=t;for(;is.isElement(i)&&i.parentNode&&i!==document.body.parentNode;)i=i.parentNode,(!e||e&&i.matches(e))&&r.push(i);return r},parentWith=utils.curry((e,t)=>{const r=t.parentNode;return!(!r||r===document)&&(e(r)?r:parentWith(e,r))}),closest=(e,t)=>t.matches(e)?t:parentWith(t=>t.matches(e),t),offsetParent=e=>{let t=e.offsetParent;for(;t&&"static"===t.style.position;)t=t.offsetParent;return t||document.documentElement},scrollParent=e=>parentWith(e=>e.scrollHeight>e.clientHeight,e),indexOf=e=>[...e.parentElement.children].indexOf(e),dataStore="__pluginjsData",getCachedData=e=>e[dataStore]=e[dataStore]||{},getData=(e,t)=>{is.isElement(e)&&void 0===t&&(t=e,e=void 0);const r=getCachedData(t);if(e){if(!(e in r)){let i=t.dataset[e]||t.dataset[utils.camelize(e,!1)];if(void 0!==i){try{i=JSON.parse(i)}catch(e){}r[e]=i}}return r[e]}return r},setData=(e,t,r)=>(getCachedData(r)[e]=t,r),removeData=(e,t)=>(is.isElement(e)&&void 0===t&&(t=e,e=void 0),void 0===e?delete t[dataStore]:delete getCachedData(t)[e],t),hasData=e=>dataStore in e&&!is.isEmptyObject(e[dataStore]),data=utils.curryWith((e,t,r)=>{if(is.isElement(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return getData(e,r);setData(e,t,r)}else Object.entries(e).forEach(e=>{let t=_slicedToArray(e,2),i=t[0],n=t[1];return setData(i,n,r)});return r},is.isElement),attr=utils.curryWith((e,t,r)=>{if(is.isElement(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return r.getAttribute(e);r.setAttribute(e,t)}else Object.entries(e).forEach(e=>{let t=_slicedToArray(e,2),i=t[0],n=t[1];return r.setAttribute(i,n)});return r},is.isElement),removeAttr=utils.curry((e,t)=>(e.split(" ").forEach(e=>{t.removeAttribute(e)}),t)),propMap={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop=utils.curryWith((e,t,r)=>{if(is.isElement(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return r[propMap[e]||e];r[propMap[e]||e]=t}else Object.entries(e).forEach(e=>{let t=_slicedToArray(e,2),i=t[0],n=t[1];r[propMap[i]||i]=n});return r},is.isElement),removeProp=utils.curry((e,t)=>(e.split(" ").forEach(e=>{delete t[e=propMap[e]||e]}),t)),clone=utils.curry(e=>e.cloneNode(!0)),detach=utils.curry(e=>(e.parentNode&&e.parentNode.removeChild(e),e)),remove=utils.curry(e=>e.remove()),empty=utils.curry(e=>{for(;e.lastChild;)e.removeChild(e.lastChild);return e}),html=utils.curryWith((e,t)=>(is.isString(e)||void 0!==t||(t=e,e=void 0),void 0===e?t.innerHTML:(t.innerHTML=e,t)),is.isElement),text=utils.curryWith((e,t)=>(is.isString(e)||void 0!==t||(t=e,e=void 0),void 0===e?t.textContent:(t.textContent=e,t)),is.isElement),append=utils.curry((e,t)=>(is.isString(e)?t.insertAdjacentHTML("beforeend",e):t.append(e),t)),appendTo=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),t.append(e),e)),prepend=utils.curry((e,t)=>(is.isString(e)?t.insertAdjacentHTML("afterbegin",e):t.prepend(e),t)),prependTo=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),t.prepend(e),e)),before=utils.curry((e,t)=>(is.isString(e)?t.insertAdjacentHTML("beforebegin",e):t.parentNode.insertBefore(e,t),t)),insertBefore=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(e=>{t.parentNode.insertBefore(e,t)}):t.parentNode.insertBefore(e,t),e)),after=utils.curry((e,t)=>(is.isString(e)?t.insertAdjacentHTML("afterend",e):t.parentNode.insertBefore(e,t.nextElementSibling),t)),insertAfter=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(e=>{t.parentNode.insertBefore(e,t.nextElementSibling)}):t.parentNode.insertBefore(e,t.nextElementSibling),e)),wrap=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),insertBefore(e,t),append(t,e),e)),wrapInner=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),e.innerHTML=t.innerHTML,t.innerHTML="",t.append(e),t)),wrapAll=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),insertBefore(e,t[0]),e.append(...t),e)),unwrap=utils.curryWith((e,t)=>{is.isString(e)||void 0!==t||(t=e,e=void 0);const r=t.parentNode;return e&&!r.matches(e)||(children(r).forEach(e=>{insertBefore(e,r)}),r.remove()),t},is.isElement),replace=utils.curry((e,t)=>(is.isString(e)&&(e=parseHTML(e)),t.parentNode.replaceChild(e,t),t.remove(),e));exports.after=after,exports.append=append,exports.appendTo=appendTo,exports.attr=attr,exports.before=before,exports.children=children,exports.clone=clone,exports.closest=closest,exports.contents=contents,exports.data=data,exports.detach=detach,exports.empty=empty,exports.find=find,exports.findAll=findAll,exports.getData=getData,exports.has=has,exports.hasData=hasData,exports.html=html,exports.indexOf=indexOf,exports.insertAfter=insertAfter,exports.insertBefore=insertBefore,exports.next=next,exports.nextWith=nextWith,exports.offsetParent=offsetParent,exports.parent=parent,exports.parentWith=parentWith,exports.parents=parents,exports.parseHTML=parseHTML,exports.prepend=prepend,exports.prependTo=prependTo,exports.prev=prev,exports.prevWith=prevWith,exports.prop=prop,exports.query=query,exports.queryAll=queryAll,exports.remove=remove,exports.removeAttr=removeAttr,exports.removeData=removeData,exports.removeProp=removeProp,exports.replace=replace,exports.scrollParent=scrollParent,exports.setData=setData,exports.siblings=siblings,exports.text=text,exports.unwrap=unwrap,exports.wrap=wrap,exports.wrapAll=wrapAll,exports.wrapInner=wrapInner;
/*!
* @pluginjs/dom v0.7.13 (https://pluginjs.com)
* @pluginjs/dom v0.7.14 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited

@@ -7,3 +7,3 @@ * Released under the GPL-3.0 License.

import { curry, camelize, curryWith } from '@pluginjs/utils';
import { isString, isElement, isEmptyObject, isDomNode } from '@pluginjs/is';
import { isString, isElement, isEmptyObject } from '@pluginjs/is';

@@ -303,3 +303,3 @@ function _slicedToArray(arr, i) {

const attr = curryWith((args, value, el) => {
if ((isElement(value) || isDomNode(value)) && typeof el === 'undefined') {
if (isElement(value) && typeof el === 'undefined') {
el = value;

@@ -326,5 +326,3 @@ value = undefined;

return el;
}, el => {
return isElement(el) || isDomNode(el);
});
}, isElement);
const removeAttr = curry((attrs, el) => {

@@ -331,0 +329,0 @@ attrs.split(' ').forEach(attr => {

/*!
* @pluginjs/dom v0.7.13 (https://pluginjs.com)
* @pluginjs/dom v0.7.14 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
import{curry as e,camelize as t,curryWith as r}from"@pluginjs/utils";import{isString as n,isElement as o,isEmptyObject as i,isDomNode as d}from"@pluginjs/is";function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var d,l=e[Symbol.iterator]();!(n=(d=l.next()).done)&&(r.push(d.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}const a=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=Array.isArray(t[0])?t[0].reduce((e,r,n)=>e+t[n]+r):t[0],o=document.createElement("div");if(o.innerHTML=n,1===o.children.length)return o.children[0];const i=document.createDocumentFragment();if(o.children.length)for(;o.children.length>0;)i.appendChild(o.children[0]);else for(;o.childNodes.length>0;)i.appendChild(o.childNodes[0]);return i},c=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector(e)},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(t.querySelectorAll(e))},f=e((e,t)=>t.querySelector(e)),p=e((e,t)=>Array.from(t.querySelectorAll(e))),u=(e,t)=>n(e)?Boolean(s(e,t).length):t.contains(e),h=e=>"IFRAME"===e.tagName?[e.contentDocument]:e.childNodes,m=(e,t)=>(n(e)||void 0!==t||(t=e,e=void 0),o(t)?n(e)?Array.from(t.children).filter(t=>t.matches(e)):Array.from(t.children):[]),v=(e,t)=>(n(e)||void 0!==t||(t=e,e=void 0),o(t)?m(e,t.parentNode).filter(e=>e!==t):[]),g=e=>e.previousElementSibling,y=e=>e.nextElementSibling,b=e((e,t)=>{const r=t.previousElementSibling;return r?e(r)?r:b(e,r):null}),N=e((e,t)=>{const r=t.nextElementSibling;return r?e(r)?r:N(e,r):null}),E=e=>e.parentNode,A=(e,t)=>{n(e)||void 0!==t||(t=e,e=void 0);const r=[];let i=t;for(;o(i)&&i.parentNode&&i!==document.body.parentNode;)i=i.parentNode,(!e||e&&i.matches(e))&&r.push(i);return r},S=e((e,t)=>{const r=t.parentNode;return!(!r||r===document)&&(e(r)?r:S(e,r))}),x=(e,t)=>t.matches(e)?t:S(t=>t.matches(e),t),L=e=>{let t=e.offsetParent;for(;t&&"static"===t.style.position;)t=t.offsetParent;return t||document.documentElement},H=e=>S(e=>e.scrollHeight>e.clientHeight,e),M=e=>[...e.parentElement.children].indexOf(e),T="__pluginjsData",j=e=>e[T]=e[T]||{},C=(e,r)=>{o(e)&&void 0===r&&(r=e,e=void 0);const n=j(r);if(e){if(!(e in n)){let o=r.dataset[e]||r.dataset[t(e,!1)];if(void 0!==o){try{o=JSON.parse(o)}catch(e){}n[e]=o}}return n[e]}return n},B=(e,t,r)=>(j(r)[e]=t,r),O=(e,t)=>(o(e)&&void 0===t&&(t=e,e=void 0),void 0===e?delete t[T]:delete j(t)[e],t),w=e=>T in e&&!i(e[T]),P=r((e,t,r)=>{if(o(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return C(e,r);B(e,t,r)}else Object.entries(e).forEach(e=>{let t=l(e,2),n=t[0],o=t[1];return B(n,o,r)});return r},o),q=r((e,t,r)=>{if((o(t)||d(t))&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return r.getAttribute(e);r.setAttribute(e,t)}else Object.entries(e).forEach(e=>{let t=l(e,2),n=t[0],o=t[1];return r.setAttribute(n,o)});return r},e=>o(e)||d(e)),D=e((e,t)=>(e.split(" ").forEach(e=>{t.removeAttribute(e)}),t)),F={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},I=r((e,t,r)=>{if(o(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return r[F[e]||e];r[F[e]||e]=t}else Object.entries(e).forEach(e=>{let t=l(e,2),n=t[0],o=t[1];r[F[n]||n]=o});return r},o),_=e((e,t)=>(e.split(" ").forEach(e=>{delete t[e=F[e]||e]}),t)),J=e(e=>e.cloneNode(!0)),R=e(e=>(e.parentNode&&e.parentNode.removeChild(e),e)),k=e(e=>e.remove()),z=e(e=>{for(;e.lastChild;)e.removeChild(e.lastChild);return e}),G=r((e,t)=>(n(e)||void 0!==t||(t=e,e=void 0),void 0===e?t.innerHTML:(t.innerHTML=e,t)),o),K=r((e,t)=>(n(e)||void 0!==t||(t=e,e=void 0),void 0===e?t.textContent:(t.textContent=e,t)),o),Q=e((e,t)=>(n(e)?t.insertAdjacentHTML("beforeend",e):t.append(e),t)),U=e((e,t)=>(n(e)&&(e=a(e)),t.append(e),e)),V=e((e,t)=>(n(e)?t.insertAdjacentHTML("afterbegin",e):t.prepend(e),t)),W=e((e,t)=>(n(e)&&(e=a(e)),t.prepend(e),e)),X=e((e,t)=>(n(e)?t.insertAdjacentHTML("beforebegin",e):t.parentNode.insertBefore(e,t),t)),Y=e((e,t)=>(n(e)&&(e=a(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(e=>{t.parentNode.insertBefore(e,t)}):t.parentNode.insertBefore(e,t),e)),Z=e((e,t)=>(n(e)?t.insertAdjacentHTML("afterend",e):t.parentNode.insertBefore(e,t.nextElementSibling),t)),$=e((e,t)=>(n(e)&&(e=a(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(e=>{t.parentNode.insertBefore(e,t.nextElementSibling)}):t.parentNode.insertBefore(e,t.nextElementSibling),e)),ee=e((e,t)=>(n(e)&&(e=a(e)),Y(e,t),Q(t,e),e)),te=e((e,t)=>(n(e)&&(e=a(e)),e.innerHTML=t.innerHTML,t.innerHTML="",t.append(e),t)),re=e((e,t)=>(n(e)&&(e=a(e)),Y(e,t[0]),e.append(...t),e)),ne=r((e,t)=>{n(e)||void 0!==t||(t=e,e=void 0);const r=t.parentNode;return e&&!r.matches(e)||(m(r).forEach(e=>{Y(e,r)}),r.remove()),t},o),oe=e((e,t)=>(n(e)&&(e=a(e)),t.parentNode.replaceChild(e,t),t.remove(),e));export{Z as after,Q as append,U as appendTo,q as attr,X as before,m as children,J as clone,x as closest,h as contents,P as data,R as detach,z as empty,f as find,p as findAll,C as getData,u as has,w as hasData,G as html,M as indexOf,$ as insertAfter,Y as insertBefore,y as next,N as nextWith,L as offsetParent,E as parent,S as parentWith,A as parents,a as parseHTML,V as prepend,W as prependTo,g as prev,b as prevWith,I as prop,c as query,s as queryAll,k as remove,D as removeAttr,O as removeData,_ as removeProp,oe as replace,H as scrollParent,B as setData,v as siblings,K as text,ne as unwrap,ee as wrap,re as wrapAll,te as wrapInner};
import{curry as e,camelize as t,curryWith as r}from"@pluginjs/utils";import{isString as n,isElement as o,isEmptyObject as i}from"@pluginjs/is";function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var d,l=e[Symbol.iterator]();!(n=(d=l.next()).done)&&(r.push(d.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}const l=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=Array.isArray(t[0])?t[0].reduce((e,r,n)=>e+t[n]+r):t[0],o=document.createElement("div");if(o.innerHTML=n,1===o.children.length)return o.children[0];const i=document.createDocumentFragment();if(o.children.length)for(;o.children.length>0;)i.appendChild(o.children[0]);else for(;o.childNodes.length>0;)i.appendChild(o.childNodes[0]);return i},a=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector(e)},c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(t.querySelectorAll(e))},s=e((e,t)=>t.querySelector(e)),f=e((e,t)=>Array.from(t.querySelectorAll(e))),p=(e,t)=>n(e)?Boolean(c(e,t).length):t.contains(e),u=e=>"IFRAME"===e.tagName?[e.contentDocument]:e.childNodes,h=(e,t)=>(n(e)||void 0!==t||(t=e,e=void 0),o(t)?n(e)?Array.from(t.children).filter(t=>t.matches(e)):Array.from(t.children):[]),m=(e,t)=>(n(e)||void 0!==t||(t=e,e=void 0),o(t)?h(e,t.parentNode).filter(e=>e!==t):[]),v=e=>e.previousElementSibling,g=e=>e.nextElementSibling,y=e((e,t)=>{const r=t.previousElementSibling;return r?e(r)?r:y(e,r):null}),b=e((e,t)=>{const r=t.nextElementSibling;return r?e(r)?r:b(e,r):null}),N=e=>e.parentNode,E=(e,t)=>{n(e)||void 0!==t||(t=e,e=void 0);const r=[];let i=t;for(;o(i)&&i.parentNode&&i!==document.body.parentNode;)i=i.parentNode,(!e||e&&i.matches(e))&&r.push(i);return r},A=e((e,t)=>{const r=t.parentNode;return!(!r||r===document)&&(e(r)?r:A(e,r))}),S=(e,t)=>t.matches(e)?t:A(t=>t.matches(e),t),x=e=>{let t=e.offsetParent;for(;t&&"static"===t.style.position;)t=t.offsetParent;return t||document.documentElement},L=e=>A(e=>e.scrollHeight>e.clientHeight,e),H=e=>[...e.parentElement.children].indexOf(e),M="__pluginjsData",T=e=>e[M]=e[M]||{},j=(e,r)=>{o(e)&&void 0===r&&(r=e,e=void 0);const n=T(r);if(e){if(!(e in n)){let o=r.dataset[e]||r.dataset[t(e,!1)];if(void 0!==o){try{o=JSON.parse(o)}catch(e){}n[e]=o}}return n[e]}return n},C=(e,t,r)=>(T(r)[e]=t,r),B=(e,t)=>(o(e)&&void 0===t&&(t=e,e=void 0),void 0===e?delete t[M]:delete T(t)[e],t),O=e=>M in e&&!i(e[M]),w=r((e,t,r)=>{if(o(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return j(e,r);C(e,t,r)}else Object.entries(e).forEach(e=>{let t=d(e,2),n=t[0],o=t[1];return C(n,o,r)});return r},o),P=r((e,t,r)=>{if(o(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return r.getAttribute(e);r.setAttribute(e,t)}else Object.entries(e).forEach(e=>{let t=d(e,2),n=t[0],o=t[1];return r.setAttribute(n,o)});return r},o),q=e((e,t)=>(e.split(" ").forEach(e=>{t.removeAttribute(e)}),t)),D={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},F=r((e,t,r)=>{if(o(t)&&void 0===r&&(r=t,t=void 0),"string"==typeof e){if(void 0===t)return r[D[e]||e];r[D[e]||e]=t}else Object.entries(e).forEach(e=>{let t=d(e,2),n=t[0],o=t[1];r[D[n]||n]=o});return r},o),I=e((e,t)=>(e.split(" ").forEach(e=>{delete t[e=D[e]||e]}),t)),_=e(e=>e.cloneNode(!0)),J=e(e=>(e.parentNode&&e.parentNode.removeChild(e),e)),R=e(e=>e.remove()),k=e(e=>{for(;e.lastChild;)e.removeChild(e.lastChild);return e}),z=r((e,t)=>(n(e)||void 0!==t||(t=e,e=void 0),void 0===e?t.innerHTML:(t.innerHTML=e,t)),o),G=r((e,t)=>(n(e)||void 0!==t||(t=e,e=void 0),void 0===e?t.textContent:(t.textContent=e,t)),o),K=e((e,t)=>(n(e)?t.insertAdjacentHTML("beforeend",e):t.append(e),t)),Q=e((e,t)=>(n(e)&&(e=l(e)),t.append(e),e)),U=e((e,t)=>(n(e)?t.insertAdjacentHTML("afterbegin",e):t.prepend(e),t)),V=e((e,t)=>(n(e)&&(e=l(e)),t.prepend(e),e)),W=e((e,t)=>(n(e)?t.insertAdjacentHTML("beforebegin",e):t.parentNode.insertBefore(e,t),t)),X=e((e,t)=>(n(e)&&(e=l(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(e=>{t.parentNode.insertBefore(e,t)}):t.parentNode.insertBefore(e,t),e)),Y=e((e,t)=>(n(e)?t.insertAdjacentHTML("afterend",e):t.parentNode.insertBefore(e,t.nextElementSibling),t)),Z=e((e,t)=>(n(e)&&(e=l(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(e=>{t.parentNode.insertBefore(e,t.nextElementSibling)}):t.parentNode.insertBefore(e,t.nextElementSibling),e)),$=e((e,t)=>(n(e)&&(e=l(e)),X(e,t),K(t,e),e)),ee=e((e,t)=>(n(e)&&(e=l(e)),e.innerHTML=t.innerHTML,t.innerHTML="",t.append(e),t)),te=e((e,t)=>(n(e)&&(e=l(e)),X(e,t[0]),e.append(...t),e)),re=r((e,t)=>{n(e)||void 0!==t||(t=e,e=void 0);const r=t.parentNode;return e&&!r.matches(e)||(h(r).forEach(e=>{X(e,r)}),r.remove()),t},o),ne=e((e,t)=>(n(e)&&(e=l(e)),t.parentNode.replaceChild(e,t),t.remove(),e));export{Y as after,K as append,Q as appendTo,P as attr,W as before,h as children,_ as clone,S as closest,u as contents,w as data,J as detach,k as empty,s as find,f as findAll,j as getData,p as has,O as hasData,z as html,H as indexOf,Z as insertAfter,X as insertBefore,g as next,b as nextWith,x as offsetParent,N as parent,A as parentWith,E as parents,l as parseHTML,U as prepend,V as prependTo,v as prev,y as prevWith,F as prop,a as query,c as queryAll,R as remove,q as removeAttr,B as removeData,I as removeProp,ne as replace,L as scrollParent,C as setData,m as siblings,G as text,re as unwrap,$ as wrap,te as wrapAll,ee as wrapInner};
/*!
* @pluginjs/dom v0.7.13 (https://pluginjs.com)
* @pluginjs/dom v0.7.14 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited

@@ -345,3 +345,3 @@ * Released under the GPL-3.0 License.

var attr = utils.curryWith(function (args, value, el) {
if ((is.isElement(value) || is.isDomNode(value)) && typeof el === 'undefined') {
if (is.isElement(value) && typeof el === 'undefined') {
el = value;

@@ -368,5 +368,3 @@ value = undefined;

return el;
}, function (el) {
return is.isElement(el) || is.isDomNode(el);
});
}, is.isElement);
var removeAttr = utils.curry(function (attrs, el) {

@@ -373,0 +371,0 @@ attrs.split(' ').forEach(function (attr) {

/*!
* @pluginjs/dom v0.7.13 (https://pluginjs.com)
* @pluginjs/dom v0.7.14 (https://pluginjs.com)
* Copyright 2019 Creation Studio Limited
* Released under the GPL-3.0 License.
*/
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@pluginjs/utils"),require("@pluginjs/is")):"function"==typeof define&&define.amd?define(["exports","@pluginjs/utils","@pluginjs/is"],n):n((e=e||self)["@pluginjs/dom"]={},e["@pluginjs/utils"],e["@pluginjs/is"])}(this,function(e,n,r){"use strict";function t(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var r=[],t=!0,i=!1,o=void 0;try{for(var u,c=e[Symbol.iterator]();!(t=(u=c.next()).done)&&(r.push(u.value),!n||r.length!==n);t=!0);}catch(e){i=!0,o=e}finally{try{t||null==c.return||c.return()}finally{if(i)throw o}}return r}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e){return function(e){if(Array.isArray(e)){for(var n=0,r=new Array(e.length);n<e.length;n++)r[n]=e[n];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var o=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var t=Array.isArray(n[0])?n[0].reduce(function(e,r,t){return e+n[t]+r}):n[0],i=document.createElement("div");if(i.innerHTML=t,1===i.children.length)return i.children[0];var o=document.createDocumentFragment();if(i.children.length)for(;i.children.length>0;)o.appendChild(i.children[0]);else for(;i.childNodes.length>0;)o.appendChild(i.childNodes[0]);return o},u=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(n.querySelectorAll(e))},c=n.curry(function(e,n){return n.querySelector(e)}),a=n.curry(function(e,n){return Array.from(n.querySelectorAll(e))}),l=function(e,n){return r.isString(e)||void 0!==n||(n=e,e=void 0),r.isElement(n)?r.isString(e)?Array.from(n.children).filter(function(n){return n.matches(e)}):Array.from(n.children):[]},f=n.curry(function(e,n){var r=n.previousElementSibling;return r?e(r)?r:f(e,r):null}),d=n.curry(function(e,n){var r=n.nextElementSibling;return r?e(r)?r:d(e,r):null}),s=n.curry(function(e,n){var r=n.parentNode;return!(!r||r===document)&&(e(r)?r:s(e,r))}),p="__pluginjsData",m=function(e){return e[p]=e[p]||{}},y=function(e,t){r.isElement(e)&&void 0===t&&(t=e,e=void 0);var i=m(t);if(e){if(!(e in i)){var o=t.dataset[e]||t.dataset[n.camelize(e,!1)];if(void 0!==o){try{o=JSON.parse(o)}catch(e){}i[e]=o}}return i[e]}return i},v=function(e,n,r){return m(r)[e]=n,r},h=n.curryWith(function(e,n,i){if(r.isElement(n)&&void 0===i&&(i=n,n=void 0),"string"==typeof e){if(void 0===n)return y(e,i);v(e,n,i)}else Object.entries(e).forEach(function(e){var n=t(e,2),r=n[0],o=n[1];return v(r,o,i)});return i},r.isElement),g=n.curryWith(function(e,n,i){if((r.isElement(n)||r.isDomNode(n))&&void 0===i&&(i=n,n=void 0),"string"==typeof e){if(void 0===n)return i.getAttribute(e);i.setAttribute(e,n)}else Object.entries(e).forEach(function(e){var n=t(e,2),r=n[0],o=n[1];return i.setAttribute(r,o)});return i},function(e){return r.isElement(e)||r.isDomNode(e)}),S=n.curry(function(e,n){return e.split(" ").forEach(function(e){n.removeAttribute(e)}),n}),E={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},b=n.curryWith(function(e,n,i){if(r.isElement(n)&&void 0===i&&(i=n,n=void 0),"string"==typeof e){if(void 0===n)return i[E[e]||e];i[E[e]||e]=n}else Object.entries(e).forEach(function(e){var n=t(e,2),r=n[0],o=n[1];i[E[r]||r]=o});return i},r.isElement),A=n.curry(function(e,n){return e.split(" ").forEach(function(e){delete n[e=E[e]||e]}),n}),N=n.curry(function(e){return e.cloneNode(!0)}),j=n.curry(function(e){return e.parentNode&&e.parentNode.removeChild(e),e}),x=n.curry(function(e){return e.remove()}),T=n.curry(function(e){for(;e.lastChild;)e.removeChild(e.lastChild);return e}),L=n.curryWith(function(e,n){return r.isString(e)||void 0!==n||(n=e,e=void 0),void 0===e?n.innerHTML:(n.innerHTML=e,n)},r.isElement),M=n.curryWith(function(e,n){return r.isString(e)||void 0!==n||(n=e,e=void 0),void 0===e?n.textContent:(n.textContent=e,n)},r.isElement),w=n.curry(function(e,n){return r.isString(e)?n.insertAdjacentHTML("beforeend",e):n.append(e),n}),H=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),n.append(e),e}),O=n.curry(function(e,n){return r.isString(e)?n.insertAdjacentHTML("afterbegin",e):n.prepend(e),n}),B=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),n.prepend(e),e}),C=n.curry(function(e,n){return r.isString(e)?n.insertAdjacentHTML("beforebegin",e):n.parentNode.insertBefore(e,n),n}),D=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(function(e){n.parentNode.insertBefore(e,n)}):n.parentNode.insertBefore(e,n),e}),P=n.curry(function(e,n){return r.isString(e)?n.insertAdjacentHTML("afterend",e):n.parentNode.insertBefore(e,n.nextElementSibling),n}),W=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(function(e){n.parentNode.insertBefore(e,n.nextElementSibling)}):n.parentNode.insertBefore(e,n.nextElementSibling),e}),q=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),D(e,n),w(n,e),e}),I=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),e.innerHTML=n.innerHTML,n.innerHTML="",n.append(e),n}),_=n.curry(function(e,n){var t;return r.isString(e)&&(e=o(e)),D(e,n[0]),(t=e).append.apply(t,i(n)),e}),F=n.curryWith(function(e,n){r.isString(e)||void 0!==n||(n=e,e=void 0);var t=n.parentNode;return e&&!t.matches(e)||(l(t).forEach(function(e){D(e,t)}),t.remove()),n},r.isElement),z=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),n.parentNode.replaceChild(e,n),n.remove(),e});e.after=P,e.append=w,e.appendTo=H,e.attr=g,e.before=C,e.children=l,e.clone=N,e.closest=function(e,n){return n.matches(e)?n:s(function(n){return n.matches(e)},n)},e.contents=function(e){return"IFRAME"===e.tagName?[e.contentDocument]:e.childNodes},e.data=h,e.detach=j,e.empty=T,e.find=c,e.findAll=a,e.getData=y,e.has=function(e,n){return r.isString(e)?Boolean(u(e,n).length):n.contains(e)},e.hasData=function(e){return p in e&&!r.isEmptyObject(e[p])},e.html=L,e.indexOf=function(e){return i(e.parentElement.children).indexOf(e)},e.insertAfter=W,e.insertBefore=D,e.next=function(e){return e.nextElementSibling},e.nextWith=d,e.offsetParent=function(e){for(var n=e.offsetParent;n&&"static"===n.style.position;)n=n.offsetParent;return n||document.documentElement},e.parent=function(e){return e.parentNode},e.parentWith=s,e.parents=function(e,n){r.isString(e)||void 0!==n||(n=e,e=void 0);for(var t=[],i=n;r.isElement(i)&&i.parentNode&&i!==document.body.parentNode;)i=i.parentNode,(!e||e&&i.matches(e))&&t.push(i);return t},e.parseHTML=o,e.prepend=O,e.prependTo=B,e.prev=function(e){return e.previousElementSibling},e.prevWith=f,e.prop=b,e.query=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector(e)},e.queryAll=u,e.remove=x,e.removeAttr=S,e.removeData=function(e,n){return r.isElement(e)&&void 0===n&&(n=e,e=void 0),void 0===e?delete n[p]:delete m(n)[e],n},e.removeProp=A,e.replace=z,e.scrollParent=function(e){return s(function(e){return e.scrollHeight>e.clientHeight},e)},e.setData=v,e.siblings=function(e,n){return r.isString(e)||void 0!==n||(n=e,e=void 0),r.isElement(n)?l(e,n.parentNode).filter(function(e){return e!==n}):[]},e.text=M,e.unwrap=F,e.wrap=q,e.wrapAll=_,e.wrapInner=I,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@pluginjs/utils"),require("@pluginjs/is")):"function"==typeof define&&define.amd?define(["exports","@pluginjs/utils","@pluginjs/is"],n):n((e=e||self)["@pluginjs/dom"]={},e["@pluginjs/utils"],e["@pluginjs/is"])}(this,function(e,n,r){"use strict";function t(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var r=[],t=!0,i=!1,o=void 0;try{for(var u,c=e[Symbol.iterator]();!(t=(u=c.next()).done)&&(r.push(u.value),!n||r.length!==n);t=!0);}catch(e){i=!0,o=e}finally{try{t||null==c.return||c.return()}finally{if(i)throw o}}return r}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e){return function(e){if(Array.isArray(e)){for(var n=0,r=new Array(e.length);n<e.length;n++)r[n]=e[n];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var o=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var t=Array.isArray(n[0])?n[0].reduce(function(e,r,t){return e+n[t]+r}):n[0],i=document.createElement("div");if(i.innerHTML=t,1===i.children.length)return i.children[0];var o=document.createDocumentFragment();if(i.children.length)for(;i.children.length>0;)o.appendChild(i.children[0]);else for(;i.childNodes.length>0;)o.appendChild(i.childNodes[0]);return o},u=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(n.querySelectorAll(e))},c=n.curry(function(e,n){return n.querySelector(e)}),a=n.curry(function(e,n){return Array.from(n.querySelectorAll(e))}),l=function(e,n){return r.isString(e)||void 0!==n||(n=e,e=void 0),r.isElement(n)?r.isString(e)?Array.from(n.children).filter(function(n){return n.matches(e)}):Array.from(n.children):[]},f=n.curry(function(e,n){var r=n.previousElementSibling;return r?e(r)?r:f(e,r):null}),d=n.curry(function(e,n){var r=n.nextElementSibling;return r?e(r)?r:d(e,r):null}),s=n.curry(function(e,n){var r=n.parentNode;return!(!r||r===document)&&(e(r)?r:s(e,r))}),p="__pluginjsData",y=function(e){return e[p]=e[p]||{}},m=function(e,t){r.isElement(e)&&void 0===t&&(t=e,e=void 0);var i=y(t);if(e){if(!(e in i)){var o=t.dataset[e]||t.dataset[n.camelize(e,!1)];if(void 0!==o){try{o=JSON.parse(o)}catch(e){}i[e]=o}}return i[e]}return i},v=function(e,n,r){return y(r)[e]=n,r},h=n.curryWith(function(e,n,i){if(r.isElement(n)&&void 0===i&&(i=n,n=void 0),"string"==typeof e){if(void 0===n)return m(e,i);v(e,n,i)}else Object.entries(e).forEach(function(e){var n=t(e,2),r=n[0],o=n[1];return v(r,o,i)});return i},r.isElement),g=n.curryWith(function(e,n,i){if(r.isElement(n)&&void 0===i&&(i=n,n=void 0),"string"==typeof e){if(void 0===n)return i.getAttribute(e);i.setAttribute(e,n)}else Object.entries(e).forEach(function(e){var n=t(e,2),r=n[0],o=n[1];return i.setAttribute(r,o)});return i},r.isElement),S=n.curry(function(e,n){return e.split(" ").forEach(function(e){n.removeAttribute(e)}),n}),E={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},b=n.curryWith(function(e,n,i){if(r.isElement(n)&&void 0===i&&(i=n,n=void 0),"string"==typeof e){if(void 0===n)return i[E[e]||e];i[E[e]||e]=n}else Object.entries(e).forEach(function(e){var n=t(e,2),r=n[0],o=n[1];i[E[r]||r]=o});return i},r.isElement),A=n.curry(function(e,n){return e.split(" ").forEach(function(e){delete n[e=E[e]||e]}),n}),N=n.curry(function(e){return e.cloneNode(!0)}),j=n.curry(function(e){return e.parentNode&&e.parentNode.removeChild(e),e}),x=n.curry(function(e){return e.remove()}),T=n.curry(function(e){for(;e.lastChild;)e.removeChild(e.lastChild);return e}),L=n.curryWith(function(e,n){return r.isString(e)||void 0!==n||(n=e,e=void 0),void 0===e?n.innerHTML:(n.innerHTML=e,n)},r.isElement),M=n.curryWith(function(e,n){return r.isString(e)||void 0!==n||(n=e,e=void 0),void 0===e?n.textContent:(n.textContent=e,n)},r.isElement),w=n.curry(function(e,n){return r.isString(e)?n.insertAdjacentHTML("beforeend",e):n.append(e),n}),H=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),n.append(e),e}),O=n.curry(function(e,n){return r.isString(e)?n.insertAdjacentHTML("afterbegin",e):n.prepend(e),n}),B=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),n.prepend(e),e}),C=n.curry(function(e,n){return r.isString(e)?n.insertAdjacentHTML("beforebegin",e):n.parentNode.insertBefore(e,n),n}),P=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(function(e){n.parentNode.insertBefore(e,n)}):n.parentNode.insertBefore(e,n),e}),W=n.curry(function(e,n){return r.isString(e)?n.insertAdjacentHTML("afterend",e):n.parentNode.insertBefore(e,n.nextElementSibling),n}),q=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),NodeList.prototype.isPrototypeOf(e)?e.forEach(function(e){n.parentNode.insertBefore(e,n.nextElementSibling)}):n.parentNode.insertBefore(e,n.nextElementSibling),e}),D=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),P(e,n),w(n,e),e}),I=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),e.innerHTML=n.innerHTML,n.innerHTML="",n.append(e),n}),_=n.curry(function(e,n){var t;return r.isString(e)&&(e=o(e)),P(e,n[0]),(t=e).append.apply(t,i(n)),e}),F=n.curryWith(function(e,n){r.isString(e)||void 0!==n||(n=e,e=void 0);var t=n.parentNode;return e&&!t.matches(e)||(l(t).forEach(function(e){P(e,t)}),t.remove()),n},r.isElement),z=n.curry(function(e,n){return r.isString(e)&&(e=o(e)),n.parentNode.replaceChild(e,n),n.remove(),e});e.after=W,e.append=w,e.appendTo=H,e.attr=g,e.before=C,e.children=l,e.clone=N,e.closest=function(e,n){return n.matches(e)?n:s(function(n){return n.matches(e)},n)},e.contents=function(e){return"IFRAME"===e.tagName?[e.contentDocument]:e.childNodes},e.data=h,e.detach=j,e.empty=T,e.find=c,e.findAll=a,e.getData=m,e.has=function(e,n){return r.isString(e)?Boolean(u(e,n).length):n.contains(e)},e.hasData=function(e){return p in e&&!r.isEmptyObject(e[p])},e.html=L,e.indexOf=function(e){return i(e.parentElement.children).indexOf(e)},e.insertAfter=q,e.insertBefore=P,e.next=function(e){return e.nextElementSibling},e.nextWith=d,e.offsetParent=function(e){for(var n=e.offsetParent;n&&"static"===n.style.position;)n=n.offsetParent;return n||document.documentElement},e.parent=function(e){return e.parentNode},e.parentWith=s,e.parents=function(e,n){r.isString(e)||void 0!==n||(n=e,e=void 0);for(var t=[],i=n;r.isElement(i)&&i.parentNode&&i!==document.body.parentNode;)i=i.parentNode,(!e||e&&i.matches(e))&&t.push(i);return t},e.parseHTML=o,e.prepend=O,e.prependTo=B,e.prev=function(e){return e.previousElementSibling},e.prevWith=f,e.prop=b,e.query=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector(e)},e.queryAll=u,e.remove=x,e.removeAttr=S,e.removeData=function(e,n){return r.isElement(e)&&void 0===n&&(n=e,e=void 0),void 0===e?delete n[p]:delete y(n)[e],n},e.removeProp=A,e.replace=z,e.scrollParent=function(e){return s(function(e){return e.scrollHeight>e.clientHeight},e)},e.setData=v,e.siblings=function(e,n){return r.isString(e)||void 0!==n||(n=e,e=void 0),r.isElement(n)?l(e,n.parentNode).filter(function(e){return e!==n}):[]},e.text=M,e.unwrap=F,e.wrap=D,e.wrapAll=_,e.wrapInner=I,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -14,3 +14,3 @@ {

},
"version": "0.7.13",
"version": "0.7.14",
"category": "utils",

@@ -37,4 +37,4 @@ "main": "dist/dom.common.js",

"dependencies": {
"@pluginjs/is": "^0.7.11",
"@pluginjs/utils": "^0.7.12"
"@pluginjs/is": "^0.7.12",
"@pluginjs/utils": "^0.7.13"
},

@@ -70,3 +70,3 @@ "devDependencies": {

],
"gitHead": "d03cf888e27f08bdd7474fa0d74d6d330ce35beb"
"gitHead": "dd7e1408426c72aa61b9bcd2968c389a8be92fec"
}
import { curry, curryWith, camelize } from '@pluginjs/utils'
import { isString, isElement, isDomNode, isEmptyObject } from '@pluginjs/is'
import { isString, isElement, isEmptyObject } from '@pluginjs/is'

@@ -265,28 +265,21 @@ export const parseHTML = (...args) => {

// -----------
export const attr = curryWith(
(args, value, el) => {
if ((isElement(value) || isDomNode(value)) && typeof el === 'undefined') {
el = value
value = undefined
}
export const attr = curryWith((args, value, el) => {
if (isElement(value) && typeof el === 'undefined') {
el = value
value = undefined
}
if (typeof args === 'string') {
if (typeof value !== 'undefined') {
el.setAttribute(args, value)
} else {
return el.getAttribute(args)
}
if (typeof args === 'string') {
if (typeof value !== 'undefined') {
el.setAttribute(args, value)
} else {
Object.entries(args).forEach(([key, value]) =>
el.setAttribute(key, value)
)
return el.getAttribute(args)
}
return el
},
el => {
return isElement(el) || isDomNode(el)
} else {
Object.entries(args).forEach(([key, value]) => el.setAttribute(key, value))
}
)
return el
}, isElement)
export const removeAttr = curry((attrs, el) => {

@@ -293,0 +286,0 @@ attrs.split(' ').forEach(attr => {

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