diff --git a/content/html/content/src/nsHTMLLabelElement.cpp b/content/html/content/src/nsHTMLLabelElement.cpp
index 2347786e864c..e54d8aa10c33 100644
--- a/content/html/content/src/nsHTMLLabelElement.cpp
+++ b/content/html/content/src/nsHTMLLabelElement.cpp
@@ -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
diff --git a/layout/html/content/src/nsHTMLLabelElement.cpp b/layout/html/content/src/nsHTMLLabelElement.cpp
index 2347786e864c..e54d8aa10c33 100644
--- a/layout/html/content/src/nsHTMLLabelElement.cpp
+++ b/layout/html/content/src/nsHTMLLabelElement.cpp
@@ -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