Bug 1301024 - Part 1: Set CreateElement/CreateElementNS is attribute. r=smaug
authorJohn Dai <jdai@mozilla.com>
Mon, 25 Sep 2017 01:33:00 -0400
changeset 669894 861b7c93c156abc54546d6a2af547f4847c99d80
parent 669893 ff2d7b9381fa1c3b181bd6609688af663ef59b70
child 669895 a6fdd6eae58340d86c716dca6a0be8aeedfb3573
push id81465
push userbmo:dharvey@mozilla.com
push dateMon, 25 Sep 2017 15:46:49 +0000
reviewerssmaug
bugs1301024
milestone58.0a1
Bug 1301024 - Part 1: Set CreateElement/CreateElementNS is attribute. r=smaug
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -6019,16 +6019,20 @@ nsDocument::CreateElement(const nsAStrin
 
   RefPtr<Element> elem = CreateElem(
     needsLowercase ? lcTagName : aTagName, nullptr, mDefaultElementType, is);
 
   if (pseudoType != CSSPseudoElementType::NotPseudo) {
     elem->SetPseudoElementType(pseudoType);
   }
 
+  if (is) {
+    elem->SetAttr(kNameSpaceID_None, nsGkAtoms::is, *is, true);
+  }
+
   return elem.forget();
 }
 
 NS_IMETHODIMP
 nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
                             const nsAString& aQualifiedName,
                             nsIDOMElement** aReturn)
 {
@@ -6070,16 +6074,20 @@ nsDocument::CreateElementNS(const nsAStr
 
   nsCOMPtr<Element> element;
   rv = NS_NewElement(getter_AddRefs(element), nodeInfo.forget(),
                      NOT_FROM_PARSER, is);
   if (rv.Failed()) {
     return nullptr;
   }
 
+  if (is) {
+    element->SetAttr(kNameSpaceID_None, nsGkAtoms::is, *is, true);
+  }
+
   return element.forget();
 }
 
 NS_IMETHODIMP
 nsDocument::CreateTextNode(const nsAString& aData, nsIDOMText** aReturn)
 {
   *aReturn = nsIDocument::CreateTextNode(aData).take();
   return NS_OK;