在 argelius 最喜欢的明星之后,webapp 没有响应

webapp unresponsive after argelius' favorite-star

在 iOS 网络应用程序中使用 argelius' favorite star 后,其 js 变得无响应。在桌面 safari 中,它可以工作,但会出现错误 Refused to get unsafe header "Location",在仔细研究之后似乎与此无关,但我认为我应该提及它。

有什么想法吗?

可能是我实现的方式有问题,这是我实现的第一个GitHub仓库。

此代码在 <head>:

<script src="https://argelius.github.io/favorite-star/bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="https://argelius.github.io/favorite-star/favorite-star.html">

编辑: 在使用 iOS 网络检查器后我发现 scope.wrappers.Window 返回了 null,进一步挖掘我找到了这个解决方案:

变化:

function getDescriptor(source, name) {
  try {
    return Object.getOwnPropertyDescriptor(source, name);
  } catch (ex) {
    return dummyDescriptor;
  }
}

为:

function getDescriptor(source, name) {
  try {
    var desc = Object.getOwnPropertyDescriptor(source, name);
    if (desc) return desc;
  } catch (ex) {
    // Just return a dummy descriptor
  }
  return dummyDescriptor;
}

按照https://github.com/argelius/favorite-star中的安装步骤进行操作 并且不要使用位置“https://argelius.github.io/favorite-star/favorite-star.html”。

在您的本地环境中安装它然后添加 favorite-star.html.

的本地路径

我在本地环境中尝试过 -

这是我的 html 代码 -

<html>
<head>
<link rel="import" href="favorite-star/favorite-star.html">
</head>
<body>
    Hi!!!  This is my favorite <favorite-star active></favorite-star>
</body>
</html>

并且提取出来的文件夹路径是我的静态资源文件夹即public然后是href.

中提到的路径

在使用 iOS 网络检查器后,我发现 scope.wrappers.Window 返回了 null,进一步挖掘我找到了这个解决方案:

变化:

function getDescriptor(source, name) {
  try {
    return Object.getOwnPropertyDescriptor(source, name);
  } catch (ex) {
    return dummyDescriptor;
  }
}

用于:

function getDescriptor(source, name) {
  try {
    var desc = Object.getOwnPropertyDescriptor(source, name);
    if (desc) return desc;
  } catch (ex) {
    // Just return a dummy descriptor
  }
  return dummyDescriptor;
}

信用:https://github.com/webcomponents/webcomponentsjs/issues/628