diff --git a/content/html/style/src/nsDOMCSSAttrDeclaration.cpp b/content/html/style/src/nsDOMCSSAttrDeclaration.cpp
index ca1e51a4d7c..e8790a53644 100644
--- a/content/html/style/src/nsDOMCSSAttrDeclaration.cpp
+++ b/content/html/style/src/nsDOMCSSAttrDeclaration.cpp
@@ -186,9 +186,11 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
return result;
}
- // look up our namespace. If we're XHTML, we need to be case-sensitive
- // Otherwise, we should not be
- (*aCSSParser)->SetCaseSensitive(nodeInfo->NamespaceEquals(kNameSpaceID_XHTML));
+ // If we are not HTML, we need to be case-sensitive. Otherwise, Look up our
+ // namespace. If we're XHTML, we need to be case-sensitive Otherwise, we
+ // should not be
+ (*aCSSParser)->SetCaseSensitive(!mContent->IsContentOfType(nsIContent::eHTML) ||
+ nodeInfo->NamespaceEquals(kNameSpaceID_XHTML));
return NS_OK;
}
diff --git a/layout/style/nsDOMCSSAttrDeclaration.cpp b/layout/style/nsDOMCSSAttrDeclaration.cpp
index ca1e51a4d7c..e8790a53644 100644
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -186,9 +186,11 @@ nsDOMCSSAttributeDeclaration::GetCSSParsingEnvironment(nsIURI** aBaseURI,
return result;
}
- // look up our namespace. If we're XHTML, we need to be case-sensitive
- // Otherwise, we should not be
- (*aCSSParser)->SetCaseSensitive(nodeInfo->NamespaceEquals(kNameSpaceID_XHTML));
+ // If we are not HTML, we need to be case-sensitive. Otherwise, Look up our
+ // namespace. If we're XHTML, we need to be case-sensitive Otherwise, we
+ // should not be
+ (*aCSSParser)->SetCaseSensitive(!mContent->IsContentOfType(nsIContent::eHTML) ||
+ nodeInfo->NamespaceEquals(kNameSpaceID_XHTML));
return NS_OK;
}