I have a style element that is being loaded from an external resource, and I want to apply its styles without nesting it in a string.
For example, it will <link rel="stylesheet" type="text/css" href="my.css" />load the css file and apply it without putting it inline, and <script src="zepto.js"></script>will do the same for javascript.
If you download the external js bit, you can evaluate it with eval(), even if it frowned.
But when you load the external style bit, I donβt know how to evaluate it, except to add it to dom.
So, is there a similar function for styles, like eval for scripts? Does anyone know a good hack to get the same effect?
Everything is fine until the style is applied, until it appears in dom.
source
share