hyperhtml-style
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -6,4 +6,4 @@ /*! (c) Andrea Giammarchi - ISC */ | ||
var hyphen = /([^A-Z])([A-Z]+)/g; | ||
return function hyperStyle(node) { | ||
return 'ownerSVGElement' in node ? svg(node) : update(node.style, false); | ||
return function hyperStyle(node, original) { | ||
return 'ownerSVGElement' in node ? svg(node, original) : update(node.style, false); | ||
}; | ||
@@ -13,5 +13,13 @@ function ized($0, $1, $2) { | ||
} | ||
function svg(node) { | ||
node.setAttribute('style', ''); | ||
return update(node.getAttributeNode('style'), true); | ||
function svg(node, original) { | ||
var style; | ||
if (original) | ||
style = original.cloneNode(true); | ||
else { | ||
node.setAttribute('style', '--hyper:style;'); | ||
style = node.getAttributeNode('style'); | ||
} | ||
style.value = ''; | ||
node.setAttributeNode(style); | ||
return update(style, true); | ||
} | ||
@@ -18,0 +26,0 @@ function toStyle(object) { |
@@ -6,4 +6,4 @@ /*! (c) Andrea Giammarchi - ISC */ | ||
var hyphen = /([^A-Z])([A-Z]+)/g; | ||
return function hyperStyle(node) { | ||
return 'ownerSVGElement' in node ? svg(node) : update(node.style, false); | ||
return function hyperStyle(node, original) { | ||
return 'ownerSVGElement' in node ? svg(node, original) : update(node.style, false); | ||
}; | ||
@@ -13,5 +13,13 @@ function ized($0, $1, $2) { | ||
} | ||
function svg(node) { | ||
node.setAttribute('style', ''); | ||
return update(node.getAttributeNode('style'), true); | ||
function svg(node, original) { | ||
var style; | ||
if (original) | ||
style = original.cloneNode(true); | ||
else { | ||
node.setAttribute('style', '--hyper:style;'); | ||
style = node.getAttributeNode('style'); | ||
} | ||
style.value = ''; | ||
node.setAttributeNode(style); | ||
return update(style, true); | ||
} | ||
@@ -18,0 +26,0 @@ function toStyle(object) { |
18
index.js
@@ -6,4 +6,4 @@ /*! (c) Andrea Giammarchi - ISC */ | ||
var hyphen = /([^A-Z])([A-Z]+)/g; | ||
return function hyperStyle(node) { | ||
return 'ownerSVGElement' in node ? svg(node) : update(node.style, false); | ||
return function hyperStyle(node, original) { | ||
return 'ownerSVGElement' in node ? svg(node, original) : update(node.style, false); | ||
}; | ||
@@ -13,5 +13,13 @@ function ized($0, $1, $2) { | ||
} | ||
function svg(node) { | ||
node.setAttribute('style', ''); | ||
return update(node.getAttributeNode('style'), true); | ||
function svg(node, original) { | ||
var style; | ||
if (original) | ||
style = original.cloneNode(true); | ||
else { | ||
node.setAttribute('style', '--hyper:style;'); | ||
style = node.getAttributeNode('style'); | ||
} | ||
style.value = ''; | ||
node.setAttributeNode(style); | ||
return update(style, true); | ||
} | ||
@@ -18,0 +26,0 @@ function toStyle(object) { |
/*! (c) Andrea Giammarchi - ISC */ | ||
var hyperStyle=function(){"use strict";var a=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,f=/([^A-Z])([A-Z]+)/g;return function(e){return"ownerSVGElement"in e?((t=e).setAttribute("style",""),r(t.getAttributeNode("style"),!0)):r(e.style,!1);var t};function l(e,t,r){return t+"-"+r.toLowerCase()}function r(i,s){var u,c;return function(e){var t,r,n,o;switch(typeof e){case"object":if(e){if("object"===u){if(!s&&c!==e)for(r in c)r in e||(i[r]="")}else s?i.value="":i.cssText="";for(r in t=s?{}:i,e)n="number"!=typeof(o=e[r])||a.test(r)?o:o+"px",!s&&/^--/.test(r)?t.setProperty(r,n):t[r]=n;u="object",s?i.value=function(e){var t,r=[];for(t in e)r.push(t.replace(f,l),":",e[t],";");return r.join("")}(c=t):c=e;break}default:c!=e&&(u="string",c=e,s?i.value=e||"":i.cssText=e||"")}}}}(); | ||
var hyperStyle=function(){"use strict";var a=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,f=/([^A-Z])([A-Z]+)/g;return function(e,t){return"ownerSVGElement"in e?function(e,t){var r;r=t?t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),e.getAttributeNode("style"));return r.value="",e.setAttributeNode(r),n(r,!0)}(e,t):n(e.style,!1)};function l(e,t,r){return t+"-"+r.toLowerCase()}function n(i,u){var s,c;return function(e){var t,r,n,o;switch(typeof e){case"object":if(e){if("object"===s){if(!u&&c!==e)for(r in c)r in e||(i[r]="")}else u?i.value="":i.cssText="";for(r in t=u?{}:i,e)n="number"!=typeof(o=e[r])||a.test(r)?o:o+"px",!u&&/^--/.test(r)?t.setProperty(r,n):t[r]=n;s="object",u?i.value=function(e){var t,r=[];for(t in e)r.push(t.replace(f,l),":",e[t],";");return r.join("")}(c=t):c=e;break}default:c!=e&&(s="string",c=e,u?i.value=e||"":i.cssText=e||"")}}}}(); |
{ | ||
"name": "hyperhtml-style", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "The hyperHTML's html/svg style updater", | ||
@@ -5,0 +5,0 @@ "main": "cjs/index.js", |
@@ -26,2 +26,3 @@ # hyperHTML Style | ||
console.log(document.body.style.cssText); | ||
// font-family: sans-serif; | ||
@@ -28,0 +29,0 @@ // font-size: 16px; |
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
11863
255
31