mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 12:13:22 +00:00
Fix for bug #32853, we now support setting the 'for' attribute with the name 'htmlFor'.
This commit is contained in:
parent
58bfc5b2fe
commit
6d041e211b
@ -62,8 +62,50 @@ public:
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
// nsIDOMElement, because of the "htmlFor" attribute handling we can't
|
||||
// use the NS_IMPL_IDOMELEMENT_USING_GENERIC macro here...
|
||||
NS_IMETHOD GetTagName(nsString& aTagName) {
|
||||
return mInner.GetTagName(aTagName);
|
||||
}
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) {
|
||||
if (aName.EqualsIgnoreCase("htmlfor")) {
|
||||
return mInner.GetAttribute(nsAutoString("for"), aReturn);
|
||||
}
|
||||
return mInner.GetAttribute(aName, aReturn);
|
||||
}
|
||||
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) {
|
||||
if (aName.EqualsIgnoreCase("htmlfor")) {
|
||||
return mInner.SetAttribute(nsAutoString("for"), aValue);
|
||||
}
|
||||
return mInner.SetAttribute(aName, aValue);
|
||||
}
|
||||
NS_IMETHOD RemoveAttribute(const nsString& aName) {
|
||||
if (aName.EqualsIgnoreCase("htmlfor")) {
|
||||
return mInner.RemoveAttribute(nsAutoString("for"));
|
||||
}
|
||||
return mInner.RemoveAttribute(aName);
|
||||
}
|
||||
NS_IMETHOD GetAttributeNode(const nsString& aName,
|
||||
nsIDOMAttr** aReturn) {
|
||||
if (aName.EqualsIgnoreCase("htmlfor")) {
|
||||
return mInner.GetAttributeNode(nsAutoString("for"), aReturn);
|
||||
}
|
||||
return mInner.GetAttributeNode(aName, aReturn);
|
||||
}
|
||||
NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) {
|
||||
return mInner.SetAttributeNode(aNewAttr, aReturn);
|
||||
}
|
||||
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) {
|
||||
return mInner.RemoveAttributeNode(aOldAttr, aReturn);
|
||||
}
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aTagname,
|
||||
nsIDOMNodeList** aReturn) {
|
||||
return mInner.GetElementsByTagName(aTagname, aReturn);
|
||||
}
|
||||
NS_IMETHOD Normalize() {
|
||||
return mInner.Normalize();
|
||||
}
|
||||
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
@ -252,9 +294,9 @@ nsHTMLLabelElement::SetHtmlFor(const nsString& aValue)
|
||||
{
|
||||
// trim leading and trailing whitespace
|
||||
static char whitespace[] = " \r\n\t";
|
||||
nsString value(aValue);
|
||||
nsAutoString value(aValue);
|
||||
value.Trim(whitespace, PR_TRUE, PR_TRUE);
|
||||
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::defaultvalue, value, PR_TRUE);
|
||||
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_for, value, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -62,8 +62,50 @@ public:
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
// nsIDOMElement, because of the "htmlFor" attribute handling we can't
|
||||
// use the NS_IMPL_IDOMELEMENT_USING_GENERIC macro here...
|
||||
NS_IMETHOD GetTagName(nsString& aTagName) {
|
||||
return mInner.GetTagName(aTagName);
|
||||
}
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) {
|
||||
if (aName.EqualsIgnoreCase("htmlfor")) {
|
||||
return mInner.GetAttribute(nsAutoString("for"), aReturn);
|
||||
}
|
||||
return mInner.GetAttribute(aName, aReturn);
|
||||
}
|
||||
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) {
|
||||
if (aName.EqualsIgnoreCase("htmlfor")) {
|
||||
return mInner.SetAttribute(nsAutoString("for"), aValue);
|
||||
}
|
||||
return mInner.SetAttribute(aName, aValue);
|
||||
}
|
||||
NS_IMETHOD RemoveAttribute(const nsString& aName) {
|
||||
if (aName.EqualsIgnoreCase("htmlfor")) {
|
||||
return mInner.RemoveAttribute(nsAutoString("for"));
|
||||
}
|
||||
return mInner.RemoveAttribute(aName);
|
||||
}
|
||||
NS_IMETHOD GetAttributeNode(const nsString& aName,
|
||||
nsIDOMAttr** aReturn) {
|
||||
if (aName.EqualsIgnoreCase("htmlfor")) {
|
||||
return mInner.GetAttributeNode(nsAutoString("for"), aReturn);
|
||||
}
|
||||
return mInner.GetAttributeNode(aName, aReturn);
|
||||
}
|
||||
NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) {
|
||||
return mInner.SetAttributeNode(aNewAttr, aReturn);
|
||||
}
|
||||
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) {
|
||||
return mInner.RemoveAttributeNode(aOldAttr, aReturn);
|
||||
}
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aTagname,
|
||||
nsIDOMNodeList** aReturn) {
|
||||
return mInner.GetElementsByTagName(aTagname, aReturn);
|
||||
}
|
||||
NS_IMETHOD Normalize() {
|
||||
return mInner.Normalize();
|
||||
}
|
||||
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
@ -252,9 +294,9 @@ nsHTMLLabelElement::SetHtmlFor(const nsString& aValue)
|
||||
{
|
||||
// trim leading and trailing whitespace
|
||||
static char whitespace[] = " \r\n\t";
|
||||
nsString value(aValue);
|
||||
nsAutoString value(aValue);
|
||||
value.Trim(whitespace, PR_TRUE, PR_TRUE);
|
||||
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::defaultvalue, value, PR_TRUE);
|
||||
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_for, value, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
Loading…
x
Reference in New Issue
Block a user