3

非常に単純なページでも Selectivizr を動作させるのに問題があります。私は何を間違えましたか?

http://jiewmeng.kodingen.com/playground/selectivr.html

<html>
<head>
    <link rel="stylesheet" href="selectivr.css" />
    <script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools-yui-compressed.js"></script>
    <!--[if (gte IE 6)&(lte IE 8)]>
      <script src="selectivizr.js"></script>
    <![endif]--> 

</head>

<body>
    <h1>Hello World</h1>
    <p>Paragraph 1</p>

    <p>Paragraph 2</p>
    <p>Paragraph 3</p>
    <p>Paragraph 4</p>
    <p>Paragraph 5</p>
    <p>Paragraph 6</p>
</body>
</html>

CSS

p:nth-child(2n+2) { color: red }
4

2 に答える 2

4

Selectivizr は、ページが厳密モードの場合にのみ機能します。ページにdoctype 宣言を与えていないため、Quirks モードで読み込まれています。つまり、Selectivizr が読み込まれていません。

<!DOCTYPE html>開始タグの前に追加するだけhtmlで、Selectivizr が機能します。

于 2011-08-22T14:13:12.707 に答える
3

selectivizrが動作する既存のcssへのリンクを追加することをお勧めします。

これがあなたの場合に頭に入れるべき完全なコードです:

    <!--[if (gte IE 6)&(lte IE 8)]>
      <script type="text/javascript" src="/js/selectivizr/selectivizr.js"></script>
      <noscript><link rel="stylesheet" href="selectivr.css" /></noscript>
    <![endif]-->

他にも2つの既知の問題があります:

  • ローカルで動作します、それは動作しません
  • コメントを外した場合は、PIE.htcを同時に使用します。

それが役に立てば幸い !幸運を。

于 2011-09-07T11:09:55.450 に答える