test_bug437915.html (1814B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=437915 5 --> 6 <head> 7 <title>Test for Bug 437915</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 <style type="text/css"> 11 12 div.classvalue { text-decoration: underline; } 13 div[title~="titlevalue"] { visibility: hidden; } 14 15 </style> 16 </head> 17 <body> 18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=437915">Mozilla Bug 437915</a> 19 <p id="display"></p> 20 <div id="content" style="display: none"> 21 22 </div> 23 <pre id="test"> 24 <script class="testbody" type="text/javascript"> 25 26 /** Test for Bug 437915 */ 27 28 var div = document.getElementById("content"); 29 var cs = document.defaultView.getComputedStyle(div); 30 31 var chars = { 32 0x09: true, // tab 33 0x0a: true, // newline 34 0x0b: false, // vertical tab (MAY CHANGE IN FUTURE!) 35 0x0c: true, // form feed 36 0x0d: true, // carriage return 37 0x0e: false, 38 0x20: true, // space 39 0x2003: false, 40 0x200b: false, 41 0x2028: false, 42 0x2029: false, 43 0x3000: false 44 }; 45 46 var wsmap = { 47 false: { str: " NOT", "text-decoration-line": "none", "visibility": "visible" }, 48 true: { str: "", "text-decoration-line": "underline", "visibility": "hidden" } 49 }; 50 51 for (var char in chars) { 52 var is_whitespace = chars[char]; 53 var mapent = wsmap[is_whitespace]; 54 div.setAttribute("class", "classvalue" + String.fromCharCode(char) + "b") 55 div.setAttribute("title", "a" + String.fromCharCode(char) + "titlevalue") 56 for (var prop of ["text-decoration-line", "visibility"]) { 57 is(cs.getPropertyValue(prop), mapent[prop], 58 "Character " + char + " should" + mapent.str + 59 " be treated as whitespace (" 60 + prop + " should be " + mapent[prop] + ")"); 61 } 62 } 63 64 65 66 </script> 67 </pre> 68 </body> 69 </html>