createElement should not lowercase non-ASCII characters
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jan 2016 06:12:56 +0000 (06:12 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jan 2016 06:12:56 +0000 (06:12 +0000)
commit4fcf17cf6f23cf3f44599f73535024c2ec96df1c
treecd7a75f5323972729c745d422bf666c5a7f81e78
parent2071f716042bae98ebdcd471c2008f6c4e605f56
createElement should not lowercase non-ASCII characters
https://bugs.webkit.org/show_bug.cgi?id=153114

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaselined the tests for document.createElement now that more test cases are passing.

* web-platform-tests/dom/nodes/Document-createElement-expected.txt:
* web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt:
* web-platform-tests/dom/nodes/Element-getElementsByTagName-expected.txt:
* web-platform-tests/dom/nodes/case-expected.txt:

Source/WebCore:

According to step 2 in https://dom.spec.whatwg.org/#dom-document-createelement, document.createElement should not
lowercase non-ASCII letters, and this is also what Firefox does. Match that behavior by lowercasing the tag name
by convertToASCIILowercase() instead of lower() in createElement.

Also merged HTMLDocument::createElement into Document::createElement for simplicity and avoid duplicating
the call to isValidName and setting a DOM exception.

No new tests since the behavior change is covered by the existing W3C tests.

* dom/Document.cpp:
(WebCore::Document::createElement): Create a HTML element with ASCII-lowercased tag name inside a HTML document.
* dom/Document.h:
* html/HTMLDocument.cpp:
(WebCore::addLocalNameToSet):
(WebCore::HTMLDocument::createElement): Merged into Document::createElement.
* html/HTMLDocument.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createElement-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-getElementsByTagName-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/case-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLDocument.cpp
Source/WebCore/html/HTMLDocument.h