test_input_range_attr_order.html (1440B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=841941 5 --> 6 <head> 7 <title>Test @min/@max/@step order for range</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <meta charset="UTF-8"> 12 </head> 13 <body> 14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=841941">Mozilla Bug 841941</a> 15 <p id="display"></p> 16 <div id="content"> 17 <input type=range value=2 max=1.5 step=0.5> 18 <input type=range value=2 step=0.5 max=1.5> 19 <input type=range value=2 max=1.5 step=0.5> 20 <input type=range value=2 step=0.5 max=1.5> 21 </div> 22 <pre id="test"> 23 <script type="application/javascript"> 24 25 /** 26 * Test for Bug 841941 27 * This test checks that the order in which @min/@max/@step are specified in 28 * markup makes no difference to the value that <input type=range> will be 29 * given. Basically this checks that sanitization of the value does not occur 30 * until after the parser has finished with the element. 31 */ 32 SimpleTest.waitForExplicitFinish(); 33 SimpleTest.waitForFocus(function() { 34 test(); 35 SimpleTest.finish(); 36 }); 37 38 function test() { 39 var ranges = document.querySelectorAll("input[type=range]"); 40 for (var i = 0; i < ranges.length; i++) { 41 is(ranges.item(i).value, "1.5", "Check sanitization order for range " + i); 42 } 43 } 44 45 </script> 46 </pre> 47 </body> 48 </html>