JS:无法在'Window'上执行'getComputedStyle':参数不是'Element'类型 [英] JS: Failed to execute 'getComputedStyle' on 'Window': parameter is not of type 'Element'
问题描述
简而言之:我试图理解这个TypeError的含义:
无法在'Window'上执行'getComputedStyle':参数1不是'Element'类型
午餐时出现错误Mediawiki的VisualEditor,如下所示:
In short: I am trying to understand the meaning of this TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element' The error appears while lunching Mediawiki's VisualEditor, as can be seen here:
http://www.wiki.org.il/index.php?title=new-page&veaction=edit
该错误无法匿名创建新页面或编辑维基。
但是,使用不同的皮肤时,错误消失了:
The error doesn't enables creating new pages or editing the wiki anonymously. However, with the use of a different skin the error disappears:
http://www.wiki.org.il/index.php/Main_Page?useskin=vector
维基在1.25alpha上运行。
The wiki runs on 1.25alpha.
推荐答案
我有同样的错误显示。当我用普通JavaScript替换jQuery选择器时,错误得到修复。
I had this same error showing. When I replaced jQuery selector with normal JavaScript, the error was fixed.
var this_id = $(this).attr('id');
替换:
getComputedStyle( $('#'+this_id)[0], "")
使用:
getComputedStyle( document.getElementById(this_id), "")
这篇关于JS:无法在'Window'上执行'getComputedStyle':参数不是'Element'类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!