Bug 1264323 - Set namespace when DOMParser.parseFromString(application/xhtml+xml). r=smaug
☠☠ backed out by 9d17de23a08c ☠ ☠
authorJohn Dai <jdai@mozilla.com>
Thu, 30 Jun 2016 03:58:00 +0200
changeset 383195 b97c6b960d85c9b02c821ab87944a652d75174b8
parent 383194 38eebb8512cf9ad3f151b3554d6c9db2c5bc9597
child 383196 444a4a7233f776cea47f2a9eabe6a7f301de4b51
push id21963
push userdmitchell@mozilla.com
push dateFri, 01 Jul 2016 19:54:18 +0000
reviewerssmaug
bugs1264323
milestone50.0a1
Bug 1264323 - Set namespace when DOMParser.parseFromString(application/xhtml+xml). r=smaug
dom/base/nsDocument.cpp
testing/web-platform/meta/dom/nodes/Document-createElement-namespace.html.ini
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -13370,16 +13370,21 @@ void
 nsIDocument::SetCachedEncoder(already_AddRefed<nsIDocumentEncoder> aEncoder)
 {
   mCachedEncoder = aEncoder;
 }
 
 void
 nsIDocument::SetContentTypeInternal(const nsACString& aType)
 {
+  if (!IsHTMLOrXHTML() && mDefaultElementType == kNameSpaceID_None &&
+      aType.EqualsLiteral("application/xhtml+xml")) {
+    mDefaultElementType = kNameSpaceID_XHTML;
+  }
+
   mCachedEncoder = nullptr;
   mContentType = aType;
 }
 
 nsILoadContext*
 nsIDocument::GetLoadContext() const
 {
   return mDocumentContainer;
--- a/testing/web-platform/meta/dom/nodes/Document-createElement-namespace.html.ini
+++ b/testing/web-platform/meta/dom/nodes/Document-createElement-namespace.html.ini
@@ -1,11 +1,8 @@
 [Document-createElement-namespace.html]
   type: testharness
   [Created element's namespace in created XHTML document]
     expected: FAIL
 
   [Created element's namespace in created SVG document]
     expected: FAIL
 
-  [Created element's namespace in created XHTML document by DOMParser ('application/xhtml+xml')]
-    expected: FAIL
-