| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <p id="description"></p> | 7 <p id="description"></p> |
| 8 <div id="console"></div> | 8 <div id="console"></div> |
| 9 <script> | 9 <script> |
| 10 description("This test checks the form attribute of the form-associated elements
."); | 10 description("This test checks the form attribute of the form-associated elements
."); |
| 11 | 11 |
| 12 var container = document.createElement('div'); | 12 var container = document.createElement('div'); |
| 13 document.body.appendChild(container); | 13 document.body.appendChild(container); |
| 14 | 14 |
| 15 debug('- Checks the existence of the form attribute for each form-associated ele
ments.'); | 15 debug('- Checks the existence of the form attribute for each form-associated ele
ments.'); |
| 16 container.innerHTML = '<form id=owner></form>' + | 16 container.innerHTML = '<form id=owner></form>' + |
| 17 '<button name=victim form=owner />' + | 17 '<button name=victim form=owner />' + |
| 18 '<fieldset name=victim form=owner />' + | 18 '<fieldset name=victim form=owner />' + |
| 19 '<input name=victim form=owner />' + | 19 '<input name=victim form=owner />' + |
| 20 '<keygen name=victim form=owner />' + | |
| 21 '<label name=victim form=owner></label>' + | 20 '<label name=victim form=owner></label>' + |
| 22 '<object name=victim form=owner></object>' + | 21 '<object name=victim form=owner></object>' + |
| 23 '<output name=victim form=owner />' + | 22 '<output name=victim form=owner />' + |
| 24 '<select name=victim form=owner />' + | 23 '<select name=victim form=owner />' + |
| 25 '<textarea name=victim form=owner />'; | 24 '<textarea name=victim form=owner />'; |
| 26 | 25 |
| 27 var owner = document.getElementById('owner'); | 26 var owner = document.getElementById('owner'); |
| 28 shouldBe('document.getElementsByTagName("button")[0].form', 'owner'); | 27 shouldBe('document.getElementsByTagName("button")[0].form', 'owner'); |
| 29 shouldBe('document.getElementsByTagName("fieldset")[0].form', 'owner'); | 28 shouldBe('document.getElementsByTagName("fieldset")[0].form', 'owner'); |
| 30 shouldBe('document.getElementsByTagName("input")[0].form', 'owner'); | 29 shouldBe('document.getElementsByTagName("input")[0].form', 'owner'); |
| 31 shouldBe('document.getElementsByTagName("keygen")[0].form', 'owner'); | |
| 32 shouldBeNull('document.getElementsByTagName("label")[0].form'); | 30 shouldBeNull('document.getElementsByTagName("label")[0].form'); |
| 33 shouldBe('document.getElementsByTagName("object")[0].form', 'owner'); | 31 shouldBe('document.getElementsByTagName("object")[0].form', 'owner'); |
| 34 shouldBe('document.getElementsByTagName("output")[0].form', 'owner'); | 32 shouldBe('document.getElementsByTagName("output")[0].form', 'owner'); |
| 35 shouldBe('document.getElementsByTagName("select")[0].form', 'owner'); | 33 shouldBe('document.getElementsByTagName("select")[0].form', 'owner'); |
| 36 shouldBe('document.getElementsByTagName("textarea")[0].form', 'owner'); | 34 shouldBe('document.getElementsByTagName("textarea")[0].form', 'owner'); |
| 37 | 35 |
| 38 debug(''); | 36 debug(''); |
| 39 debug('- Ensures that the form attribute points the form owner even if the eleme
nt is within another form element.'); | 37 debug('- Ensures that the form attribute points the form owner even if the eleme
nt is within another form element.'); |
| 40 container.innerHTML = '<form id=owner></form>' + | 38 container.innerHTML = '<form id=owner></form>' + |
| 41 '<form id=shouldNotBeOwner>' + | 39 '<form id=shouldNotBeOwner>' + |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 form1 = document.querySelectorAll('form')[0]; | 183 form1 = document.querySelectorAll('form')[0]; |
| 186 form2 = document.querySelectorAll('form')[1]; | 184 form2 = document.querySelectorAll('form')[1]; |
| 187 var control = document.querySelector('select'); | 185 var control = document.querySelector('select'); |
| 188 shouldBe('control.form', 'form1'); | 186 shouldBe('control.form', 'form1'); |
| 189 shouldBe('form1.setAttribute("id", "b"); control.form', 'form2'); | 187 shouldBe('form1.setAttribute("id", "b"); control.form', 'form2'); |
| 190 | 188 |
| 191 container.remove(); | 189 container.remove(); |
| 192 </script> | 190 </script> |
| 193 </body> | 191 </body> |
| 194 </html> | 192 </html> |
| OLD | NEW |