Reputation: 2343
When writing a javascript function to be executed in IE I can write something like
var myObj = document.getElementByID('myTable');
var firstRow = myObj.rows[0];
var allRowObjects = firstRow.all;
Outside of IE the ".all" won't be recognized so when running in other browsers I would run into a problem. I found reference to the querySelectorAll("*") function and that appears to be the environment safe way to get the same node list but is this what ".all" is doing? Is there a different analog that I should be using instead and where can I find documentation on "all"?
Upvotes: 1
Views: 112
Reputation: 207983
Microsoft actually admits that .all
isn't part of any standard, is no longer supported beginning with IE 11, and suggests that you use getElementById
instead.
The all collection includes one element object for each valid HTML tag. If a valid tag has a matching end tag, both tags are represented by the same element object.
The collection returned by the document's all collection always includes a reference to the HTML, HEAD, and TITLE objects regardless of whether the tags are present in the document.
If the BODY tag is not present, but other HTML tags are, a BODY object is added to the all collection. If the document contains invalid or unknown tags, the collection includes one element object for each. Unlike valid end tags, unknown end tags are represented by their own element objects. The order of the element objects is the HTML source order. Although the collection indicates the order of tags, it does not indicate hierarchy.
The name property only applies to some elements such as form elements. If the vIndex is set to a string matching the value of a name property in an element that the name property does not apply, then that element will not be added to the collection.
Upvotes: 2