haikuwebkit/LayoutTests/svg/dom/getElementsByTagName-localN...

34 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

getElementsByTagName unable to find SVG camelCase elements imported into HTML https://bugs.webkit.org/show_bug.cgi?id=46800 Reviewed by Nikolas Zimmermann. Source/WebCore: Implement getElementsByTagName according to the algorithm in http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-getelementsbytagname. If the owner document of the element is html, the new class HTMLTagNodeList deals with finding the match(es) based on this algorithm. If the owner document is non HTML, the existing TagNodeList is used. Implement getElementsByTagNameNS according to the algorithm in http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-getelementsbytagnamens. The existing TagNodeList implements this algorithm. Cached results may have less hits after this change. Tag names that are equal when case insensitive but different when case sensitive can't share the result due to above algorithms, i.e. they would match differently in the non html part of the document. Tests: fast/dom/getElementsByTagName-localName-matching.html fast/dom/getElementsByTagName-localName-matching2.xhtml svg/dom/getElementsByTagName-localName-matching.html * dom/Node.cpp: (WebCore::Node::getElementsByTagName): create TagNodeList depending on owner document type. (WebCore::Node::getElementsByTagNameNS): do not lowercase localName for html. * dom/TagNodeList.cpp: (WebCore::HTMLTagNodeList::HTMLTagNodeList): add specialized TagNodeList for html matching rules. (WebCore): (WebCore::HTMLTagNodeList::nodeMatches): * dom/TagNodeList.h: (TagNodeList): (HTMLTagNodeList): (WebCore::HTMLTagNodeList::create): LayoutTests: Add tests for getElementsByTagName(NS) in html, xhtml, and svg documents. * fast/dom/getElementsByTagName-localName-matching-expected.txt: Added. * fast/dom/getElementsByTagName-localName-matching.html: Added. * fast/dom/getElementsByTagName-localName-matching2-expected.txt: Added. * fast/dom/getElementsByTagName-localName-matching2.xhtml: Added. * svg/dom/getElementsByTagName-localName-matching-expected.txt: Added. * svg/dom/getElementsByTagName-localName-matching.html: Added. * svg/dom/script-tests/getElementsByTagName-localName-matching.js: Added. Canonical link: https://commits.webkit.org/101019@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@113710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-04-10 12:34:25 +00:00
This test checks the behaviour of getElementsByTagName in a non-HTML document
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS container.getElementsByTagName('linearGradient').length is 1
PASS container.getElementsByTagName('lineargradient').length is 0
PASS container.getElementsByTagName('LINEARGRADIENT').length is 0
PASS container.getElementsByTagName('FOO').length is 1
PASS container.getElementsByTagName('foo').length is 1
PASS container.getElementsByTagName('Foo').length is 0
PASS container.getElementsByTagName('img').length is 1
PASS container.getElementsByTagName('IMG').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'linearGradient').length is 1
PASS container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'lineargradient').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'LINEARGRADIENT').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'FOO').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'foo').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'Foo').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'img').length is 1
PASS container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'IMG').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'linearGradient').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'lineargradient').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'LINEARGRADIENT').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'FOO').length is 1
PASS container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'foo').length is 1
PASS container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'Foo').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'img').length is 0
PASS container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'IMG').length is 0
PASS successfullyParsed is true
TEST COMPLETE