script-IDL-event-htmlfor.html (2121B)
1 <!DOCTYPE html> 2 <title>event and htmlFor IDL attributes of HTMLScriptElement</title> 3 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-script-event"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-script-htmlfor"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <div id="log"></div> 9 <script> 10 test(function() { 11 var script = document.createElement("script"); 12 assert_equals(script.event, ""); 13 assert_equals(script.htmlFor, ""); 14 }) 15 test(function() { 16 var script = document.createElement("script"); 17 script.setAttribute("event", "blah"); 18 script.setAttribute("for", "blah"); 19 assert_equals(script.event, "blah"); 20 assert_equals(script.htmlFor, "blah"); 21 assert_equals(script.getAttribute("event"), "blah"); 22 assert_equals(script.getAttribute("for"), "blah"); 23 }) 24 test(function() { 25 var script = document.createElement("script"); 26 script.setAttribute("event", "blah"); 27 script.setAttribute("for", "blah"); 28 script.event = "foo"; 29 script.htmlFor = "foo"; 30 assert_equals(script.event, "foo"); 31 assert_equals(script.htmlFor, "foo"); 32 assert_equals(script.getAttribute("event"), "foo"); 33 assert_equals(script.getAttribute("for"), "foo"); 34 }) 35 test(function() { 36 var script = document.createElement("script"); 37 script.setAttribute("event", "blah"); 38 script.setAttribute("for", "blah"); 39 script.event = null; 40 script.htmlFor = null; 41 assert_equals(script.event, "null"); 42 assert_equals(script.htmlFor, "null"); 43 assert_equals(script.getAttribute("event"), "null"); 44 assert_equals(script.getAttribute("for"), "null"); 45 }) 46 test(function() { 47 var script = document.createElement("script"); 48 script.setAttribute("event", "blah"); 49 script.setAttribute("for", "blah"); 50 script.event = undefined; 51 script.htmlFor = undefined; 52 assert_equals(script.event, "undefined"); 53 assert_equals(script.htmlFor, "undefined"); 54 assert_equals(script.getAttribute("event"), "undefined"); 55 assert_equals(script.getAttribute("for"), "undefined"); 56 }) 57 </script>