为什么classList会抛出HTTP响应代码?

时间:2016-12-20 10:19:13

标签: javascript google-chrome http custom-element

我有一些自定义元素代码。出于某些奇怪的原因,它在Chrome中的一部分代码中没有网络活动,这让我感染了404.

404 on classList.toggle

控制台说它正在尝试点击 http://localhost:4000/null ,但网络标签中没有任何活动。这种情况在Firefox上没有发生。

这是该功能的全部范围:

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;

  }
}

我正在使用Document Register Element pollyfill。

1 个答案:

答案 0 :(得分:0)

我在这里很密集。

我的网络面板上没有显示错误的请求,因为我打开了XHTTPRequests的过滤器。如果我看过网络请求,我就会知道网络请求是针对通过类应用的背景图像。因此,在课程被切换后,错误就会发生。