Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createElement now sets namespace from contentType #2826

Merged
merged 1 commit into from
Apr 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions dom/nodes/Document-createElement-namespace.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*/

/**
* Test that an element created using the Document object doc has the HTML
* namespace.
* Test that an element created using the Document object doc has the namespace
* that would be expected for the given contentType.
*/
function testDoc(doc, contentType) {
if (doc.contentType !== undefined) {
Expand All @@ -23,7 +23,11 @@
"Wrong MIME type -- incorrect server config?");
}

assert_equals(doc.createElement("x").namespaceURI, "http://www.w3.org/1999/xhtml");
var expectedNamespace = contentType == "text/html" ||
contentType == "application/xhtml+xml"
? "http://www.w3.org/1999/xhtml" : null;

assert_equals(doc.createElement("x").namespaceURI, expectedNamespace);
}

// First test various objects we create in JS
Expand All @@ -39,11 +43,11 @@
}, "Created element's namespace in created XML document");
test(function() {
testDoc(document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null),
"application/xml");
"application/xhtml+xml");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change for createDocument is not in the DOM standard yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, as noted in the commit message. I expect it will be there within a couple of days, and didn't want to bother updating the test twice. If it actually gets rejected, I'll fix the test then.

}, "Created element's namespace in created XHTML document");
test(function() {
testDoc(document.implementation.createDocument("http://www.w3.org/2000/svg", "svg", null),
"application/xml");
"image/svg+xml");
}, "Created element's namespace in created SVG document");
test(function() {
testDoc(document.implementation.createDocument("http://www.w3.org/1998/Math/MathML", "math", null),
Expand Down