Opened 12 years ago
Closed 12 years ago
#9799 closed defect (duplicate)
Firefox 3.5 changes some NodeList functionality
Reported by: | Phil DeJarnett | Owned by: | anonymous |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Core | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
This might not be classified as a bug, but it seems like it. In Firefox < 3.5, a NodeList? returned from dojo.query() had all of the functions associated with a normal array, including Array.push, pop, shift, and unshift.
In FF 3.5, this appears have changed. Now a NodeList? can still be read like an Array, but you can no longer modify its contents. Since length is read-only, you can't even hack the change in.
(I had used this on a website that needed to manipulate a set of links, one of which was in a different location. I simply pushed the odd one into the first query's NodeList?.)
Example:
var nodes = dojo.query('a'); var other_nodes = dojo.query('p'); nodes.push(other_nodes[0]); // error occurs here
This wouldn't bother me except it works in every other browser I checked, including IE 6, 7 and 8; Opera 9; and Safari 4. I'm guessing FF 3.5 is now using some internal NodeList? method that is returning a specialized array.
If nothing else, a note might need to be made in the docs about this.
see #9499