diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index ea3e336c4dc..11971f24ff3 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -4351,7 +4351,18 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI, nsIDOMElement** aReturn) { *aReturn = nsnull; + nsCOMPtr content; + nsresult rv = CreateElementNS(aNamespaceURI, aQualifiedName, + getter_AddRefs(content)); + NS_ENSURE_SUCCESS(rv, rv); + return CallQueryInterface(content, aReturn); +} +nsresult +nsDocument::CreateElementNS(const nsAString& aNamespaceURI, + const nsAString& aQualifiedName, + nsIContent** aReturn) +{ nsCOMPtr nodeInfo; nsresult rv = nsContentUtils::GetNodeInfoFromQName(aNamespaceURI, aQualifiedName, @@ -4359,13 +4370,9 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI, getter_AddRefs(nodeInfo)); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr content; PRInt32 ns = nodeInfo->NamespaceID(); - rv = NS_NewElement(getter_AddRefs(content), ns, nodeInfo.forget(), - NOT_FROM_PARSER); - NS_ENSURE_SUCCESS(rv, rv); - - return CallQueryInterface(content, aReturn); + return NS_NewElement(aReturn, nodeInfo->NamespaceID(), + nodeInfo.forget(), NOT_FROM_PARSER); } NS_IMETHODIMP diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 1b32b05f923..b1ef72f46ae 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -859,6 +859,9 @@ public: nsresult CreateElement(const nsAString& aTagName, nsIContent** aReturn); + nsresult CreateElementNS(const nsAString& aNamespaceURI, + const nsAString& aQualifiedName, + nsIContent** aReturn); nsresult CreateTextNode(const nsAString& aData, nsIContent** aReturn); diff --git a/js/src/xpconnect/src/dom_quickstubs.qsconf b/js/src/xpconnect/src/dom_quickstubs.qsconf index 7a7c0fd879c..9764fc34a9c 100644 --- a/js/src/xpconnect/src/dom_quickstubs.qsconf +++ b/js/src/xpconnect/src/dom_quickstubs.qsconf @@ -103,6 +103,7 @@ members = [ 'nsIDOMDocument.getElementById', 'nsIDOMDocument.createDocumentFragment', 'nsIDOMDocument.createElement', + 'nsIDOMDocument.createElementNS', 'nsIDOMDocument.importNode', 'nsIDOMDocument.createTextNode', 'nsIDOMElement.removeAttributeNS', @@ -909,6 +910,11 @@ customMethodCalls = { 'code': ' nsCOMPtr result;\n' ' rv = self->CreateElement(arg0, getter_AddRefs(result));' }, + 'nsIDOMDocument_CreateElementNS': { + 'thisType': 'nsDocument', + 'code': ' nsCOMPtr result;\n' + ' rv = self->CreateElementNS(arg0, arg1, getter_AddRefs(result));' + }, 'nsIDOMDocument_CreateTextNode': { 'thisType': 'nsDocument', 'code': ' nsCOMPtr result;\n'