From eace40f0cbc188850210499e011295ce24d9daeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:33:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(layer):=20=E4=BF=AE=E5=A4=8D=20layer.path?= =?UTF-8?q?=20=E6=BD=9C=E5=9C=A8=E7=9A=84=E7=BC=BA=E9=99=B7=20(#2257)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(layer): 修复 layer.path 潜在的缺陷 * chore(layer): update --- src/modules/layer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/layer.js b/src/modules/layer.js index f6c1fb8d..61ff7598 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -11,8 +11,8 @@ var $; var win; var ready = { getPath: function(){ - var jsPath = document.currentScript ? document.currentScript.src : function(){ - var js = document.scripts; + var jsPath = (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') ? document.currentScript.src : function(){ + var js = document.getElementsByTagName('script'); var last = js.length - 1; var src; for(var i = last; i > 0; i--){