![](/img/trans.png)
[英]TypeError: Cannot read property “removeAttribute” of null
[英]Cannot read property 'removeAttribute' of null: Cant find source of it
我在每個網站上一遍又一遍地收到錯誤:
VM42958:5 Uncaught TypeError: Cannot read property 'removeAttribute' of null
(anonymous function) @ VM42958:5
(anonymous function) @ VM42958:20
不幸的是我無法找到此錯誤的來源。 如果我打開相關的JavaScript行,我會發現以下內容:
VM42958
(function()
{
var style = document.getElementById("9mr7n8lmeyjxk84i17g5ws714i") ||
document.documentElement.shadowRoot.getElementById("9mr7n8lmeyjxk84i17g5ws714i");
style.removeAttribute("id");
Object.defineProperty(style, "disabled", {value: false, enumerable: true});
Object.defineProperty(style.sheet, "disabled", {value: false, enumerable: true});
var deleteRule = CSSStyleSheet.prototype.deleteRule;
CSSStyleSheet.prototype.deleteRule = function(index)
{
if (this != style.sheet)
deleteRule.call(this, index);
}
var removeRule = CSSStyleSheet.prototype.removeRule;
CSSStyleSheet.prototype.removeRule = function(index)
{
if (this != style.sheet)
removeRule.call(this, index);
}
})();
這不是我的代碼,我不知道它來自何處或在何處使用。 作為庫使用bootstrap,jQuery和Chart.js。
有人知道這部分代碼或有沒有辦法找到這個錯誤的來源。 我的意思是它出現的直線?
同樣的問題在這里 出於某種原因,Chrome ADBlock(不是加號)是原因。
var style = ...
語句給出null
。 您在文檔中沒有任何查詢元素。
說實話,有史以來最糟糕的解決方案是刪除AdBlock或禁用它。
它看起來像我:放下你的太陽眼鏡去撒哈拉沙漠 - 它會燃燒你的眼睛......
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.