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

css-var-shim

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-var-shim - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

4

CHANGELOG.md
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 0.2.2 - 2017-08-14
### Added
- Added empty string check
## 0.2.1 - 2017-08-14

@@ -5,0 +9,0 @@ ### Added

2

index.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.cssVarShim=e()}(this,function(){"use strict";function t(t,e){return(e=e||document).querySelectorAll(t)}function e(t){return c(t).reduce(function(t,n){return t.concat(n.cssRules?e(n.cssRules):n)},[])}function n(t,e,n){n=n||[];for(var r;null!==(r=e.exec(t));)n.push(r),e.lastIndex=r.index+r[0].length;return n}function r(t){return function(e){t.apply(this,e)}}function o(t,e){return e.reduce(function(t,e){return t?t[e]:void 0},t)}function u(t){return t=t||{},function(e){return t[e]=isNaN(t[e])?0:t[e]+1,t[e]}}function c(t){return[].slice.call(t)}function i(t){"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}function a(){var t={};return function(e,n){return e?n?(t[e]=n,n):t[e]:t}}function l(t){return function(){return c(arguments).reduce(function(e,n){return n?"object"==typeof n?e+f(n,t):e+n:e},"")}}function f(t,e){if(t[e])return t[e];var n=++p;return t[e]=n,n}function s(t){return t.replace(/\s+/g," ").replace(/"/g,"'").trim()}var p=0;return function(f){function p(t,e){var r=n(t,/--[^\s,)]+/g);return r.length&&r.forEach(function(n){var r=n[0],o=d(r,e);if(o){var u=new RegExp("var\\("+r+"(,[^)]+)?\\)");t=t.replace(u,o),t=p(t,e)}}),t}function d(t,e){for(var n=v(S(t,e));!n&&e&&e.parentElement;)e=e.parentElement,n=v(S(t,e));return n}function y(e,n,r,o){var u=[document.documentElement];o&&":root"===o||(u=t(o)),c(u).forEach(function(t){var o=t!==document.documentElement?t:null;t.style.setProperty(e,n,r||null,o)})}if(!(window.CSS&&CSS.supports&&CSS.supports("--a",0))){var S=l("wl__uuid"),v=a(),h=CSSStyleDeclaration.prototype.getPropertyValue;CSSStyleDeclaration.prototype.getPropertyValue=function(t,e){return/^--/.test(t)?d(t,e):h.call(this,t)};var m=CSSStyleDeclaration.prototype.setProperty;CSSStyleDeclaration.prototype.setProperty=function(n,i,a,l){if(/^--/.test(n)){v(S(n,l),i);var d=u();e(document.styleSheets).forEach(function(e){var u=s(e.selectorText),i=o(f.getVars,[n,u,d(u)]);i&&i.forEach(r(function(n,r,o){var i=p(r,l);l?c(t(u)).forEach(function(t){l.contains(t)&&t.style.setProperty(n,i,o||null)}):e.style.setProperty(n,i,o||null)}))})}else m.call(this,n,i,a)},f.setVars.forEach(r(y)),i(function(){c(t('[data-style*="--"]')).forEach(function(t){var e=n(t.getAttribute("data-style"),/(--[^:]+)\s*:\s*([^;]+)/g);e.length&&e.forEach(r(function(e,n,r){t.style.setProperty(n,r,null,t)}))})})}}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.cssVarShim=e()}(this,function(){"use strict";function t(t,e){return(e=e||document).querySelectorAll(t)}function e(t){return c(t).reduce(function(t,n){return t.concat(n.cssRules?e(n.cssRules):n)},[])}function n(t,e,n){n=n||[];for(var r;null!==(r=e.exec(t));)n.push(r),e.lastIndex=r.index+r[0].length;return n}function r(t){return function(e){t.apply(this,e)}}function o(t,e){return e.reduce(function(t,e){return t?t[e]:void 0},t)}function u(t){return t=t||{},function(e){return t[e]=isNaN(t[e])?0:t[e]+1,t[e]}}function c(t){return[].slice.call(t)}function i(t){"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}function a(){var t={};return function(e,n){return e?n?(t[e]=n,n):t[e]:t}}function l(t){return function(){return c(arguments).reduce(function(e,n){return n?"object"==typeof n?e+f(n,t):e+n:e},"")}}function f(t,e){if(t[e])return t[e];var n=++p;return t[e]=n,n}function s(t){return t?t.replace(/\s+/g," ").replace(/"/g,"'").trim():""}var p=0;return function(f){function p(t,e){var r=n(t,/--[^\s,)]+/g);return r.length&&r.forEach(function(n){var r=n[0],o=d(r,e);if(o){var u=new RegExp("var\\("+r+"(,[^)]+)?\\)");t=t.replace(u,o),t=p(t,e)}}),t}function d(t,e){for(var n=v(S(t,e));!n&&e&&e.parentElement;)e=e.parentElement,n=v(S(t,e));return n}function y(e,n,r,o){var u=[document.documentElement];o&&":root"===o||(u=t(o)),c(u).forEach(function(t){var o=t!==document.documentElement?t:null;t.style.setProperty(e,n,r||null,o)})}if(!(window.CSS&&CSS.supports&&CSS.supports("--a",0))){var S=l("wl__uuid"),v=a(),h=CSSStyleDeclaration.prototype.getPropertyValue;CSSStyleDeclaration.prototype.getPropertyValue=function(t,e){return/^--/.test(t)?d(t,e):h.call(this,t)};var m=CSSStyleDeclaration.prototype.setProperty;CSSStyleDeclaration.prototype.setProperty=function(n,i,a,l){if(/^--/.test(n)){v(S(n,l),i);var d=u();e(document.styleSheets).forEach(function(e){var u=s(e.selectorText),i=o(f.getVars,[n,u,d(u)]);i&&i.forEach(r(function(n,r,o){var i=p(r,l);l?c(t(u)).forEach(function(t){l.contains(t)&&t.style.setProperty(n,i,o||null)}):e.style.setProperty(n,i,o||null)}))})}else m.call(this,n,i,a)},f.setVars.forEach(r(y)),i(function(){c(t('[data-style*="--"]')).forEach(function(t){var e=n(t.getAttribute("data-style"),/(--[^:]+)\s*:\s*([^;]+)/g);e.length&&e.forEach(r(function(e,n,r){t.style.setProperty(n,r,null,t)}))})})}}});
{
"name": "css-var-shim",
"version": "0.2.1",
"version": "0.2.2",
"description": "A shim to provide basic functionality to IE/Edge for changing custom CSS properties at runtime.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -95,3 +95,6 @@

export function cleanCss(css) {
return css.replace(/\s+/g, ' ').replace(/"/g, '\'').trim();
if (css) {
return css.replace(/\s+/g, ' ').replace(/"/g, '\'').trim();
}
return '';
}
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