Value returned for missing DOMStringList properties
Sylvain Pasche <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
Hi, DOMStringList is currently returning null when calling item() with properties that don't exist, and the empty string when getting a missing indexed property. Here's an example with a document that has less than 100 style sheet sets: document.styleSheetSets.item(100) -> null document.styleSheetSets[100] -> "" Apparently, the behavior when getting missing indexed properties isn't specified in the DOM Level 3 Core specification yet [1]. Do you think it would be better to return undefined for the document.styleSheetSets[100] case? That would be more consistent with other array like dom properties: document.body.childNodes.item(100) -> null document.body.childNodes[100] -> undefined (I'm asking because I'm currently extending nsStringArraySH for the DOMTokenList implementation so I'm getting the DOMStringList behavior, while the spec currently requires something more like what element.childNodes does [2]). I don't think other browsers are implementing DOMStringList, so I couldn't compare what they are doing in that case. Sylvain [1] http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMStringList [2] https://bugzilla.mozilla.org/show_bug.cgi?id=501257#c6