accept namespace none for attributes

This commit is contained in:
peterl%netscape.com 1999-01-30 06:21:08 +00:00
parent 77e6eb5115
commit 0f67d466fc
2 changed files with 14 additions and 0 deletions

View File

@ -453,6 +453,7 @@ nsGenericHTMLElement::ParseAttributeString(const nsString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID)
{
// XXX need to validate/strip namespace prefix
nsAutoString upper;
aStr.ToUpperCase(upper);
aName = NS_NewAtom(upper);
@ -477,10 +478,12 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID,
{
nsresult result = NS_OK;
NS_ASSERTION((kNameSpaceID_HTML == aNameSpaceID) ||
(kNameSpaceID_None == aNameSpaceID) ||
(kNameSpaceID_Unknown == aNameSpaceID),
"html content only holds HTML attributes");
if ((kNameSpaceID_HTML != aNameSpaceID) &&
(kNameSpaceID_None != aNameSpaceID) &&
(kNameSpaceID_Unknown != aNameSpaceID)) {
return NS_ERROR_ILLEGAL_VALUE;
}
@ -691,10 +694,12 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
nsresult result = NS_OK;
NS_ASSERTION((kNameSpaceID_HTML == aNameSpaceID) ||
(kNameSpaceID_None == aNameSpaceID) ||
(kNameSpaceID_Unknown == aNameSpaceID),
"html content only holds HTML attributes");
if ((kNameSpaceID_HTML != aNameSpaceID) &&
(kNameSpaceID_None != aNameSpaceID) &&
(kNameSpaceID_Unknown != aNameSpaceID)) {
return NS_ERROR_ILLEGAL_VALUE;
}
@ -744,10 +749,12 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsString &aResult) const
{
NS_ASSERTION((kNameSpaceID_HTML == aNameSpaceID) ||
(kNameSpaceID_HTML == aNameSpaceID) ||
(kNameSpaceID_Unknown == aNameSpaceID),
"html content only holds HTML attributes");
if ((kNameSpaceID_HTML != aNameSpaceID) &&
(kNameSpaceID_None != aNameSpaceID) &&
(kNameSpaceID_Unknown != aNameSpaceID)) {
return NS_ERROR_ILLEGAL_VALUE;
}

View File

@ -453,6 +453,7 @@ nsGenericHTMLElement::ParseAttributeString(const nsString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID)
{
// XXX need to validate/strip namespace prefix
nsAutoString upper;
aStr.ToUpperCase(upper);
aName = NS_NewAtom(upper);
@ -477,10 +478,12 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID,
{
nsresult result = NS_OK;
NS_ASSERTION((kNameSpaceID_HTML == aNameSpaceID) ||
(kNameSpaceID_None == aNameSpaceID) ||
(kNameSpaceID_Unknown == aNameSpaceID),
"html content only holds HTML attributes");
if ((kNameSpaceID_HTML != aNameSpaceID) &&
(kNameSpaceID_None != aNameSpaceID) &&
(kNameSpaceID_Unknown != aNameSpaceID)) {
return NS_ERROR_ILLEGAL_VALUE;
}
@ -691,10 +694,12 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
nsresult result = NS_OK;
NS_ASSERTION((kNameSpaceID_HTML == aNameSpaceID) ||
(kNameSpaceID_None == aNameSpaceID) ||
(kNameSpaceID_Unknown == aNameSpaceID),
"html content only holds HTML attributes");
if ((kNameSpaceID_HTML != aNameSpaceID) &&
(kNameSpaceID_None != aNameSpaceID) &&
(kNameSpaceID_Unknown != aNameSpaceID)) {
return NS_ERROR_ILLEGAL_VALUE;
}
@ -744,10 +749,12 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsString &aResult) const
{
NS_ASSERTION((kNameSpaceID_HTML == aNameSpaceID) ||
(kNameSpaceID_HTML == aNameSpaceID) ||
(kNameSpaceID_Unknown == aNameSpaceID),
"html content only holds HTML attributes");
if ((kNameSpaceID_HTML != aNameSpaceID) &&
(kNameSpaceID_None != aNameSpaceID) &&
(kNameSpaceID_Unknown != aNameSpaceID)) {
return NS_ERROR_ILLEGAL_VALUE;
}