Ticket #1958: ie 30 style tags then die.html

File ie 30 style tags then die.html, 1.5 kB (added by morris, 2 years ago)

Test file showing use of import stylesheets

Line 
1<html><head>
2
3<script>
4var iCount = 0;
5
6function fnCreate32StyleSheets()
7{
8  for (i=0 ; i < 32; i++)
9  {
10//    document.createStyleSheet()
11        var head = document.getElementsByTagName("head")[0];
12        var style = document.createElement("style");
13        var div = document.createElement("div");
14        style.setAttribute("type", "text/css");
15//      head.appendChild(div);
16        document.body.appendChild(style);
17        style.styleSheet.cssText = '.button {color:red}';
18
19    StyleSheetCount.innerText = "Total Style Sheets = " + ++iCount
20  }
21}
22
23function fnAdd1Import()
24{
25        var ss = document.createStyleSheet();
26//      for (i=0 ; i < 33; i++) {
27                ss.addImport();
28                ss.imports[0].addImport();
29                ss.imports[0].imports[0].cssText = 'button {color:blue}';
30//              StyleSheetCount.innerText = "Total Style Sheets = " + i
31//      }
32        //alert(ss.imports.length);
33}
34
35
36function fnAddManyImport()
37{
38        try {
39                var ss = document.createStyleSheet();
40                try {
41                        fnCreateStyleSheets();
42                } catch (e) {
43                }
44                for (i=0 ; i < 33; i++) {
45                        ss.addImport();
46                        ss.imports[0].cssText = 'button {color:yellow}';
47                        StyleSheetCount.innerText = "Total Style Sheets = " + ++iCount
48                }
49        } finally {
50                alert(document.stylesheets.length + ss.imports.length);
51        }
52}
53
54
55</script>
56
57</head><body>
58
59<button onclick="fnCreate32StyleSheets()">fnCreate32StyleSheets</button>
60<div id="StyleSheetCount"></div>
61<button onclick="fnAdd1Import()">fnAdd1Import</button><br>
62<button onclick="fnAddManyImport()">fnAddManyImport</button>
63
64
65</body></html>
66