Re: [DOMCore] getElementsByTagName() bug?

On 07/06/2011 11:37 PM, David Flanagan wrote:
> DOMCore defines getElementsByTagName() like this:
>
>> The |getElementsByTagName(localName)| method must run these steps:
>>
>> 1.
>>
>> If localName is "|*|" (U+002A), return a |NodeList
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#nodelist>|
>> rooted at the context object
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#context-object>,
>>
>> whose filter matches only |Element
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>|
>> nodes.
>>
>>
>> 2.
>>
>> Otherwise, if the context object
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#context-object>
>> is an HTML document
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#html-document>,
>> return a |NodeList
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#nodelist>|
>> rooted at the context object
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#context-object>,
>>
>> whose filter matches only the following nodes:
>>
>> * |Element
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>|
>> nodes in the HTML namespace
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#html-namespace>
>> whose local name
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-local-name>
>>
>> is localName converted to ASCII lowercase
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#converted-to-ascii-lowercase>.
>>
>>
>> * |Element
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element>|
>> nodes, /not/ in the HTML namespace
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#html-namespace>,
>>
>> whose local name
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-local-name>
>>
>> is localName.
>> 3.
>>
>> Otherwise, return a |NodeList
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#nodelist>|
>> rooted at the context object
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#context-object>,
>>
>> whose filter matches only elements
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element>
>>
>> whose local name
>> <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-local-name>
>>
>> is localName.
>>
> That is, it filters elements based on their local name without any
> namespace prefix. But this is inconsistent with the Element.tagName
> attribute, which returns the qualified name of the element, including
> the namespace prefix.
>
> Also, it is not consistent with Firefox's behavior (I didn't test other
> browsers) or with lines 28-32 of ms2ger's test case:
> https://dvcs.w3.org/hg/webapps/file/2de86e9886ef/DOMCore/tests/submissions/Ms2ger/Document-getElementsByTagName.html
>
>
> (On the other hand, line 35 and 36 of the same test case don't seem to
> be consistent with the spec as it stands or with Firefox, so the test
> case might be in error here.)

This is indeed intentional, and matches non-Gecko browsers. I fixed the 
test: <http://dvcs.w3.org/hg/webapps/rev/a88b5a758f9a>. The Mozilla bug 
is <https://bugzilla.mozilla.org/show_bug.cgi?id=492933>.

HTH
Ms2ger

Received on Thursday, 7 July 2011 10:32:11 UTC