mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Checking in temporary code that lets a user turn on the new DOM Level 2 behavior by setting the 'temp.DOMLevel2update.enabled' preference to true, this is to help with the general DOM update, and it's part of the fix needed for bug 33474. r=vidur@netscape.com, a=pdt@netscape.com
This commit is contained in:
parent
037a8366a7
commit
8b0e02f751
@ -69,6 +69,12 @@
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPref.h" // Used by the temp pref, should be removed!
|
||||
static PRBool kStrictDOMLevel2 = PR_FALSE;
|
||||
|
||||
|
||||
NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||
NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
|
||||
NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
|
||||
@ -381,6 +387,20 @@ nsGenericElement::nsGenericElement() : mContent(nsnull), mDocument(nsnull),
|
||||
mParent(nsnull), mNodeInfo(nsnull),
|
||||
mDOMSlots(nsnull), mContentID(0)
|
||||
{
|
||||
static PRInt32 been_here = 0;
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
if (!been_here) {
|
||||
kStrictDOMLevel2 = PR_FALSE; // Default in case of failure
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
been_here = 1;
|
||||
}
|
||||
// End of temp hack.
|
||||
|
||||
}
|
||||
|
||||
nsGenericElement::~nsGenericElement()
|
||||
@ -708,6 +728,17 @@ nsresult
|
||||
nsGenericElement::SetAttribute(const nsString& aName,
|
||||
const nsString& aValue)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: SetAttribute(\"%s\") called, use SetAttributeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag(dont_AddRef(NS_NewAtom(aName)));
|
||||
return mContent->SetAttribute(kNameSpaceID_None, tag, aValue, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
nsresult result = NS_OK;
|
||||
@ -725,6 +756,17 @@ nsGenericElement::SetAttribute(const nsString& aName,
|
||||
nsresult
|
||||
nsGenericElement::RemoveAttribute(const nsString& aName)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: RemoveAttribute(\"%s\") called, use RemoveAttributeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag(dont_AddRef(NS_NewAtom(aName)));
|
||||
return mContent->UnsetAttribute(kNameSpaceID_None, tag, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
nsresult result = NS_OK;
|
||||
@ -827,11 +869,22 @@ nsGenericElement::GetElementsByTagName(const nsString& aTagname,
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceId;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = mContent->ParseAttributeString(aTagname, nameAtom,
|
||||
nameSpaceId);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aTagname.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aTagname);
|
||||
printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nameAtom = NS_NewAtom(aTagname);
|
||||
nameSpaceId = kNameSpaceID_Unknown;
|
||||
} else {
|
||||
result = mContent->ParseAttributeString(aTagname, nameAtom,
|
||||
nameSpaceId);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
nsContentList* list = new nsContentList(mDocument,
|
||||
@ -950,6 +1003,27 @@ nsresult
|
||||
nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
|
||||
nsIDOMAttr** aReturn)
|
||||
{
|
||||
if ((nsnull == aReturn) || (nsnull == aNewAttr)) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIDOMNamedNodeMap* map;
|
||||
nsresult result = GetAttributes(&map);
|
||||
|
||||
*aReturn = nsnull;
|
||||
if (NS_OK == result) {
|
||||
nsIDOMNode *node, *returnNode;
|
||||
result = aNewAttr->QueryInterface(kIDOMNodeIID, (void **)&node);
|
||||
if (NS_OK == result) {
|
||||
result = map->SetNamedItemNS(node, &returnNode);
|
||||
if ((NS_OK == result) && (nsnull != returnNode)) {
|
||||
result = returnNode->QueryInterface(kIDOMAttrIID, (void **)aReturn);
|
||||
NS_IF_RELEASE(returnNode);
|
||||
}
|
||||
NS_RELEASE(node);
|
||||
}
|
||||
NS_RELEASE(map);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -27,11 +27,28 @@
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPref.h" // Used by the temp pref, should be removed!
|
||||
static PRBool kStrictDOMLevel2 = PR_FALSE;
|
||||
|
||||
nsNodeInfo::nsNodeInfo()
|
||||
: mInner(), mOwnerManager(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
static PRInt32 been_here = 0;
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
if (!been_here) {
|
||||
kStrictDOMLevel2 = PR_FALSE; // Default in case of failure
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
been_here = 1;
|
||||
}
|
||||
// End of temp hack.
|
||||
}
|
||||
|
||||
|
||||
@ -104,21 +121,21 @@ nsNodeInfo::GetQualifiedName(nsString& aQualifiedName)
|
||||
{
|
||||
NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
#ifdef MOZILLA_IS_READY_FOR_THIS
|
||||
if (mInner.mPrefix) {
|
||||
if (mInner.mPrefix && kStrictDOMLevel2) {
|
||||
mInner.mPrefix->ToString(aQualifiedName);
|
||||
|
||||
aQualifiedName.Append(PRUnichar(':'));
|
||||
}
|
||||
|
||||
nsAutoString tmp;
|
||||
mInner.mName->ToString(tmp);
|
||||
const PRUnichar *name;
|
||||
mInner.mName->GetUnicode(&name);
|
||||
|
||||
aQualifiedName.Append(tmp);
|
||||
aQualifiedName.Append(name);
|
||||
|
||||
#else
|
||||
mInner.mName->ToString(aQualifiedName);
|
||||
#endif
|
||||
if (kStrictDOMLevel2 && mInner.mPrefix) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aQualifiedName);
|
||||
printf ("Possible DOM Error: .name, .nodeName or .tagName requested on a namespace element/attribute with the qulaified name '%s', is this OK?\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -95,6 +95,8 @@
|
||||
// XXX todo: add in missing out-of-memory checks
|
||||
NS_DEFINE_IID(kIDOMHTMLElementIID, NS_IDOMHTMLELEMENT_IID);
|
||||
|
||||
#include "nsIPref.h" // Used by the temp pref, should be removed!
|
||||
|
||||
static NS_DEFINE_IID(kIDOMAttrIID, NS_IDOMATTR_IID);
|
||||
static NS_DEFINE_IID(kIDOMNamedNodeMapIID, NS_IDOMNAMEDNODEMAP_IID);
|
||||
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||
@ -390,10 +392,27 @@ static void ReleaseAttributes(nsIHTMLAttributes*& aAttributes)
|
||||
static int gGenericHTMLElementCount = 0;
|
||||
static nsILanguageAtomService* gLangService = nsnull;
|
||||
|
||||
|
||||
static PRBool kStrictDOMLevel2 = PR_FALSE; // Only used for temp DOM hack
|
||||
|
||||
nsGenericHTMLElement::nsGenericHTMLElement()
|
||||
{
|
||||
mAttributes = nsnull;
|
||||
gGenericHTMLElementCount++;
|
||||
|
||||
static PRInt32 been_here = 0;
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
if (!been_here) {
|
||||
kStrictDOMLevel2 = PR_FALSE; // Default in case of failure
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
been_here = 1;
|
||||
}
|
||||
// End of temp hack.
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::~nsGenericHTMLElement()
|
||||
@ -430,19 +449,19 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent,
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetTagName(nsString& aTagName)
|
||||
{
|
||||
nsGenericElement::GetTagName(aTagName);
|
||||
aTagName.ToUpperCase();
|
||||
return NS_OK;
|
||||
return GetNodeName(aTagName);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
|
||||
{
|
||||
// This whole method needs revriting to work properly with XHTML...
|
||||
#ifdef MOZILLA_IS_READY_FOR_THIS
|
||||
mNodeInfo->GetPrefix(aNodeName);
|
||||
if (aNodeName.Length()) {
|
||||
aNodeName.Append(PRUnichar(':'));
|
||||
|
||||
if (kStrictDOMLevel2) {
|
||||
mNodeInfo->GetPrefix(aNodeName);
|
||||
if (aNodeName.Length()) {
|
||||
aNodeName.Append(PRUnichar(':'));
|
||||
}
|
||||
|
||||
nsAutoString tmp;
|
||||
mNodeInfo->GetName(tmp);
|
||||
@ -450,10 +469,17 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
|
||||
tmp.ToUpperCase();
|
||||
|
||||
aNodeName.Append(tmp);
|
||||
} else {
|
||||
mNodeInfo->GetName(aNodeName);
|
||||
}
|
||||
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aNodeName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aNodeName);
|
||||
printf ("Possible DOM Error: .nodeName or .tagName requisted on the HTML alement '%s', is this OK?\n", (const char *)tmp);
|
||||
}
|
||||
}
|
||||
#else
|
||||
mNodeInfo->GetName(aNodeName);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -728,6 +728,8 @@ nsXMLDocument::CreateElementWithNameSpace(const nsString& aTagName,
|
||||
const nsString& aNameSpace,
|
||||
nsIDOMElement** aReturn)
|
||||
{
|
||||
printf ("Deprecated method CreateElementWithNameSpace() used, use CreateElementNS() in stead!\n");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
|
@ -118,6 +118,10 @@
|
||||
#include "nsXULMenuListElement.h"
|
||||
#include "nsXULDocument.h"
|
||||
|
||||
// Used for the temporary DOM Level2 hack
|
||||
#include "nsIPref.h"
|
||||
static PRBool kStrictDOMLevel2;
|
||||
|
||||
#include "prlog.h"
|
||||
#include "rdf.h"
|
||||
#include "rdfutil.h"
|
||||
@ -359,6 +363,16 @@ nsXULElement::Init()
|
||||
{
|
||||
if (gRefCnt++ == 0) {
|
||||
nsresult rv;
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
kStrictDOMLevel2 = PR_FALSE; // Default in case of failure
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
// End of temp hack.
|
||||
|
||||
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
kIRDFServiceIID,
|
||||
(nsISupports**) &gRDFService);
|
||||
@ -1473,6 +1487,16 @@ nsXULElement::GetAttribute(const nsString& aName, nsString& aReturn)
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::SetAttribute(const nsString& aName, const nsString& aValue)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: SetAttribute(\"%s\") called, use SetAttributeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag(dont_AddRef(NS_NewAtom(aName)));
|
||||
return SetAttribute(kNameSpaceID_None, tag, aValue, PR_TRUE);
|
||||
}
|
||||
nsresult rv;
|
||||
|
||||
PRInt32 nameSpaceID;
|
||||
@ -1493,6 +1517,17 @@ nsXULElement::SetAttribute(const nsString& aName, const nsString& aValue)
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::RemoveAttribute(const nsString& aName)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: RemoveAttribute(\"%s\") called, use RemoveAttributeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag(dont_AddRef(NS_NewAtom(aName)));
|
||||
return UnsetAttribute(kNameSpaceID_None, tag, PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
PRInt32 nameSpaceID;
|
||||
@ -1513,6 +1548,14 @@ nsXULElement::RemoveAttribute(const nsString& aName)
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: GetAttributeNode(\"%s\") called, use GetAttributeNodeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
}
|
||||
|
||||
NS_PRECONDITION(aReturn != nsnull, "null ptr");
|
||||
if (! aReturn)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
@ -1572,6 +1615,14 @@ nsXULElement::RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn)
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsRDFDOMNodeList* elements;
|
||||
@ -3526,7 +3577,7 @@ nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
// Obviously, the target should be the content/frame where the mouse was depressed,
|
||||
// not one computed by the current mouse location.
|
||||
nsAutoString tagName;
|
||||
GetTagName(tagName);
|
||||
NodeInfo()->GetName(tagName); // Local name only
|
||||
if (aEvent->message == NS_MENU_ACTION || aEvent->message == NS_MENU_CREATE ||
|
||||
aEvent->message == NS_MENU_DESTROY || aEvent->message == NS_FORM_SELECTED ||
|
||||
aEvent->message == NS_XUL_BROADCAST || aEvent->message == NS_XUL_COMMAND_UPDATE ||
|
||||
@ -4420,8 +4471,7 @@ nsXULElement::Click()
|
||||
nsCOMPtr<nsIPresShell> shell; // Strong
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
nsAutoString tagName;
|
||||
GetTagName(tagName);
|
||||
PRBool isButton = (tagName.EqualsWithConversion("titledbutton"));
|
||||
PRBool isButton = NodeInfo()->Equals(NS_ConvertASCIItoUCS2("titledbutton"));
|
||||
|
||||
for (PRInt32 i=0; i<numShells; i++) {
|
||||
shell = getter_AddRefs(doc->GetShellAt(i));
|
||||
|
@ -129,6 +129,12 @@
|
||||
#include "nsIDOMDocumentType.h"
|
||||
|
||||
#include "nsIXIFConverter.h"
|
||||
|
||||
// Used for the temporary DOM Level2 hack
|
||||
#include "nsIPref.h"
|
||||
static PRBool kStrictDOMLevel2 = PR_FALSE;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// CIDs
|
||||
@ -410,6 +416,14 @@ nsXULDocument::nsXULDocument(void)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mCharSetID.AssignWithConversion("UTF-8");
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
// End of temp hack.
|
||||
}
|
||||
|
||||
nsXULDocument::~nsXULDocument()
|
||||
@ -2333,6 +2347,32 @@ nsXULDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn)
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIAtom> name, prefix;
|
||||
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aTagName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aTagName);
|
||||
printf ("Possible DOM Error: CreateElement(\"%s\") called, use CreateElementNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
name = dont_AddRef(NS_NewAtom(aTagName));
|
||||
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||
} else {
|
||||
// parse the user-provided string into a tag name and a namespace ID
|
||||
rv = ParseTagString(aTagName, *getter_AddRefs(name),
|
||||
*getter_AddRefs(prefix));
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef PR_LOGGING
|
||||
char* tagNameStr = aTagName.ToNewCString();
|
||||
PR_LOG(gXULLog, PR_LOG_ERROR,
|
||||
("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr));
|
||||
nsCRT::free(tagNameStr);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
|
||||
char* tagCStr = aTagName.ToNewCString();
|
||||
@ -2344,23 +2384,8 @@ nsXULDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn)
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIAtom> name, prefix;
|
||||
|
||||
*aReturn = nsnull;
|
||||
|
||||
// parse the user-provided string into a tag name and a namespace ID
|
||||
rv = ParseTagString(aTagName, *getter_AddRefs(name),
|
||||
*getter_AddRefs(prefix));
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef PR_LOGGING
|
||||
char* tagNameStr = aTagName.ToNewCString();
|
||||
PR_LOG(gXULLog, PR_LOG_ERROR,
|
||||
("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr));
|
||||
nsCRT::free(tagNameStr);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
|
||||
// CreateElement in the XUL document defaults to the XUL namespace.
|
||||
@ -2455,6 +2480,14 @@ nsXULDocument::CreateEntityReference(const nsString& aName, nsIDOMEntityReferenc
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetElementsByTagName(const nsString& aTagName, nsIDOMNodeList** aReturn)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aTagName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aTagName);
|
||||
printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsRDFDOMNodeList* elements;
|
||||
if (NS_FAILED(rv = nsRDFDOMNodeList::Create(&elements))) {
|
||||
@ -2659,6 +2692,8 @@ nsXULDocument::CreateElementWithNameSpace(const nsString& aTagName,
|
||||
const nsString& aNameSpace,
|
||||
nsIDOMElement** aResult)
|
||||
{
|
||||
printf ("Deprecated method CreateElementWithNameSpace() used, use CreateElementNS() in stead!\n");
|
||||
|
||||
// Create a DOM element given a namespace URI and a tag name.
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
|
@ -69,6 +69,12 @@
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPref.h" // Used by the temp pref, should be removed!
|
||||
static PRBool kStrictDOMLevel2 = PR_FALSE;
|
||||
|
||||
|
||||
NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||
NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
|
||||
NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
|
||||
@ -381,6 +387,20 @@ nsGenericElement::nsGenericElement() : mContent(nsnull), mDocument(nsnull),
|
||||
mParent(nsnull), mNodeInfo(nsnull),
|
||||
mDOMSlots(nsnull), mContentID(0)
|
||||
{
|
||||
static PRInt32 been_here = 0;
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
if (!been_here) {
|
||||
kStrictDOMLevel2 = PR_FALSE; // Default in case of failure
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
been_here = 1;
|
||||
}
|
||||
// End of temp hack.
|
||||
|
||||
}
|
||||
|
||||
nsGenericElement::~nsGenericElement()
|
||||
@ -708,6 +728,17 @@ nsresult
|
||||
nsGenericElement::SetAttribute(const nsString& aName,
|
||||
const nsString& aValue)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: SetAttribute(\"%s\") called, use SetAttributeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag(dont_AddRef(NS_NewAtom(aName)));
|
||||
return mContent->SetAttribute(kNameSpaceID_None, tag, aValue, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
nsresult result = NS_OK;
|
||||
@ -725,6 +756,17 @@ nsGenericElement::SetAttribute(const nsString& aName,
|
||||
nsresult
|
||||
nsGenericElement::RemoveAttribute(const nsString& aName)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: RemoveAttribute(\"%s\") called, use RemoveAttributeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag(dont_AddRef(NS_NewAtom(aName)));
|
||||
return mContent->UnsetAttribute(kNameSpaceID_None, tag, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
nsresult result = NS_OK;
|
||||
@ -827,11 +869,22 @@ nsGenericElement::GetElementsByTagName(const nsString& aTagname,
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceId;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = mContent->ParseAttributeString(aTagname, nameAtom,
|
||||
nameSpaceId);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aTagname.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aTagname);
|
||||
printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nameAtom = NS_NewAtom(aTagname);
|
||||
nameSpaceId = kNameSpaceID_Unknown;
|
||||
} else {
|
||||
result = mContent->ParseAttributeString(aTagname, nameAtom,
|
||||
nameSpaceId);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
nsContentList* list = new nsContentList(mDocument,
|
||||
@ -950,6 +1003,27 @@ nsresult
|
||||
nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
|
||||
nsIDOMAttr** aReturn)
|
||||
{
|
||||
if ((nsnull == aReturn) || (nsnull == aNewAttr)) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIDOMNamedNodeMap* map;
|
||||
nsresult result = GetAttributes(&map);
|
||||
|
||||
*aReturn = nsnull;
|
||||
if (NS_OK == result) {
|
||||
nsIDOMNode *node, *returnNode;
|
||||
result = aNewAttr->QueryInterface(kIDOMNodeIID, (void **)&node);
|
||||
if (NS_OK == result) {
|
||||
result = map->SetNamedItemNS(node, &returnNode);
|
||||
if ((NS_OK == result) && (nsnull != returnNode)) {
|
||||
result = returnNode->QueryInterface(kIDOMAttrIID, (void **)aReturn);
|
||||
NS_IF_RELEASE(returnNode);
|
||||
}
|
||||
NS_RELEASE(node);
|
||||
}
|
||||
NS_RELEASE(map);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -27,11 +27,28 @@
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPref.h" // Used by the temp pref, should be removed!
|
||||
static PRBool kStrictDOMLevel2 = PR_FALSE;
|
||||
|
||||
nsNodeInfo::nsNodeInfo()
|
||||
: mInner(), mOwnerManager(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
static PRInt32 been_here = 0;
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
if (!been_here) {
|
||||
kStrictDOMLevel2 = PR_FALSE; // Default in case of failure
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
been_here = 1;
|
||||
}
|
||||
// End of temp hack.
|
||||
}
|
||||
|
||||
|
||||
@ -104,21 +121,21 @@ nsNodeInfo::GetQualifiedName(nsString& aQualifiedName)
|
||||
{
|
||||
NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
#ifdef MOZILLA_IS_READY_FOR_THIS
|
||||
if (mInner.mPrefix) {
|
||||
if (mInner.mPrefix && kStrictDOMLevel2) {
|
||||
mInner.mPrefix->ToString(aQualifiedName);
|
||||
|
||||
aQualifiedName.Append(PRUnichar(':'));
|
||||
}
|
||||
|
||||
nsAutoString tmp;
|
||||
mInner.mName->ToString(tmp);
|
||||
const PRUnichar *name;
|
||||
mInner.mName->GetUnicode(&name);
|
||||
|
||||
aQualifiedName.Append(tmp);
|
||||
aQualifiedName.Append(name);
|
||||
|
||||
#else
|
||||
mInner.mName->ToString(aQualifiedName);
|
||||
#endif
|
||||
if (kStrictDOMLevel2 && mInner.mPrefix) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aQualifiedName);
|
||||
printf ("Possible DOM Error: .name, .nodeName or .tagName requested on a namespace element/attribute with the qulaified name '%s', is this OK?\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -95,6 +95,8 @@
|
||||
// XXX todo: add in missing out-of-memory checks
|
||||
NS_DEFINE_IID(kIDOMHTMLElementIID, NS_IDOMHTMLELEMENT_IID);
|
||||
|
||||
#include "nsIPref.h" // Used by the temp pref, should be removed!
|
||||
|
||||
static NS_DEFINE_IID(kIDOMAttrIID, NS_IDOMATTR_IID);
|
||||
static NS_DEFINE_IID(kIDOMNamedNodeMapIID, NS_IDOMNAMEDNODEMAP_IID);
|
||||
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||
@ -390,10 +392,27 @@ static void ReleaseAttributes(nsIHTMLAttributes*& aAttributes)
|
||||
static int gGenericHTMLElementCount = 0;
|
||||
static nsILanguageAtomService* gLangService = nsnull;
|
||||
|
||||
|
||||
static PRBool kStrictDOMLevel2 = PR_FALSE; // Only used for temp DOM hack
|
||||
|
||||
nsGenericHTMLElement::nsGenericHTMLElement()
|
||||
{
|
||||
mAttributes = nsnull;
|
||||
gGenericHTMLElementCount++;
|
||||
|
||||
static PRInt32 been_here = 0;
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
if (!been_here) {
|
||||
kStrictDOMLevel2 = PR_FALSE; // Default in case of failure
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
been_here = 1;
|
||||
}
|
||||
// End of temp hack.
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::~nsGenericHTMLElement()
|
||||
@ -430,19 +449,19 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent,
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetTagName(nsString& aTagName)
|
||||
{
|
||||
nsGenericElement::GetTagName(aTagName);
|
||||
aTagName.ToUpperCase();
|
||||
return NS_OK;
|
||||
return GetNodeName(aTagName);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
|
||||
{
|
||||
// This whole method needs revriting to work properly with XHTML...
|
||||
#ifdef MOZILLA_IS_READY_FOR_THIS
|
||||
mNodeInfo->GetPrefix(aNodeName);
|
||||
if (aNodeName.Length()) {
|
||||
aNodeName.Append(PRUnichar(':'));
|
||||
|
||||
if (kStrictDOMLevel2) {
|
||||
mNodeInfo->GetPrefix(aNodeName);
|
||||
if (aNodeName.Length()) {
|
||||
aNodeName.Append(PRUnichar(':'));
|
||||
}
|
||||
|
||||
nsAutoString tmp;
|
||||
mNodeInfo->GetName(tmp);
|
||||
@ -450,10 +469,17 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
|
||||
tmp.ToUpperCase();
|
||||
|
||||
aNodeName.Append(tmp);
|
||||
} else {
|
||||
mNodeInfo->GetName(aNodeName);
|
||||
}
|
||||
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aNodeName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aNodeName);
|
||||
printf ("Possible DOM Error: .nodeName or .tagName requisted on the HTML alement '%s', is this OK?\n", (const char *)tmp);
|
||||
}
|
||||
}
|
||||
#else
|
||||
mNodeInfo->GetName(aNodeName);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -728,6 +728,8 @@ nsXMLDocument::CreateElementWithNameSpace(const nsString& aTagName,
|
||||
const nsString& aNameSpace,
|
||||
nsIDOMElement** aReturn)
|
||||
{
|
||||
printf ("Deprecated method CreateElementWithNameSpace() used, use CreateElementNS() in stead!\n");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
|
@ -129,6 +129,12 @@
|
||||
#include "nsIDOMDocumentType.h"
|
||||
|
||||
#include "nsIXIFConverter.h"
|
||||
|
||||
// Used for the temporary DOM Level2 hack
|
||||
#include "nsIPref.h"
|
||||
static PRBool kStrictDOMLevel2 = PR_FALSE;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// CIDs
|
||||
@ -410,6 +416,14 @@ nsXULDocument::nsXULDocument(void)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mCharSetID.AssignWithConversion("UTF-8");
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
// End of temp hack.
|
||||
}
|
||||
|
||||
nsXULDocument::~nsXULDocument()
|
||||
@ -2333,6 +2347,32 @@ nsXULDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn)
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIAtom> name, prefix;
|
||||
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aTagName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aTagName);
|
||||
printf ("Possible DOM Error: CreateElement(\"%s\") called, use CreateElementNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
name = dont_AddRef(NS_NewAtom(aTagName));
|
||||
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||
} else {
|
||||
// parse the user-provided string into a tag name and a namespace ID
|
||||
rv = ParseTagString(aTagName, *getter_AddRefs(name),
|
||||
*getter_AddRefs(prefix));
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef PR_LOGGING
|
||||
char* tagNameStr = aTagName.ToNewCString();
|
||||
PR_LOG(gXULLog, PR_LOG_ERROR,
|
||||
("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr));
|
||||
nsCRT::free(tagNameStr);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
|
||||
char* tagCStr = aTagName.ToNewCString();
|
||||
@ -2344,23 +2384,8 @@ nsXULDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn)
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIAtom> name, prefix;
|
||||
|
||||
*aReturn = nsnull;
|
||||
|
||||
// parse the user-provided string into a tag name and a namespace ID
|
||||
rv = ParseTagString(aTagName, *getter_AddRefs(name),
|
||||
*getter_AddRefs(prefix));
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef PR_LOGGING
|
||||
char* tagNameStr = aTagName.ToNewCString();
|
||||
PR_LOG(gXULLog, PR_LOG_ERROR,
|
||||
("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr));
|
||||
nsCRT::free(tagNameStr);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
|
||||
// CreateElement in the XUL document defaults to the XUL namespace.
|
||||
@ -2455,6 +2480,14 @@ nsXULDocument::CreateEntityReference(const nsString& aName, nsIDOMEntityReferenc
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetElementsByTagName(const nsString& aTagName, nsIDOMNodeList** aReturn)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aTagName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aTagName);
|
||||
printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsRDFDOMNodeList* elements;
|
||||
if (NS_FAILED(rv = nsRDFDOMNodeList::Create(&elements))) {
|
||||
@ -2659,6 +2692,8 @@ nsXULDocument::CreateElementWithNameSpace(const nsString& aTagName,
|
||||
const nsString& aNameSpace,
|
||||
nsIDOMElement** aResult)
|
||||
{
|
||||
printf ("Deprecated method CreateElementWithNameSpace() used, use CreateElementNS() in stead!\n");
|
||||
|
||||
// Create a DOM element given a namespace URI and a tag name.
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
|
@ -118,6 +118,10 @@
|
||||
#include "nsXULMenuListElement.h"
|
||||
#include "nsXULDocument.h"
|
||||
|
||||
// Used for the temporary DOM Level2 hack
|
||||
#include "nsIPref.h"
|
||||
static PRBool kStrictDOMLevel2;
|
||||
|
||||
#include "prlog.h"
|
||||
#include "rdf.h"
|
||||
#include "rdfutil.h"
|
||||
@ -359,6 +363,16 @@ nsXULElement::Init()
|
||||
{
|
||||
if (gRefCnt++ == 0) {
|
||||
nsresult rv;
|
||||
|
||||
// Temporary hack that tells if some new DOM Level 2 features are on or off
|
||||
kStrictDOMLevel2 = PR_FALSE; // Default in case of failure
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref("temp.DOMLevel2update.enabled", &kStrictDOMLevel2);
|
||||
}
|
||||
// End of temp hack.
|
||||
|
||||
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
kIRDFServiceIID,
|
||||
(nsISupports**) &gRDFService);
|
||||
@ -1473,6 +1487,16 @@ nsXULElement::GetAttribute(const nsString& aName, nsString& aReturn)
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::SetAttribute(const nsString& aName, const nsString& aValue)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: SetAttribute(\"%s\") called, use SetAttributeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag(dont_AddRef(NS_NewAtom(aName)));
|
||||
return SetAttribute(kNameSpaceID_None, tag, aValue, PR_TRUE);
|
||||
}
|
||||
nsresult rv;
|
||||
|
||||
PRInt32 nameSpaceID;
|
||||
@ -1493,6 +1517,17 @@ nsXULElement::SetAttribute(const nsString& aName, const nsString& aValue)
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::RemoveAttribute(const nsString& aName)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: RemoveAttribute(\"%s\") called, use RemoveAttributeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag(dont_AddRef(NS_NewAtom(aName)));
|
||||
return UnsetAttribute(kNameSpaceID_None, tag, PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
PRInt32 nameSpaceID;
|
||||
@ -1513,6 +1548,14 @@ nsXULElement::RemoveAttribute(const nsString& aName)
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: GetAttributeNode(\"%s\") called, use GetAttributeNodeNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
}
|
||||
|
||||
NS_PRECONDITION(aReturn != nsnull, "null ptr");
|
||||
if (! aReturn)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
@ -1572,6 +1615,14 @@ nsXULElement::RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn)
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn)
|
||||
{
|
||||
if (kStrictDOMLevel2) {
|
||||
PRInt32 pos = aName.FindChar(':');
|
||||
if (pos >= 0) {
|
||||
nsCAutoString tmp; tmp.AssignWithConversion(aName);
|
||||
printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsRDFDOMNodeList* elements;
|
||||
@ -3526,7 +3577,7 @@ nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
// Obviously, the target should be the content/frame where the mouse was depressed,
|
||||
// not one computed by the current mouse location.
|
||||
nsAutoString tagName;
|
||||
GetTagName(tagName);
|
||||
NodeInfo()->GetName(tagName); // Local name only
|
||||
if (aEvent->message == NS_MENU_ACTION || aEvent->message == NS_MENU_CREATE ||
|
||||
aEvent->message == NS_MENU_DESTROY || aEvent->message == NS_FORM_SELECTED ||
|
||||
aEvent->message == NS_XUL_BROADCAST || aEvent->message == NS_XUL_COMMAND_UPDATE ||
|
||||
@ -4420,8 +4471,7 @@ nsXULElement::Click()
|
||||
nsCOMPtr<nsIPresShell> shell; // Strong
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
nsAutoString tagName;
|
||||
GetTagName(tagName);
|
||||
PRBool isButton = (tagName.EqualsWithConversion("titledbutton"));
|
||||
PRBool isButton = NodeInfo()->Equals(NS_ConvertASCIItoUCS2("titledbutton"));
|
||||
|
||||
for (PRInt32 i=0; i<numShells; i++) {
|
||||
shell = getter_AddRefs(doc->GetShellAt(i));
|
||||
|
Loading…
Reference in New Issue
Block a user