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.0.13 to 0.0.14

10

dist/dom.esm.js

@@ -21,3 +21,8 @@ import { curry, compose } from '@pluginjs/utils';

const children = el => Array.from(el.children);
const children = el => {
if (!el) {
return null;
}
return Array.from(el.children);
};

@@ -260,3 +265,4 @@ const childrenSelect = (selector, el) => Array.from(el.children).filter(c => c.nodeName.toLowerCase() === selector);

const parentElement = parent(el);
if (parentElement === document) {
// console.log(el, parentElement)
if (!parentElement || parentElement === document) {
return false;

@@ -263,0 +269,0 @@ }

6

dist/dom.js

@@ -87,2 +87,5 @@ (function (global, factory) {

var children = function children(el) {
if (!el) {
return null;
}
return Array.from(el.children);

@@ -389,3 +392,4 @@ };

var parentElement = parent(el);
if (parentElement === document) {
// console.log(el, parentElement)
if (!parentElement || parentElement === document) {
return false;

@@ -392,0 +396,0 @@ }

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

!function(r,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(r["@pluginjs/dom"]={},r["@pluginjs/utils"],r["@pluginjs/is"])}(this,function(r,n,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e=function(){return function(r,n){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return function(r,n){var t=[],e=!0,u=!1,i=void 0;try{for(var o,a=r[Symbol.iterator]();!(e=(o=a.next()).done)&&(t.push(o.value),!n||t.length!==n);e=!0);}catch(r){u=!0,i=r}finally{try{!e&&a.return&&a.return()}finally{if(u)throw i}}return t}(r,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=n.curry(function(r,n){return n.querySelector(r)}),i=n.curry(function(r,n){return Array.from(n.querySelectorAll(r))}),o=function(r){return r.remove()},a=n.curry(function(r,n){return n.innerHTML=r,n}),c=function(r){return Array.from(r.children)},f=function(r,n,u){var i={data:function(r){var u=n.split("="),i=e(u,2),o=i[0],a=i[1];if(!t.null(r.dataset[o])&&!t.undefined(r.dataset[o]))return!a||r.dataset[o]===a},tagName:function(r){return r.nodeName.toLowerCase()===n},class:function(r){return r.classList.contains(n)},id:function(r){return r.id===n},attr:function(r){var u=n.split("="),i=e(u,2),o=i[0],a=i[1];if(!t.null(r.getAttribute(o))&&!t.undefined(r.getAttribute(o)))return!a||r.getAttribute(o)===a}};return i[r]&&i[r](u)},l=function(r){return r.parentNode},s=function(){for(var r=arguments.length,t=Array(r),e=0;e<r;e++)t[e]=arguments[e];var u=Array.isArray(t[0])?t[0].reduce(function(r,n,e){return r+t[e]+n}):t[0],i=n.compose(c,a(u))(document.createElement("div"));return 1===i.length?i[0]:i},d=function(r){return r.nextElementSibling},y=n.curry(function(r,n){return"string"==typeof r?n.getAttribute(r):(Object.entries(r).forEach(function(r){var t=e(r,2),u=t[0],i=t[1];return n.setAttribute(u,i)}),n)}),p=n.curry(function(r,n){return n.removeAttribute(r)}),m=n.curry(function(r,n){return"string"==typeof r?n.dataset[r]:(Object.entries(r).forEach(function(r){var t=e(r,2),u=t[0],i=t[1];n.dataset[u]=i}),n)}),v=n.curry(function(r,n){return n.textContent=r,n}),g=n.curry(function(r,n){return t.string(r)?n.insertAdjacentHTML("beforeend",r):n.append(r),n}),A=n.curry(function(r,n){return t.string(r)?n.insertAdjacentHTML("afterbegin",r):n.prepend(r),n}),b=n.curry(function(r,n){return t.string(r)?n.insertAdjacentHTML("beforebegin",r):n.insertAdjacentElement("beforebegin",r),n}),h=n.curry(function(r,n){return t.string(r)?n.insertAdjacentHTML("afterend",r):n.insertAdjacentElement("afterend",r),n}),j=n.curry(function(r,n){return t.string(r)&&(r=s(r)),b(r,n),o(n),g(n,r),r}),w=n.curry(function(r,n){var t=l(n);return t!==document&&(r(t)?t:w(r,t))}),L=n.curry(function(r,n){return n.contains(r)}),E=n.curry(function(r,n){return n.matches(r)?n:w(function(n){return n.matches(r)},n)}),M=n.curry(function(r,n){var t=d(n);return r(t)?t:M(r,t)}),O=n.curry(function(r,n,t){var e=n.duration,u=n.callback,i="in"===r,o=i?0:1,a=null;i&&("none"===t.style.display&&(t.style.display="inline"),t.style.opacity=o),window.requestAnimationFrame(function r(n){a||(a=n);var c=n-a,f=c/e;o=i?o+f:o-f,t.style.opacity=o,o<=0&&(t.style.display="none"),c<e?window.requestAnimationFrame(r):u&&u()})}),T=O("out"),q=O("in");r.query=function(r){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector(r)},r.queryAll=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(n.querySelectorAll(r))},r.find=u,r.finds=i,r.remove=o,r.html=a,r.children=c,r.childrenSelect=function(r,n){return Array.from(n.children).filter(function(n){return n.nodeName.toLowerCase()===r})},r.getSiblings=function(r){var n=c(r.parentNode),t=n.indexOf(r);return t>-1&&n.splice(t,1),n},r.attrVerify=f,r.childQuery=function(r,n){var t=r.type,e=r.value,u=r.level,i=[],o=function(r){return 0!==Array.from(r.children).lenght};return function r(n,u){o(n)&&Array.from(n.children).map(function(n){f(t,e,n)&&i.push(n),o(n)&&u>0&&r(n,u-1)})}(n,void 0===u?3:u),i},r.Each=function(r,n){var u=0,i=void 0;if(t.array(r))for(i=r.length;u<i;u++)n(r[u],u);else Object.entries(r).map(function(r){var t=e(r,2),u=t[0],i=t[1];return n(u,i)});return r},r.parentQuery=function(r,n){var t=r.type,e=r.value,u=r.level,i=void 0===u?3:u,o=[];return function r(n){f(t,e,n.parentNode)&&o.push(n.parentNode),--i>=0&&r(n.parentNode)}(n),o},r.parent=l,r.parseHTML=s,r.setObjData=function(r,n,t){return t.objData||(t.objData={}),t.objData[r]=n,t},r.getObjData=function(r,n){return!!n.objData&&n.objData[r]},r.clone=function(r){return r.cloneNode(!0)},r.empty=function(r){return r.innerHTML="",r},r.prev=function(r){return r.previousElementSibling},r.next=d,r.attr=y,r.removeAttribute=p,r.dataset=m,r.text=v,r.append=g,r.prepend=A,r.insertBefore=b,r.insertAfter=h,r.wrap=j,r.wrapInner=function(r,n){return t.string(r)&&(r=s(r)),r.innerHTML=n.innerHTML,n.innerHTML="",n.append(r),n},r.wrapAll=function(r,n){return b(r,n[0]),r.append.apply(r,function(r){if(Array.isArray(r)){for(var n=0,t=Array(r.length);n<r.length;n++)t[n]=r[n];return t}return Array.from(r)}(n)),r},r.unwrap=function(r){var n=l(r);return c(n).forEach(function(r){b(r,n)}),n.remove(),r},r.clearChild=function(r){return c(r).map(o),r},r.parentWith=w,r.clearData=function(r){return Object.keys(r).map(function(n){return r.removeAttribute("data-"+n)}),r},r.contains=L,r.closest=E,r.nextElementWith=M,r.fade=O,r.fadeOut=T,r.fadeIn=q,Object.defineProperty(r,"__esModule",{value:!0})});
!function(r,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(r["@pluginjs/dom"]={},r["@pluginjs/utils"],r["@pluginjs/is"])}(this,function(r,n,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e=function(){return function(r,n){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return function(r,n){var t=[],e=!0,u=!1,i=void 0;try{for(var o,a=r[Symbol.iterator]();!(e=(o=a.next()).done)&&(t.push(o.value),!n||t.length!==n);e=!0);}catch(r){u=!0,i=r}finally{try{!e&&a.return&&a.return()}finally{if(u)throw i}}return t}(r,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=n.curry(function(r,n){return n.querySelector(r)}),i=n.curry(function(r,n){return Array.from(n.querySelectorAll(r))}),o=function(r){return r.remove()},a=n.curry(function(r,n){return n.innerHTML=r,n}),c=function(r){return r?Array.from(r.children):null},f=function(r,n,u){var i={data:function(r){var u=n.split("="),i=e(u,2),o=i[0],a=i[1];if(!t.null(r.dataset[o])&&!t.undefined(r.dataset[o]))return!a||r.dataset[o]===a},tagName:function(r){return r.nodeName.toLowerCase()===n},class:function(r){return r.classList.contains(n)},id:function(r){return r.id===n},attr:function(r){var u=n.split("="),i=e(u,2),o=i[0],a=i[1];if(!t.null(r.getAttribute(o))&&!t.undefined(r.getAttribute(o)))return!a||r.getAttribute(o)===a}};return i[r]&&i[r](u)},l=function(r){return r.parentNode},s=function(){for(var r=arguments.length,t=Array(r),e=0;e<r;e++)t[e]=arguments[e];var u=Array.isArray(t[0])?t[0].reduce(function(r,n,e){return r+t[e]+n}):t[0],i=n.compose(c,a(u))(document.createElement("div"));return 1===i.length?i[0]:i},d=function(r){return r.nextElementSibling},y=n.curry(function(r,n){return"string"==typeof r?n.getAttribute(r):(Object.entries(r).forEach(function(r){var t=e(r,2),u=t[0],i=t[1];return n.setAttribute(u,i)}),n)}),p=n.curry(function(r,n){return n.removeAttribute(r)}),m=n.curry(function(r,n){return"string"==typeof r?n.dataset[r]:(Object.entries(r).forEach(function(r){var t=e(r,2),u=t[0],i=t[1];n.dataset[u]=i}),n)}),v=n.curry(function(r,n){return n.textContent=r,n}),g=n.curry(function(r,n){return t.string(r)?n.insertAdjacentHTML("beforeend",r):n.append(r),n}),A=n.curry(function(r,n){return t.string(r)?n.insertAdjacentHTML("afterbegin",r):n.prepend(r),n}),b=n.curry(function(r,n){return t.string(r)?n.insertAdjacentHTML("beforebegin",r):n.insertAdjacentElement("beforebegin",r),n}),h=n.curry(function(r,n){return t.string(r)?n.insertAdjacentHTML("afterend",r):n.insertAdjacentElement("afterend",r),n}),j=n.curry(function(r,n){return t.string(r)&&(r=s(r)),b(r,n),o(n),g(n,r),r}),w=n.curry(function(r,n){var t=l(n);return!(!t||t===document)&&(r(t)?t:w(r,t))}),L=n.curry(function(r,n){return n.contains(r)}),E=n.curry(function(r,n){return n.matches(r)?n:w(function(n){return n.matches(r)},n)}),M=n.curry(function(r,n){var t=d(n);return r(t)?t:M(r,t)}),O=n.curry(function(r,n,t){var e=n.duration,u=n.callback,i="in"===r,o=i?0:1,a=null;i&&("none"===t.style.display&&(t.style.display="inline"),t.style.opacity=o),window.requestAnimationFrame(function r(n){a||(a=n);var c=n-a,f=c/e;o=i?o+f:o-f,t.style.opacity=o,o<=0&&(t.style.display="none"),c<e?window.requestAnimationFrame(r):u&&u()})}),T=O("out"),q=O("in");r.query=function(r){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector(r)},r.queryAll=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(n.querySelectorAll(r))},r.find=u,r.finds=i,r.remove=o,r.html=a,r.children=c,r.childrenSelect=function(r,n){return Array.from(n.children).filter(function(n){return n.nodeName.toLowerCase()===r})},r.getSiblings=function(r){var n=c(r.parentNode),t=n.indexOf(r);return t>-1&&n.splice(t,1),n},r.attrVerify=f,r.childQuery=function(r,n){var t=r.type,e=r.value,u=r.level,i=[],o=function(r){return 0!==Array.from(r.children).lenght};return function r(n,u){o(n)&&Array.from(n.children).map(function(n){f(t,e,n)&&i.push(n),o(n)&&u>0&&r(n,u-1)})}(n,void 0===u?3:u),i},r.Each=function(r,n){var u=0,i=void 0;if(t.array(r))for(i=r.length;u<i;u++)n(r[u],u);else Object.entries(r).map(function(r){var t=e(r,2),u=t[0],i=t[1];return n(u,i)});return r},r.parentQuery=function(r,n){var t=r.type,e=r.value,u=r.level,i=void 0===u?3:u,o=[];return function r(n){f(t,e,n.parentNode)&&o.push(n.parentNode),--i>=0&&r(n.parentNode)}(n),o},r.parent=l,r.parseHTML=s,r.setObjData=function(r,n,t){return t.objData||(t.objData={}),t.objData[r]=n,t},r.getObjData=function(r,n){return!!n.objData&&n.objData[r]},r.clone=function(r){return r.cloneNode(!0)},r.empty=function(r){return r.innerHTML="",r},r.prev=function(r){return r.previousElementSibling},r.next=d,r.attr=y,r.removeAttribute=p,r.dataset=m,r.text=v,r.append=g,r.prepend=A,r.insertBefore=b,r.insertAfter=h,r.wrap=j,r.wrapInner=function(r,n){return t.string(r)&&(r=s(r)),r.innerHTML=n.innerHTML,n.innerHTML="",n.append(r),n},r.wrapAll=function(r,n){return b(r,n[0]),r.append.apply(r,function(r){if(Array.isArray(r)){for(var n=0,t=Array(r.length);n<r.length;n++)t[n]=r[n];return t}return Array.from(r)}(n)),r},r.unwrap=function(r){var n=l(r);return c(n).forEach(function(r){b(r,n)}),n.remove(),r},r.clearChild=function(r){return c(r).map(o),r},r.parentWith=w,r.clearData=function(r){return Object.keys(r).map(function(n){return r.removeAttribute("data-"+n)}),r},r.contains=L,r.closest=E,r.nextElementWith=M,r.fade=O,r.fadeOut=T,r.fadeIn=q,Object.defineProperty(r,"__esModule",{value:!0})});

@@ -270,2 +270,5 @@ (function (global, factory) {

var children = function children(el) {
if (!el) {
return null;
}
return Array.from(el.children);

@@ -572,3 +575,4 @@ };

var parentElement = parent(el);
if (parentElement === document) {
// console.log(el, parentElement)
if (!parentElement || parentElement === document) {
return false;

@@ -575,0 +579,0 @@ }

@@ -10,3 +10,3 @@ {

},
"version": "0.0.13",
"version": "0.0.14",
"description": "A flexible modern dom js plugin.",

@@ -13,0 +13,0 @@ "author": "Creation Studio Limited",

@@ -25,3 +25,8 @@ import { curry, compose } from '@pluginjs/utils'

export const children = el => Array.from(el.children)
export const children = el => {
if (!el) {
return null
}
return Array.from(el.children)
}

@@ -275,3 +280,4 @@ export const childrenSelect = (selector, el) =>

const parentElement = parent(el)
if (parentElement === document) {
// console.log(el, parentElement)
if (!parentElement || parentElement === document) {
return false

@@ -278,0 +284,0 @@ }

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