ttwf-cssom-doc-ext-load-tree-order.html (2869B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSSOM - Extensions to the Document Interface: Stylesheet header load order</title> 5 <link rel="author" title="Jesse Bounds" href="mailto:jesse@codeforamerica.org"> 6 <link rel="help" href="http://www.w3.org/TR/cssom-1/#extensions-to-the-document-interface"> 7 <link rel="help" href="http://www.w3.org/TR/cssom-1/#the-stylesheetlist-interface"> 8 <link rel="help" href="http://www.w3.org/TR/cssom-1/#css-style-sheet-collections"> 9 <style title="aaa" type="text/css"> 10 H1 {border-width: 1; border: solid; text-align: center} 11 </style> 12 <link title="zebra" rel="stylesheet" href="zebra.css" type="text/css"> 13 <link title="kilo" rel="stylesheet" href="kilo.css" type="text/css"> 14 <link title="alpha" rel="stylesheet" href="alpha.css" type="text/css"> 15 <link title="zebra" rel="stylesheet" href="/directory01/zebra.css" type="text/css"> 16 <meta name="flags" content="dom"> 17 <meta name="assert" content="Document's style sheets created from HTTP Link headers are first in list and loaded in header order"> 18 <script src="/resources/testharness.js"></script> 19 <script src="/resources/testharnessreport.js"></script> 20 </head> 21 <body> 22 <div id="log"></div> 23 <script> 24 onload = function() { 25 // Get the Document's styleSheets attribute 26 var styleSheets = document.styleSheets; 27 28 // Verify that the styleSheets list length is 5 29 test(function() { 30 assert_equals(styleSheets.length, 5, "styleSheets.length is incorrect:"); 31 }, "styleSheets.length must be 5"); 32 33 // Verify that titles of loaded sheets are as expected (in the correct order) 34 test(function() { 35 assert_equals(styleSheets.item(0).title, "aaa", "title for item 1 is incorrect:"); 36 }, "styleSheets item 0 title must be aaa"); 37 // Verify that titles of loaded sheets are as expected (in the correct order) 38 test(function() { 39 assert_equals(styleSheets.item(1).title, "zebra", "title for item 1 is incorrect:"); 40 }, "styleSheets item 1 title must be zebra"); 41 // Verify that titles of loaded sheets are as expected (in the correct order) 42 test(function() { 43 assert_equals(styleSheets.item(2).title, "kilo", "title for item 1 is incorrect:"); 44 }, "styleSheets item 0 title must be kilo"); 45 // Verify that titles of loaded sheets are as expected (in the correct order) 46 test(function() { 47 assert_equals(styleSheets.item(3).title, "alpha", "title for item 1 is incorrect:"); 48 }, "styleSheets item 0 title must be alpha"); 49 // Verify that titles of loaded sheets are as expected (in the correct order) 50 test(function() { 51 assert_equals(styleSheets.item(4).title, "zebra", "title for item 1 is incorrect:"); 52 }, "styleSheets item 0 title must be zebra"); 53 }; 54 </script> 55 </body> 56 </html>