Skip to content

Commit f613188

Browse files
authored
Update utils.js (#3656)
fix when script run with TamperMonkey or GreaseMonkey tag is null
1 parent 8666b01 commit f613188

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/less/src/less-browser/utils.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export function extractId(href) {
99
}
1010

1111
export function addDataAttr(options, tag) {
12+
if(!tag) return; // in case of tag is null or undefined
1213
for (const opt in tag.dataset) {
1314
if (tag.dataset.hasOwnProperty(opt)) {
1415
if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') {

0 commit comments

Comments
 (0)