travix-css-themes-polyfill
Advanced tools
Comparing version 0.1.1 to 0.1.4
@@ -1,1 +0,1 @@ | ||
!function(){window.cssThemeService=function(e){return e.split("\n").join("").replace(/var\(--([\w-]+)\)/g,function(e,t){return(window.TravixTheme||{})[t]})},[].forEach.call(document.querySelectorAll("[data-cssvars]"),function(e){var t=e.href,n=new XMLHttpRequest;n.open("GET",t,!0),n.onreadystatechange=function(){if(4===n.readyState&&(200===n.status||0===n.status)){var e=document.createElement("style");document.head.appendChild(e),e.innerText=window.cssThemeService(n.responseText)}},n.send(null)}),document.head.addEventListener("DOMSubtreeModified",function(e){if(e.target instanceof HTMLStyleElement){-1!==e.target.innerText.indexOf("var(--")&&(e.target.innerText=window.cssThemeService(e.target.innerText))}},!1)}(); | ||
!function(){function e(e){var t=e.href;e.setAttribute("data-parsed",!0);var n=new XMLHttpRequest;n.open("GET",t,!0),n.onreadystatechange=function(){if(4===n.readyState&&(200===n.status||0===n.status)){var e=document.createElement("style");document.head.appendChild(e),e.innerText=window.cssThemeService(n.responseText)}},n.send(null)}function t(){[].forEach.call(document.querySelectorAll("[data-cssvars]:not([data-parsed])"),e)}window.cssThemeService=function(e){return e.split("\n").join("").replace(/var\(--([\w-]+)\)/g,function(e,t){return(window.TravixTheme||{})[t]})},t(),document.head.addEventListener("DOMSubtreeModified",function(e){if(e.target instanceof HTMLHeadElement&&t(),e.target instanceof HTMLStyleElement){-1!==e.target.innerText.indexOf("var(--")&&(e.target.innerText=window.cssThemeService(e.target.innerText))}},!1)}(); |
{ | ||
"name": "travix-css-themes-polyfill", | ||
"version": "0.1.1", | ||
"version": "0.1.4", | ||
"description": "Travix CSS variables for themes polyfill", | ||
"main": "src/index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"build": "uglifyjs --compress --mangle --output lib/index.js src/index.js", | ||
"build": "mkdir -p lib && uglifyjs --compress --mangle --output lib/index.js src/index.js", | ||
"test": "node test/index.spec.js", | ||
@@ -9,0 +9,0 @@ "lint": "eslint --color src/index.js" |
@@ -10,3 +10,6 @@ global.window = { | ||
querySelectorAll() { | ||
return [{ href: 'test.js' }]; | ||
return [{ | ||
href: 'test.js', | ||
setAttribute: () => {}, | ||
}]; | ||
}, | ||
@@ -37,2 +40,7 @@ createElement(name) { | ||
function HTMLHeadElement() { | ||
this.href = 'fake.js'; | ||
this.setAttribute = () => {}; | ||
}; | ||
function testEventHandler() { | ||
@@ -85,3 +93,4 @@ const testElem = new HTMLStyleElement(); | ||
global.HTMLStyleElement = HTMLStyleElement; | ||
global.HTMLHeadElement = HTMLHeadElement; | ||
require('../src/index.js'); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9909
81
1