14 Sep 09 CSSは、あなたのIEブラウザをクラッシュさせます。(Crash your IE)


  • 本の住所:http://www.laruence.com/2009/09/14/1081.html
  • 転載記事
  • 厳密にはCSSだけでなく、IEブラウザを崩壊させることができ、対応するXHTMLアーキテクチャに協力することができます。今まで、二つの正常な書き方と一つの間違った構造があって、それぞれIE 6、IE 7が崩壊します。原因については、答えを探してみましたが、まだ見つけられませんでした。この方面の認識や詳細な資料があれば、教えてください。
    1 crash IE 6 code
    Demo:http://blog.gulu77.com/demo/200808/crash_ie6.html
    このBUGはIE 6にしか存在しません。疑似クラスがa:activeの時も同じです。
    a{position:relative;}
    a:hover{float:left;}
    
    解決策:aのためにzoomを追加します。ハスラayoutを触発させる
    
     
    1. a{position:relative;zoom:1;}
    2. a:hover{float:left;}
    2 crash IE 6 code
    これはHTML構造のエラーで、IE 6がクラッシュしました。<col width=”100”/”の前または後に任意の文字を追加すると、IE 6 Crashが発生します。
    Demo:http://blog.gulu77.com/demo/200808/HTML_errors_crash_ie6.html
    
     
    1. <table style="table-layout:fixed;">
    2. <colgroup>
    3. <col width="100"/>Crash IE6
    4. </colgroup>
    5. </table>
    3 crash IE 7 code
    Demo:http://blog.gulu77.com/demo/200808/crash_ie7.html
    Bug from 偷米饭、このbugは、IE 7において、省略ワードの処理時にIE 7が崩壊すると推定されている。
    
     
    1. <style type="text/css">
    2. div{float:left;width:175px;}
    3. ul{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
    4. li{position:relative;}
    5. </style>
    6. <div>
    7. <ul>
    8. <li>崩溃崩溃崩溃崩溃崩溃crash ie7</li>
    9. <li>崩溃崩溃崩溃崩溃崩溃crash ie7</li>
    10. </ul>
    11. </div>
    ソリューション:
  • zoomを追加します。ハスラayoutを触発させる 
    
      
    1. <style type="text/css">
    2. div{float:left;width:175px;}
    3. ul{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
    4. li{position:relative;zoom:1;}
    5. </style>
    4 crash IE 6 code Demo:http://blog.gulu77.com/demo/200808/crash_ie6_test1.html位置を変更すると、ブラウザがクラッシュしますが、N個の共犯者が崩壊するコードの中でCSS tableの位相属性は全部欠けているようです。
    
      
    1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    2.        <html xmlns="http://www.w3.org/1999/xhtml">
    3.        <head>
    4.        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    5.        <title>CRASH-IE,CSS让你的IE浏览器崩溃</title>
    6.      <style type="text/css">
    7.        html, body {overflow: hidden;scrollbar-base-color: #330066;}
    8.        .crash {position:absolute;left:200px;top:200px;width:200px;}
    9.      </style>
    10.      <script type="text/javascript">
    11.        function galgenfrist() {
    12.        window.setTimeout('crashIE();',1000);
    13.        }
    14.  function crashIE() {
    15.        var moveNode = document.getElementById("move");
    16.        if(moveNode) {
    17.        moveNode.style.top = "100px";
    18.        moveNode.style.left = "200px";
    19.        }
    20.        }
    21.      </script>
    22.      </head>
    23. <body onload="galgenfrist();">
    24.      <h1>CRASH-IE</h1>
    25.      <div id="move" class="crash">
    26.      <table>
    27.      <tbody>
    28.      <tr>
    29.      <td>
    30.      <textarea></textarea>
    31.      </td>
    32.      </tr>
    33.      </tbody>
    34.      </table>
    35.      </div>
    36.      </body>
    37. </html>
    5 crash IE 6 code Demo:http://blog.gulu77.com/demo/200808/crash_ie6_test2.html具体的に原因はしばらく解析できませんが、互換性と実行効率から見ると、普通はこのような書き方はしません。
    
      
    1. <script>
    2.      for (x in document.write) {
    3.           document.write(x);}
    4. </script>
    6 crash IE 6 code Demo:http://blog.gulu77.com/demo/200808/crash_ie6_test3.html伝説は日本人が発見したもので、tableに直接内容を置いて、IE 6でMshtml.allモジュールが破損してブラウザを閉じます。IE 6でないと安全です。
    
      
    1. <style>
    2.      * {position:relative}
    3. </style>
    4. <table>
    5.      <input>
    6. </table>
    7 crash IE 6 code Demo:http://blog.gulu77.com/demo/200808/crash_ie6_test4.html
    
      
    1. <body onLoad=”window()>
    8 crassh IE 6 code Demo:http://blog.gulu77.com/demo/200808/crash_ie6_test5.html CSSに@+任意の文字+/*が現れてすぐに崩壊します。
    
      
    1. <style>
    2.      @;/*
    3. </style>