Created
November 16, 2018 15:52
-
-
Save antcolag/880704b144bab46eb331814f59dcc76b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var setPseudoStyle = (function() { | |
document.head.appendChild(document.createElement('style')); | |
style = document.styleSheets[document.styleSheets.length-1]; | |
return function setPseudoStyle(elm, pseudo, text){ | |
var id = elm.dataset.psudoLinkToStyle | |
if(void 0 === id){ | |
id = style.rules.length; | |
style.addRule( '[data-psudo-link-to-style="'+id+'"]:'+pseudo, '', id); | |
elm.dataset.psudoLinkToStyle = id; | |
} | |
style.rules[id].style = text | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
credo funzioni così