From 529d13327c2885e1e072e4409d541e921c730215 Mon Sep 17 00:00:00 2001 From: John Dai Date: Thu, 30 Jun 2016 03:58:00 +0200 Subject: [PATCH] Bug 1264323 - Set namespace when DOMParser.parseFromString(application/xhtml+xml). r=smaug --- dom/base/nsDocument.cpp | 5 +++++ .../meta/dom/nodes/Document-createElement-namespace.html.ini | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 8fd128f14382..579b1d36c186 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -13375,6 +13375,11 @@ nsIDocument::SetCachedEncoder(already_AddRefed aEncoder) void nsIDocument::SetContentTypeInternal(const nsACString& aType) { + if (!IsHTMLOrXHTML() && mDefaultElementType == kNameSpaceID_None && + aType.EqualsLiteral("application/xhtml+xml")) { + mDefaultElementType = kNameSpaceID_XHTML; + } + mCachedEncoder = nullptr; mContentType = aType; } diff --git a/testing/web-platform/meta/dom/nodes/Document-createElement-namespace.html.ini b/testing/web-platform/meta/dom/nodes/Document-createElement-namespace.html.ini index 56fb9833c62b..7cf1442b932e 100644 --- a/testing/web-platform/meta/dom/nodes/Document-createElement-namespace.html.ini +++ b/testing/web-platform/meta/dom/nodes/Document-createElement-namespace.html.ini @@ -6,6 +6,3 @@ [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 -