OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../js/resources/js-test-pre.js"></script> |
| 4 </head> |
| 5 <body> |
| 6 <p id="description"></p> |
| 7 <div id="console"></div> |
| 8 <script> |
| 9 description("Test the parsing of the cursor property in quirks mode."); |
| 10 function makeCursorRule(rule) |
| 11 { |
| 12 return "cursor: " + rule + ";"; |
| 13 } |
| 14 |
| 15 function testCursorRule(rule, expected) |
| 16 { |
| 17 var cssText = makeCursorRule(rule); |
| 18 if (typeof expected == 'undefined') |
| 19 expected = cssText; |
| 20 else |
| 21 expected = makeCursorRule(expected); |
| 22 shouldBeEqualToString('roundtripCssRule("' + cssText + '")', expected); |
| 23 } |
| 24 |
| 25 function testInvalidCursorRule(rule) |
| 26 { |
| 27 shouldBeEqualToString('roundtripCssRule("' + makeCursorRule(rule) + '")', ''
); |
| 28 } |
| 29 |
| 30 function roundtripCssRule(cssText) |
| 31 { |
| 32 var div = document.createElement("div"); |
| 33 div.setAttribute("style", cssText); |
| 34 document.body.appendChild(div); |
| 35 var result = div.style.cssText; |
| 36 document.body.removeChild(div); |
| 37 return result; |
| 38 } |
| 39 |
| 40 debug('Test cursor rules which should accept \'hand\' as an alias of \'pointer\'
.'); |
| 41 testCursorRule('hand', 'pointer'); |
| 42 testCursorRule('url(file:///foo.png), hand', 'url(file:///foo.png), pointer'); |
| 43 |
| 44 debug(''); |
| 45 debug('Test invalid cursor rules which shouldn\'t parse at all.'); |
| 46 testInvalidCursorRule('url(file:///foo.png), url(file:///foo2.png)'); |
| 47 |
| 48 successfullyParsed = true; |
| 49 </script> |
| 50 <script src="../js/resources/js-test-post.js"></script> |
| 51 </body> |
| 52 </html> |
OLD | NEW |