mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:42:45 +00:00 
			
		
		
		
	 ec2b4c271f
			
		
	
	
		ec2b4c271f
		
	
	
	
	
		
			
			We would previously not return a RadioNodeList in the curious case where a named item resolves to two different elements within the form. This was not a problem when calling namedItem directly in the IDL as named_item_or_radio_node_list shadows named_item but is exposed when calling the property through array bracket notation (as an example). Fix this, and add a bunch more tests to cover HTMLFormControlsCollection.
		
			
				
	
	
		
			57 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <form>
 | |
|   <input name="one" id="formcontrol" type="button" />
 | |
|   <input name="two" id="formcontrol" type="text" />
 | |
| </form>
 | |
| <script src="include.js"></script>
 | |
| <script>
 | |
|     function printDescription(name) {
 | |
|         println("-------------------");
 | |
|         println(name);
 | |
|         println("-------------------");
 | |
|     }
 | |
| 
 | |
|     function dumpInput(name, item) {
 | |
|         printDescription(name);
 | |
|         println(item.constructor.name);
 | |
|         println(item.id);
 | |
|         println(item.type);
 | |
|     }
 | |
| 
 | |
|     function dumpRadioNodeList(name, radioNodeList) {
 | |
|         printDescription(name);
 | |
|         println(radioNodeList.constructor.name);
 | |
|         println(radioNodeList.length);
 | |
|         println(radioNodeList[0].type);
 | |
|         println(radioNodeList[1].type);
 | |
|     }
 | |
| 
 | |
|     function dumpNoMatch(name, item) {
 | |
|         printDescription(name);
 | |
|         println(item);
 | |
|     }
 | |
| 
 | |
|     test(() => {
 | |
|         const form = document.forms[0].elements;
 | |
|         println(form.constructor.name);
 | |
|         println(form.length);
 | |
| 
 | |
|         dumpRadioNodeList('form.namedItem("formcontrol")', form.namedItem("formcontrol"))
 | |
|         dumpInput('form.namedItem("one")', form.namedItem("one"));
 | |
|         dumpInput('form.namedItem("two")', form.namedItem("two"));
 | |
|         dumpNoMatch('form.namedItem("nomatch")', form.namedItem("nomatch"));
 | |
| 
 | |
|         dumpRadioNodeList('form["formcontrol"]', form["formcontrol"])
 | |
|         dumpInput('form["one"]', form["one"]);
 | |
|         dumpInput('form["two"]', form["two"]);
 | |
|         dumpNoMatch('form["nomatch"]', form["nomatch"]);
 | |
| 
 | |
|         dumpRadioNodeList('form.formcontrol', form.formcontrol)
 | |
|         dumpInput('form.one', form.one);
 | |
|         dumpInput('form.two', form.two);
 | |
|         dumpNoMatch('form.nomatch', form.nomatch);
 | |
| 
 | |
|         dumpInput('form[0]', form[0]);
 | |
|         dumpInput('form[1]', form[1]);
 | |
|         dumpNoMatch('form[2]', form[2]);
 | |
|     })
 | |
| </script>
 |