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

driver-dom

Package Overview
Dependencies
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

driver-dom - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

es/index.d.ts

17

dist/driver-dom.js
(function () {
'use strict';
/**

@@ -94,2 +92,5 @@ * Driver for Web DOM

});
var isEventProp = cached(function (prop) {
return EVENT_PREFIX_REGEXP.test(prop);
});
function setTagNamePrefix(prefix) {

@@ -203,3 +204,3 @@ tagNamePrefix = prefix;

// Remove invalid style prop, and direct reset style to child avoid diff style
for (var _i = 0; _i < hydrationChild.style.length; _i++) {
for (var _i = 0, l = hydrationChild.style.length; _i < l; _i++) {
var stylePropName = hydrationChild.style[_i];

@@ -234,3 +235,3 @@

setStyle(node, value);
} else if (EVENT_PREFIX_REGEXP.test(prop)) {
} else if (isEventProp(prop)) {
addEventListener(node, prop.slice(2).toLowerCase(), value);

@@ -325,2 +326,3 @@ } else {

if (prop[0] === '-' && prop[1] === '-') {
// reference: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/setProperty. style.setProperty do not support Camel-Case style properties.
node.style.setProperty(prop, convertedValue);

@@ -363,10 +365,11 @@ } else {

* Remove all children from node.
* @NOTE: Fast path support in web.
* @NOTE: Optimization at web.
*/
function removeChildren(node) {
node.innerHTML = '';
node.textContent = '';
}
var DriverDOM = /*#__PURE__*/Object.freeze({
var DriverDOM = ({
__proto__: null,
setViewportWidth: setViewportWidth,

@@ -373,0 +376,0 @@ setUnitPrecision: setUnitPrecision,

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

!function(){"use strict";var n=/[-+]?\d*\.?\d+(rpx)/g,i="dangerouslySetInnerHTML",e="__html",o="innerHTML",h="className",m="class",y="style",l="textContent",N="createElement",a="createComment",f="createTextNode",u="setAttribute",g="removeAttribute",C=/^on[A-Z]/,b="http://www.w3.org/2000/svg",c="__i",x="__a",T=document,w="",L=!1,_=!1,r=750,s=4;function d(e){return 10*Math.round(Math.floor(parseFloat(e)/(r/100)*(t=Math.pow(10,s+1)))/10)/t+"vw";var t}var t,v,p=(t=function(e){return"string"==typeof(t=e)&&"rpx"===t.slice(0,-3)?e.replace(n,d):e;var t},v=Object.create(null),function(e){return v[e]||(v[e]=t(e))});function E(e){return null==e[c]&&(e[c]=0),e.childNodes[e[c]++]}function M(e,t){if(!_||e[x])return t.appendChild(e)}function A(e,t,n){(n=n||t.parentNode).replaceChild(e,t)}function O(e,t,n){(n=n||t.parentNode).insertBefore(e,t)}function P(e,t,n){return e.addEventListener(t,n)}function S(t,n,r){if(n===i&&t[o]!==r[e])return t[o]=r[e];if(n===h&&(n=m),n in t)try{t[n]=r}catch(e){t[u](n,r)}else t[u](n,r)}function j(e,t){for(var n in t){var r=p(t[n]);"-"===n[0]&&"-"===n[1]?e.style.setProperty(n,r):e.style[n]=r}}var B=Object.freeze({setViewportWidth:function(e){r=e},setUnitPrecision:function(e){s=e},setDecimalPixelTransformer:function(){},setTagNamePrefix:function(e){w=e},createBody:function(){return T.body},createEmpty:function(e){var t,n=e._parent;if(_){var r=E(n);if(r){if(8===r.nodeType)return r;A(t=T[a](""),r,n)}else(t=T[a](""))[x]=!0}else t=T[a]("");return t},createText:function(e,t){var n,r=t._parent;if(_){var i=E(r);if(i){if(3===i.nodeType)return e!==i[l]&&(i[l]=e),i;A(n=T[f](e),i,r)}else(n=T[f](e))[x]=!0}else n=T[f](e);return n},updateText:function(e,t){e[l]=t},createElement:function(t,e,n){var r,i=n._parent;L="svg"===t||i&&i.namespaceURI===b;var o=null;function l(){if(L)r=T.createElementNS(b,t);else if(w){var e="function"==typeof e?e(t):e;r=T[N](e+t)}else r=T[N](t)}if(_)if(o=E(i))if(t===o.nodeName.toLowerCase()){for(var a=o.attributes,f=a.length;f--;){var u=a[f].name,c=e[u];if(u===m&&null==e[h]&&null==c||u===y&&(null==c||0===Object.keys(c).length)||u!==m&&u!==y&&null==c)o[g](u);else if(u===y)for(var s=0;s<o.style.length;s++){var d=o.style[s];c[d]||(o.style[d]="")}}r=o}else l(),A(r,o,i);else l(),r[x]=!0;else l();for(var v in e){var p=e[v];"children"!==v&&null!=p&&(v===y?j(r,p):C.test(v)?P(r,v.slice(2).toLowerCase(),p):S(r,v,p))}return r},appendChild:M,removeChild:function(e,t){(t=t||e.parentNode)&&t.removeChild(e)},replaceChild:A,insertAfter:function(e,t,n){n=n||t.parentNode;var r=t.nextSibling;r?r!==e&&O(e,r,n):M(e,n)},insertBefore:O,addEventListener:P,removeEventListener:function(e,t,n){return e.removeEventListener(t,n)},removeAttribute:function(e,t){if(t===i)return e[o]=null;if(t===h&&(t=m),t in e)try{e[t]=null}catch(e){}e[g](t)},setAttribute:S,setStyle:j,beforeRender:function(e){_=e.hydrate},afterRender:function(e){_&&(function e(t){var n=t.childNodes.length,r=t[c]||0;if(0<n-r)for(var i=n-1;r<=i;i--)t.removeChild(t.childNodes[i]);for(var o=t.childNodes.length-1;0<=o;o--)e(t.childNodes[o])}(e.container),_=!1)},removeChildren:function(e){e.innerHTML=""}});"undefined"!=typeof module?module.exports=B:self.DriverDOM=B}();
!function(){var n=/[-+]?\d*\.?\d+(rpx)/g,i="dangerouslySetInnerHTML",e="__html",u="innerHTML",h="className",y="class",_="style",f="textContent",x="createElement",o="createComment",c="createTextNode",l="setAttribute",b="removeAttribute",t=/^on[A-Z]/,g="http://www.w3.org/2000/svg",a="__i",T="__a",w=document,A="",C=!1,E=!1,r=750,s=4;function v(e){return function(e,n){var t=Math.pow(10,n+1);return 10*Math.round(Math.floor(e*t)/10)/t}(parseFloat(e)/(r/100),s)+"vw"}function d(n){var t=Object.create(null);return function(e){return t[e]||(t[e]=n(e))}}var m=d(function(e){return function(e){return"string"==typeof e&&"rpx"===e.slice(0,-3)}(e)?function(e){return e.replace(n,v)}(e):e}),M=d(function(e){return t.test(e)});function L(e){return null==e[a]&&(e[a]=0),e.childNodes[e[a]++]}function p(e,n){if(!E||e[T])return n.appendChild(e)}function N(e,n,t){(t=t||n.parentNode).replaceChild(e,n)}function P(e,n,t){(t=t||n.parentNode).insertBefore(e,n)}function j(e,n,t){return e.addEventListener(n,t)}function B(n,t,r){if(t===i&&n[u]!==r[e])return n[u]=r[e];if(t===h&&(t=y),t in n)try{n[t]=r}catch(e){n[l](t,r)}else n[l](t,r)}function H(e,n){for(var t in n){var r=m(n[t]);"-"===t[0]&&"-"===t[1]?e.style.setProperty(t,r):e.style[t]=r}}var O={__proto__:null,setViewportWidth:function(e){r=e},setUnitPrecision:function(e){s=e},setDecimalPixelTransformer:function(){},setTagNamePrefix:function(e){A=e},createBody:function(){return w.body},createEmpty:function(e){var n,t=e._parent;if(E){var r=L(t);if(r){if(8===r.nodeType)return r;N(n=w[o](""),r,t)}else(n=w[o](""))[T]=!0}else n=w[o]("");return n},createText:function(e,n){var t,r=n._parent;if(E){var i=L(r);if(i){if(3===i.nodeType)return e!==i[f]&&(i[f]=e),i;N(t=w[c](e),i,r)}else(t=w[c](e))[T]=!0}else t=w[c](e);return t},updateText:function(e,n){e[f]=n},createElement:function(n,e,t){var r,i=t._parent;C="svg"===n||i&&i.namespaceURI===g;var u=null;function f(){if(C)r=w.createElementNS(g,n);else if(A){var e="function"==typeof e?e(n):e;r=w[x](e+n)}else r=w[x](n)}if(E)if(u=L(i))if(n===u.nodeName.toLowerCase()){for(var o=u.attributes,c=o.length;c--;){var l=o[c].name,a=e[l];if(l===y&&null==e[h]&&null==a||l===_&&(null==a||0===Object.keys(a).length)||l!==y&&l!==_&&null==a)u[b](l);else if(l===_)for(var s=0,v=u.style.length;s<v;s++){var d=u.style[s];a[d]||(u.style[d]="")}}r=u}else f(),N(r,u,i);else f(),r[T]=!0;else f();for(var m in e){var p=e[m];"children"!==m&&null!=p&&(m===_?H(r,p):M(m)?j(r,m.slice(2).toLowerCase(),p):B(r,m,p))}return r},appendChild:p,removeChild:function(e,n){(n=n||e.parentNode)&&n.removeChild(e)},replaceChild:N,insertAfter:function(e,n,t){t=t||n.parentNode;var r=n.nextSibling;r?r!==e&&P(e,r,t):p(e,t)},insertBefore:P,addEventListener:j,removeEventListener:function(e,n,t){return e.removeEventListener(n,t)},removeAttribute:function(e,n){if(n===i)return e[u]=null;if(n===h&&(n=y),n in e)try{e[n]=null}catch(e){}e[b](n)},setAttribute:B,setStyle:H,beforeRender:function(e){E=e.hydrate},afterRender:function(e){E&&(!function e(n){var t=n.childNodes.length,r=n[a]||0;if(0<t-r)for(var i=t-1;r<=i;i--)n.removeChild(n.childNodes[i]);for(var u=n.childNodes.length-1;0<=u;u--)e(n.childNodes[u])}(e.container),E=!1)},removeChildren:function(e){e.textContent=""}};"undefined"!=typeof module?module.exports=O:self.DriverDOM=O}();
//# sourceMappingURL=driver-dom.min.js.map

@@ -5,4 +5,3 @@ (function (global, factory) {

(global = global || self, factory(global.DriverDOM = {}));
}(this, function (exports) { 'use strict';
}(this, function (exports) {
/**

@@ -98,2 +97,5 @@ * Driver for Web DOM

});
var isEventProp = cached(function (prop) {
return EVENT_PREFIX_REGEXP.test(prop);
});
function setTagNamePrefix(prefix) {

@@ -207,3 +209,3 @@ tagNamePrefix = prefix;

// Remove invalid style prop, and direct reset style to child avoid diff style
for (var _i = 0; _i < hydrationChild.style.length; _i++) {
for (var _i = 0, l = hydrationChild.style.length; _i < l; _i++) {
var stylePropName = hydrationChild.style[_i];

@@ -238,3 +240,3 @@

setStyle(node, value);
} else if (EVENT_PREFIX_REGEXP.test(prop)) {
} else if (isEventProp(prop)) {
addEventListener(node, prop.slice(2).toLowerCase(), value);

@@ -329,2 +331,3 @@ } else {

if (prop[0] === '-' && prop[1] === '-') {
// reference: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/setProperty. style.setProperty do not support Camel-Case style properties.
node.style.setProperty(prop, convertedValue);

@@ -367,7 +370,7 @@ } else {

* Remove all children from node.
* @NOTE: Fast path support in web.
* @NOTE: Optimization at web.
*/
function removeChildren(node) {
node.innerHTML = '';
node.textContent = '';
}

@@ -374,0 +377,0 @@

@@ -124,2 +124,5 @@ "use strict";

});
var isEventProp = cached(function (prop) {
return EVENT_PREFIX_REGEXP.test(prop);
});

@@ -238,3 +241,3 @@ function setTagNamePrefix(prefix) {

// Remove invalid style prop, and direct reset style to child avoid diff style
for (var _i = 0; _i < hydrationChild.style.length; _i++) {
for (var _i = 0, l = hydrationChild.style.length; _i < l; _i++) {
var stylePropName = hydrationChild.style[_i];

@@ -269,3 +272,3 @@

setStyle(node, value);
} else if (EVENT_PREFIX_REGEXP.test(prop)) {
} else if (isEventProp(prop)) {
addEventListener(node, prop.slice(2).toLowerCase(), value, component);

@@ -370,2 +373,3 @@ } else {

if (prop[0] === '-' && prop[1] === '-') {
// reference: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/setProperty. style.setProperty do not support Camel-Case style properties.
node.style.setProperty(prop, convertedValue);

@@ -409,3 +413,3 @@ } else {

* Remove all children from node.
* @NOTE: Fast path support in web.
* @NOTE: Optimization at web.
*/

@@ -415,3 +419,3 @@

function removeChildren(node) {
node.innerHTML = '';
node.textContent = '';
}
{
"name": "driver-dom",
"version": "2.0.1",
"version": "2.0.2",
"description": "DOM driver for Rax",
"license": "BSD-3-Clause",
"main": "lib/index.js",
"module": "es/index.js",
"repository": {

@@ -8,0 +9,0 @@ "type": "git",

@@ -91,2 +91,4 @@ /**

const isEventProp = cached((prop) => EVENT_PREFIX_REGEXP.test(prop));
export function setTagNamePrefix(prefix) {

@@ -206,3 +208,3 @@ tagNamePrefix = prefix;

// Remove invalid style prop, and direct reset style to child avoid diff style
for (let i = 0; i < hydrationChild.style.length; i++) {
for (let i = 0, l = hydrationChild.style.length; i < l; i++) {
let stylePropName = hydrationChild.style[i];

@@ -236,3 +238,3 @@ if (!propValue[stylePropName]) {

setStyle(node, value);
} else if (EVENT_PREFIX_REGEXP.test(prop)) {
} else if (isEventProp(prop)) {
addEventListener(node, prop.slice(2).toLowerCase(), value, component);

@@ -335,2 +337,3 @@ } else {

if (prop[0] === '-' && prop[1] === '-') {
// reference: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/setProperty. style.setProperty do not support Camel-Case style properties.
node.style.setProperty(prop, convertedValue);

@@ -371,6 +374,6 @@ } else {

* Remove all children from node.
* @NOTE: Fast path support in web.
* @NOTE: Optimization at web.
*/
export function removeChildren(node) {
node.innerHTML = '';
node.textContent = '';
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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