prefixfree icon indicating copy to clipboard operation
prefixfree copied to clipboard

Document.currentScript is null when executed in a module or with eval

Open TrevorKarjanis opened this issue 5 years ago • 0 comments

Document.currentScript is null when executed in a module or with eval. This results in an exception on line 14 in prefixfree.js. I understand that the limitations state, "Prefixing code in @import-ed files is not supported." However, I am not sure if that refers to the CSS or the -prefixfree source. Applications run in environments like StackBlitz are bundled or executed with eval where Document.currentScript is always null. This reproduction using -prefixfree and conic-gradients performs a null check.

var currentScript = document.currentScript;
var self = window.StyleFix = {
	optIn: currentScript && currentScript.hasAttribute("data-prefix"),

v1.0.10

TrevorKarjanis avatar Nov 28 '19 17:11 TrevorKarjanis