| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <body> | 2 <body> |
| 3 <form> | 3 <form> |
| 4 <input name="radios" type="radio"> | 4 <input name="radios" type="radio"> |
| 5 <input name="radios" type="radio"> | 5 <input name="radios" type="radio"> |
| 6 </form> | 6 </form> |
| 7 <script src="../../../resources/js-test.js"></script> | 7 <script src="../../../resources/js-test.js"></script> |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 var nodeListKind = { | 10 var nodeListKind = { |
| 11 ChildNodeListType: 'document.body.childNodes', | 11 ChildNodeListType: 'document.body.childNodes', |
| 12 ClassNodeListType: 'document.getElementsByClassName("class")', | 12 ClassNodeListType: 'document.getElementsByClassName("class")', |
| 13 NameNodeListType: 'document.getElementsByName("name")', | 13 NameNodeListType: 'document.getElementsByName("name")', |
| 14 TagNodeListType: 'document.getElementsByTagName("body")', | 14 TagNodeListType: 'document.getElementsByTagName("body")', |
| 15 RadioNodeListType: 'document.querySelector("form").elements["radios"]', | 15 RadioNodeListType: 'document.querySelector("form").elements["radios"]', |
| 16 LabelsNodeListType: 'document.querySelector("input").labels', | 16 LabelsNodeListType: 'document.querySelector("input").labels', |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 var i = 1; | 19 var i = 1; |
| 20 for (var kind in nodeListKind) { | 20 for (var kind in nodeListKind) { |
| 21 var code = nodeListKind[kind]; | 21 var code = nodeListKind[kind]; |
| 22 eval(code).customProperty = i; | 22 // Do initialization work in an inner function to avoid references to |
| 23 // objects remaining live on this function's stack frame |
| 24 // (http://crbug.com/595672/). |
| 25 (() => {eval(code).customProperty = i})(); |
| 23 gc(); | 26 gc(); |
| 24 shouldBe(code + '.customProperty', '' + i++); | 27 shouldBe(code + '.customProperty', '' + i++); |
| 25 } | 28 } |
| 26 | 29 |
| 27 </script> | 30 </script> |
| 28 </body> | 31 </body> |
| OLD | NEW |