Mulgard
Mulgard

Reputation: 10609

Cannot read property 'removeAttribute' of null: Cant find source of it

Im getting errors over and over again on each of my sites:

VM42958:5 Uncaught TypeError: Cannot read property 'removeAttribute' of null
(anonymous function) @ VM42958:5
(anonymous function) @ VM42958:20

Unfortunately i cant find the source of this error. If i open the related JavaScript lines i find the following:

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);
  }
})();

This is not my code and i have no idea where it is comming from or where it is used. As libraries im using bootstrap, jQuery and Chart.js.

Does somebody know this part of code or is there a way to find the source of this error. i mean directly the line where it is appearing?

The same error occurs in this jsFiddle for example: jsFiddle

Upvotes: 19

Views: 26905

Answers (3)

Brieg
Brieg

Reputation: 63

To be honest the worst solution ever is to remove AdBlock or disable it.

Upvotes: 0

Lebannehn
Lebannehn

Reputation: 603

Same problem here. For some reason Chrome ADBlock (not plus) was the cause.

Upvotes: 47

hsz
hsz

Reputation: 152304

The var style = ... statement gives null. You do not have in the document any of the queried elements.

Upvotes: 1

Related Questions