OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <meta charset=utf-8> |
| 3 <title>HTMLOptionElement.text</title> |
| 4 <link rel=author title=Ms2ger href="mailto:Ms2ger@gmail.com"> |
| 5 <link rel=help href="https://html.spec.whatwg.org/multipage/#dom-option-text"> |
| 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 option = document.createElement("option"); |
| 12 option.appendChild(document.createElement("font")) |
| 13 .appendChild(document.createTextNode(" font ")); |
| 14 assert_equals(option.text, "font"); |
| 15 }, "option.text should recurse"); |
| 16 |
| 17 test(function() { |
| 18 var option = document.createElement("option"); |
| 19 option.appendChild(document.createTextNode(" before ")); |
| 20 option.appendChild(document.createElement("script")) |
| 21 .appendChild(document.createTextNode(" script ")); |
| 22 option.appendChild(document.createTextNode(" after ")); |
| 23 assert_equals(option.text, "before after"); |
| 24 }, "option.text should not recurse into HTML script elements"); |
| 25 test(function() { |
| 26 var option = document.createElement("option"); |
| 27 option.appendChild(document.createTextNode(" before ")); |
| 28 option.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "scr
ipt")) |
| 29 .appendChild(document.createTextNode(" script ")); |
| 30 option.appendChild(document.createTextNode(" after ")); |
| 31 assert_equals(option.text, "before after"); |
| 32 }, "option.text should not recurse into SVG script elements"); |
| 33 test(function() { |
| 34 var option = document.createElement("option"); |
| 35 option.appendChild(document.createTextNode(" before ")); |
| 36 option.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathM
L", "script")) |
| 37 .appendChild(document.createTextNode(" script ")); |
| 38 option.appendChild(document.createTextNode(" after ")); |
| 39 assert_equals(option.text, "before script after"); |
| 40 }, "option.text should recurse into MathML script elements"); |
| 41 test(function() { |
| 42 var option = document.createElement("option"); |
| 43 option.appendChild(document.createTextNode(" before ")); |
| 44 option.appendChild(document.createElementNS(null, "script")) |
| 45 .appendChild(document.createTextNode(" script ")); |
| 46 option.appendChild(document.createTextNode(" after ")); |
| 47 assert_equals(option.text, "before script after"); |
| 48 }, "option.text should recurse into null script elements"); |
| 49 test(function() { |
| 50 var option = document.createElement("option"); |
| 51 var span = option.appendChild(document.createElement("span")); |
| 52 span.appendChild(document.createTextNode(" Some ")); |
| 53 span.appendChild(document.createElement("script")) |
| 54 .appendChild(document.createTextNode(" script ")); |
| 55 option.appendChild(document.createTextNode(" Text ")); |
| 56 assert_equals(option.text, "Some Text"); |
| 57 }, "option.text should work if a child of the option ends with a script"); |
| 58 |
| 59 test(function() { |
| 60 var script = document.createElement("script"); |
| 61 var option = script.appendChild(document.createElement("option")); |
| 62 option.appendChild(document.createTextNode("text")); |
| 63 assert_equals(option.text, "text"); |
| 64 }, "option.text should work if the option is in an HTML script element"); |
| 65 test(function() { |
| 66 var script = document.createElementNS("http://www.w3.org/2000/svg", "script"); |
| 67 var option = script.appendChild(document.createElement("option")); |
| 68 option.appendChild(document.createTextNode("text")); |
| 69 assert_equals(option.text, "text"); |
| 70 }, "option.text should work if the option is in an SVG script element"); |
| 71 test(function() { |
| 72 var script = document.createElementNS("http://www.w3.org/1998/Math/MathML", "s
cript"); |
| 73 var option = script.appendChild(document.createElement("option")); |
| 74 option.appendChild(document.createTextNode("text")); |
| 75 assert_equals(option.text, "text"); |
| 76 }, "option.text should work if the option is in a MathML script element"); |
| 77 </script> |
OLD | NEW |