@livechat/dom-utils
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -27,3 +27,5 @@ 'use strict'; | ||
var isIE = !!document.documentElement.currentStyle; | ||
var isIE = function isIE() { | ||
return !!document.documentElement.currentStyle; | ||
}; | ||
@@ -35,3 +37,3 @@ var getComputedStyle = function getComputedStyle(props, element) { | ||
if (isIE && borderBox && dataUtils.hasOwn('width', picked) && picked.width !== null) { | ||
if (isIE() && borderBox && dataUtils.hasOwn('width', picked) && picked.width !== null) { | ||
var widths = [picked.width, styles.paddingLeft, styles.paddingRight, styles.borderLeftWidth, styles.borderRightWidth]; | ||
@@ -41,3 +43,3 @@ picked.width = dataUtils.sum(widths.map(parseFloat)) + 'px'; | ||
if (isIE && borderBox && dataUtils.hasOwn('height', picked) && picked.height !== null) { | ||
if (isIE() && borderBox && dataUtils.hasOwn('height', picked) && picked.height !== null) { | ||
var heights = [picked.height, styles.paddingTop, styles.paddingBottom, styles.borderTopWidth, styles.borderBottomWidth]; | ||
@@ -44,0 +46,0 @@ picked.height = dataUtils.sum(heights.map(parseFloat)) + 'px'; |
@@ -24,3 +24,5 @@ import { forOwn, pick, hasOwn, sum, findIndex } from '@livechat/data-utils'; | ||
var isIE = !!document.documentElement.currentStyle; | ||
var isIE = function isIE() { | ||
return !!document.documentElement.currentStyle; | ||
}; | ||
@@ -32,3 +34,3 @@ var getComputedStyle = function getComputedStyle(props, element) { | ||
if (isIE && borderBox && hasOwn('width', picked) && picked.width !== null) { | ||
if (isIE() && borderBox && hasOwn('width', picked) && picked.width !== null) { | ||
var widths = [picked.width, styles.paddingLeft, styles.paddingRight, styles.borderLeftWidth, styles.borderRightWidth]; | ||
@@ -38,3 +40,3 @@ picked.width = sum(widths.map(parseFloat)) + 'px'; | ||
if (isIE && borderBox && hasOwn('height', picked) && picked.height !== null) { | ||
if (isIE() && borderBox && hasOwn('height', picked) && picked.height !== null) { | ||
var heights = [picked.height, styles.paddingTop, styles.paddingBottom, styles.borderTopWidth, styles.borderBottomWidth]; | ||
@@ -41,0 +43,0 @@ picked.height = sum(heights.map(parseFloat)) + 'px'; |
@@ -64,3 +64,5 @@ (function (global, factory) { | ||
var isIE = !!document.documentElement.currentStyle; | ||
var isIE = function isIE() { | ||
return !!document.documentElement.currentStyle; | ||
}; | ||
@@ -72,3 +74,3 @@ var getComputedStyle$1 = function getComputedStyle(props, element) { | ||
if (isIE && borderBox && hasOwn('width', picked) && picked.width !== null) { | ||
if (isIE() && borderBox && hasOwn('width', picked) && picked.width !== null) { | ||
var widths = [picked.width, styles.paddingLeft, styles.paddingRight, styles.borderLeftWidth, styles.borderRightWidth]; | ||
@@ -78,3 +80,3 @@ picked.width = sum(widths.map(parseFloat)) + 'px'; | ||
if (isIE && borderBox && hasOwn('height', picked) && picked.height !== null) { | ||
if (isIE() && borderBox && hasOwn('height', picked) && picked.height !== null) { | ||
var heights = [picked.height, styles.paddingTop, styles.paddingBottom, styles.borderTopWidth, styles.borderBottomWidth]; | ||
@@ -81,0 +83,0 @@ picked.height = sum(heights.map(parseFloat)) + 'px'; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Differ={})}(this,(function(e){"use strict";function t(e,t){return e+t}var n={}.hasOwnProperty;function o(e,t){return n.call(t,e)}function r(e,t){return Object.keys(t).forEach((function(n){e(t[n],n)}))}function i(e){return e.reduce(t,0)}var u=function(e,t){r((function(e,n){t.style[n]=e}),e)},l=function(e,t){r((function(e,n){"style"!==n?t.setAttribute(n,e):u(e,t)}),e)},c=!!document.documentElement.currentStyle,d=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],a=d.join(","),f="undefined"==typeof Element?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,p=function(e,t,n){var o=Array.prototype.slice.apply(e.querySelectorAll(a));return t&&f.call(e,a)&&o.unshift(e),o=o.filter(n)},s=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return isNaN(t)?function(e){return"true"===e.contentEditable}(e)?0:"AUDIO"!==e.nodeName&&"VIDEO"!==e.nodeName&&"DETAILS"!==e.nodeName||null!==e.getAttribute("tabindex")?e.tabIndex:0:t},m=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},h=function(e){return"INPUT"===e.tagName},b=function(e){return function(e){return h(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t=function(e,t){for(var n=0;e.length>n;n++)if(e[n].checked&&e[n].form===t)return e[n]}((e.form||e.ownerDocument).querySelectorAll('input[type="radio"][name="'+e.name+'"]'),e.form);return!t||t===e}(e)},y=function(e){return!(e.disabled||function(e){return h(e)&&"hidden"===e.type}(e)||function(e){if("hidden"===getComputedStyle(e).visibility)return!0;var t=f.call(e,"details>summary:first-of-type");if(f.call(t?e.parentElement:e,"details:not([open]) *"))return!0;for(;e;){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(e))},g=function(e){return!(!y(e)||b(e)||0>s(e))},v=function(e,t){var n=[],o=[];return p(e,(t=t||{}).includeContainer,g).forEach((function(e,t){var r=s(e);0===r?n.push(e):o.push({documentOrder:t,tabIndex:r,node:e})})),o.sort(m).map((function(e){return e.node})).concat(n)},x=d.concat("iframe").join(",");var T=null;e.applyElementSpec=l,e.applyStyle=u,e.createElement=function(e,t){var n=document.createElement(e);return l(t,n),n},e.focusable=function(e,t){return p(e,(t=t||{}).includeContainer,y)},e.getComputedStyle=function(e,t){var n=window.getComputedStyle(t),r="border-box"===n.boxSizing,u=function(e,t){return e.reduce((function(e,n){return e[n]=t[n],e}),{})}(e,n);c&&r&&o("width",u)&&null!==u.width&&(u.width=i([u.width,n.paddingLeft,n.paddingRight,n.borderLeftWidth,n.borderRightWidth].map(parseFloat))+"px");c&&r&&o("height",u)&&null!==u.height&&(u.height=i([u.height,n.paddingTop,n.paddingBottom,n.borderTopWidth,n.borderBottomWidth].map(parseFloat))+"px");return u},e.getNextTabbable=function(e,t){void 0===t&&(t=document.body);var n=v(t),o=function(e,t){for(var n=0;t.length>n;n++)if(e(t[n]))return n;return-1}((function(t){return t===e}),n);return n[o===n.length-1?0:o+1]},e.getRTLOffsetType=function(){if(T)return T;var e=document.createElement("div"),t=e.style;t.width="50px",t.height="50px",t.overflow="scroll",t.direction="rtl";var n=document.createElement("div"),o=n.style;return o.width="100px",o.height="50px",e.appendChild(n),document.body.appendChild(e),e.scrollLeft>0?T="positive-descending":(e.scrollLeft=1,T=0===e.scrollLeft?"negative":"positive-ascending"),document.body.removeChild(e),T},e.getRoot=function(){return new Promise((function(e){!function t(){document.body?e(document.body):setTimeout(t,100)}()}))},e.getScrollOffset=function(e,t){var n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{top:n.top+t.scrollTop-o.top,left:n.left+t.scrollLeft-o.left}},e.isFocusable=function(e){if(!e)throw Error("No node provided");return!1!==f.call(e,x)&&y(e)},e.isScrollOnBottom=function(e,t){return void 0===t&&(t=0),t>=Math.abs(e.scrollTop+e.clientHeight-e.scrollHeight)},e.isScrollOnTop=function(e,t){return void 0===t&&(t=0),t>=e.scrollTop},e.isTabbable=function(e){if(!e)throw Error("No node provided");return!1!==f.call(e,a)&&g(e)},e.prependChild=function(e,t){e.insertBefore(t,e.children[0])},e.removeNode=function(e){var t=e.parentNode;t&&t.removeChild(e)},e.scrollToBottom=function(e){e.scrollTop=e.scrollHeight},e.scrollToTop=function(e){e.scrollTop=0},e.tabbable=v,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Differ={})}(this,(function(e){"use strict";function t(e,t){return e+t}var n={}.hasOwnProperty;function o(e,t){return n.call(t,e)}function r(e,t){return Object.keys(t).forEach((function(n){e(t[n],n)}))}function i(e){return e.reduce(t,0)}var u=function(e,t){r((function(e,n){t.style[n]=e}),e)},l=function(e,t){r((function(e,n){"style"!==n?t.setAttribute(n,e):u(e,t)}),e)},c=function(){return!!document.documentElement.currentStyle},d=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],a=d.join(","),f="undefined"==typeof Element?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,p=function(e,t,n){var o=Array.prototype.slice.apply(e.querySelectorAll(a));return t&&f.call(e,a)&&o.unshift(e),o=o.filter(n)},s=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return isNaN(t)?function(e){return"true"===e.contentEditable}(e)?0:"AUDIO"!==e.nodeName&&"VIDEO"!==e.nodeName&&"DETAILS"!==e.nodeName||null!==e.getAttribute("tabindex")?e.tabIndex:0:t},m=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},h=function(e){return"INPUT"===e.tagName},b=function(e){return function(e){return h(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t=function(e,t){for(var n=0;e.length>n;n++)if(e[n].checked&&e[n].form===t)return e[n]}((e.form||e.ownerDocument).querySelectorAll('input[type="radio"][name="'+e.name+'"]'),e.form);return!t||t===e}(e)},y=function(e){return!(e.disabled||function(e){return h(e)&&"hidden"===e.type}(e)||function(e){if("hidden"===getComputedStyle(e).visibility)return!0;var t=f.call(e,"details>summary:first-of-type");if(f.call(t?e.parentElement:e,"details:not([open]) *"))return!0;for(;e;){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(e))},g=function(e){return!(!y(e)||b(e)||0>s(e))},v=function(e,t){var n=[],o=[];return p(e,(t=t||{}).includeContainer,g).forEach((function(e,t){var r=s(e);0===r?n.push(e):o.push({documentOrder:t,tabIndex:r,node:e})})),o.sort(m).map((function(e){return e.node})).concat(n)},x=d.concat("iframe").join(",");var T=null;e.applyElementSpec=l,e.applyStyle=u,e.createElement=function(e,t){var n=document.createElement(e);return l(t,n),n},e.focusable=function(e,t){return p(e,(t=t||{}).includeContainer,y)},e.getComputedStyle=function(e,t){var n=window.getComputedStyle(t),r="border-box"===n.boxSizing,u=function(e,t){return e.reduce((function(e,n){return e[n]=t[n],e}),{})}(e,n);c()&&r&&o("width",u)&&null!==u.width&&(u.width=i([u.width,n.paddingLeft,n.paddingRight,n.borderLeftWidth,n.borderRightWidth].map(parseFloat))+"px");c()&&r&&o("height",u)&&null!==u.height&&(u.height=i([u.height,n.paddingTop,n.paddingBottom,n.borderTopWidth,n.borderBottomWidth].map(parseFloat))+"px");return u},e.getNextTabbable=function(e,t){void 0===t&&(t=document.body);var n=v(t),o=function(e,t){for(var n=0;t.length>n;n++)if(e(t[n]))return n;return-1}((function(t){return t===e}),n);return n[o===n.length-1?0:o+1]},e.getRTLOffsetType=function(){if(T)return T;var e=document.createElement("div"),t=e.style;t.width="50px",t.height="50px",t.overflow="scroll",t.direction="rtl";var n=document.createElement("div"),o=n.style;return o.width="100px",o.height="50px",e.appendChild(n),document.body.appendChild(e),e.scrollLeft>0?T="positive-descending":(e.scrollLeft=1,T=0===e.scrollLeft?"negative":"positive-ascending"),document.body.removeChild(e),T},e.getRoot=function(){return new Promise((function(e){!function t(){document.body?e(document.body):setTimeout(t,100)}()}))},e.getScrollOffset=function(e,t){var n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{top:n.top+t.scrollTop-o.top,left:n.left+t.scrollLeft-o.left}},e.isFocusable=function(e){if(!e)throw Error("No node provided");return!1!==f.call(e,x)&&y(e)},e.isScrollOnBottom=function(e,t){return void 0===t&&(t=0),t>=Math.abs(e.scrollTop+e.clientHeight-e.scrollHeight)},e.isScrollOnTop=function(e,t){return void 0===t&&(t=0),t>=e.scrollTop},e.isTabbable=function(e){if(!e)throw Error("No node provided");return!1!==f.call(e,a)&&g(e)},e.prependChild=function(e,t){e.insertBefore(t,e.children[0])},e.removeNode=function(e){var t=e.parentNode;t&&t.removeChild(e)},e.scrollToBottom=function(e){e.scrollTop=e.scrollHeight},e.scrollToTop=function(e){e.scrollTop=0},e.tabbable=v,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@livechat/dom-utils", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "DOM utility functions", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
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
29095
647