| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-310351.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 310351; |
| 9 |
var summary = 'Convert host "list" objects to arrays'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
printBugNumber(BUGNUMBER); |
| 14 |
printStatus (summary); |
| 15 |
|
| 16 |
var nodeList = []; |
| 17 |
if (typeof document != 'undefined') |
| 18 |
{ |
| 19 |
nodeList = document.getElementsByTagName('*'); |
| 20 |
} |
| 21 |
else |
| 22 |
{ |
| 23 |
printStatus('test using dummy array since no document available'); |
| 24 |
} |
| 25 |
|
| 26 |
var array = Array.prototype.slice.call(nodeList, 0); |
| 27 |
|
| 28 |
expect = 'Array'; |
| 29 |
actual = array.constructor.name; |
| 30 |
|
| 31 |
|
| 32 |
var saveLength = nodeList.length; |
| 33 |
|
| 34 |
reportCompare(expect, actual, summary + ': constructor test'); |
| 35 |
|
| 36 |
expect = saveLength; |
| 37 |
actual = array.length; |
| 38 |
|
| 39 |
reportCompare(expect, actual, summary + ': length test'); |
| 40 |
expect = true; |
| 41 |
actual = true; |
| 42 |
|
| 43 |
for (var i = 0; i < saveLength; i++) |
| 44 |
{ |
| 45 |
if (array[i] != nodeList[i]) |
| 46 |
{ |
| 47 |
actual = false; |
| 48 |
summary += ' Comparison failed: array[' + i + ']=' + array[i] + |
| 49 |
', nodeList[' + i + ']=' + nodeList[i]; |
| 50 |
break; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
reportCompare(expect, actual, summary + ': identical elements test'); |
| 55 |
|