Fix for bug 239873 (DOMStringList interface not matching DOM Level 3). r/sr=jst.

git-svn-id: svn://10.0.0.236/trunk@164028 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterv%propagandism.org 2004-10-19 17:20:14 +00:00
parent 8a2b281045
commit 14e0ec4016
3 changed files with 42 additions and 4 deletions

View File

@ -78,6 +78,14 @@ nsDOMStringList::GetLength(PRUint32 *aLength)
return NS_OK;
}
NS_IMETHODIMP
nsDOMStringList::Contains(const nsAString& aString, PRBool *aResult)
{
*aResult = mNames.IndexOf(aString) > -1;
return NS_OK;
}
nsNameList::nsNameList()
{
@ -140,3 +148,29 @@ nsNameList::Add(const nsAString& aNamespaceURI, const nsAString& aName)
return PR_FALSE;
}
NS_IMETHODIMP
nsNameList::Contains(const nsAString& aName, PRBool *aResult)
{
*aResult = mNames.IndexOf(aName) > -1;
return NS_OK;
}
NS_IMETHODIMP
nsNameList::ContainsNS(const nsAString& aNamespaceURI, const nsAString& aName,
PRBool *aResult)
{
PRInt32 index = mNames.IndexOf(aName);
if (index > -1) {
nsAutoString ns;
mNamespaceURIs.StringAt(index, ns);
*aResult = ns.Equals(aNamespaceURI);
}
else {
*aResult = PR_FALSE;
}
return NS_OK;
}

View File

@ -38,14 +38,15 @@
* ***** END LICENSE BLOCK ***** */
/**
* Corresponds to http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030609
* Corresponds to http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407
*/
#include "domstubs.idl"
[scriptable, uuid(893f2075-b62b-11d7-af68-000a95687b38)]
[scriptable, uuid(0bbae65c-1dde-11d9-8c46-000a95dc234c)]
interface nsIDOMDOMStringList : nsISupports
{
DOMString item(in unsigned long index);
readonly attribute unsigned long length;
boolean contains(in DOMString str);
};

View File

@ -38,12 +38,12 @@
* ***** END LICENSE BLOCK ***** */
/**
* Corresponds to http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030609
* Corresponds to http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407
*/
#include "domstubs.idl"
[scriptable, uuid(e9ceba95-b62b-11d7-af68-000a95687b38)]
[scriptable, uuid(faaf1b80-1ddd-11d9-8c46-000a95dc234c)]
interface nsIDOMNameList : nsISupports
{
DOMString getName(in unsigned long index)
@ -51,4 +51,7 @@ interface nsIDOMNameList : nsISupports
DOMString getNamespaceURI(in unsigned long index)
raises(DOMException);
readonly attribute unsigned long length;
boolean contains(in DOMString str);
boolean containsNS(in DOMString namespaceURI,
in DOMString name);
};