Why would a classList throw an HTTP response code?

58 Views Asked by At

I have some Custom Element code. For some bizarre reason it's throwing me a 404 in Chrome in a part of the code where there is no network activity.

404 on classList.toggle

The console says it's trying to hit http://localhost:4000/null, but there is no activity in the network tab. This isn't happening on Firefox.

Here's the full scope of that function:

attributeChangedCallback(attr, oldVal, newVal) {

  switch (attr) {

    case 'show':
      this.classList.toggle('modal-window--show', newVal == 'true')
      break;
    case 'heading':
      this.querySelector('.modal-window__header').textContent = newVal
      break;

  }
}

I'm using the Document Register Element pollyfill.

1

There are 1 best solutions below

0
On BEST ANSWER

I was being dense here.

The bad request didn't show on my network panel because I had a filter for XHTTPRequests turned on. If I had seen the network request I would have known that the network request was for a background image that was being applied via a class. Hence the error threw after a class was toggled.