Reviewed by Darin.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Jul 2006 14:56:42 +0000 (14:56 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Jul 2006 14:56:42 +0000 (14:56 +0000)
        Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=10147
        REGRESSION: custom attribute values set via javascript are not persistent

        Test: fast/dom/Element/setAttribute-case-insensitivity.html

        * dom/Element.cpp:
        (WebCore::Element::setAttribute): Use the lowercased localName for retrieving the old value, too.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15686 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/dom/Element/setAttribute-case-insensitivity-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Element/setAttribute-case-insensitivity.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/dom/Element.cpp

index bcc3679da2ee82de97ab8569f2285c5477577639..766a8d33e203977062f12a4770564ec18c54d552 100644 (file)
@@ -1,3 +1,13 @@
+2006-07-29  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Darin.
+
+        Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=10147
+        REGRESSION: custom attribute values set via javascript are not persistent
+
+        * fast/dom/Element/setAttribute-case-insensitivity-expected.txt: Added.
+        * fast/dom/Element/setAttribute-case-insensitivity.html: Added.
+
 2006-07-29  Darin Adler  <darin@apple.com>
 
         - rolled out the test for bug 9753, since we rolled out the fix
diff --git a/LayoutTests/fast/dom/Element/setAttribute-case-insensitivity-expected.txt b/LayoutTests/fast/dom/Element/setAttribute-case-insensitivity-expected.txt
new file mode 100644 (file)
index 0000000..cce21c3
--- /dev/null
@@ -0,0 +1,3 @@
+Text for bug 10147: REGRESSION: custom attribute values set via javascript are not persistent.
+
+SUCCESS
diff --git a/LayoutTests/fast/dom/Element/setAttribute-case-insensitivity.html b/LayoutTests/fast/dom/Element/setAttribute-case-insensitivity.html
new file mode 100644 (file)
index 0000000..347b8ad
--- /dev/null
@@ -0,0 +1,29 @@
+<html>
+<body>
+    <p>Text for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=10147">bug 10147</a>:
+    REGRESSION: custom attribute values set via javascript are not persistent.</p>
+
+    <table id="table1" border="0">
+        <tr id="mg" customAttr="old Value">
+        </tr>
+    </table>
+
+    <script language="javascript">
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        try {
+            document.getElementById("mg").setAttribute("customAttr", "new value");
+    
+            if ("new value" == document.getElementById("mg").getAttribute("customAttr"))
+                document.write("SUCCESS");
+            else
+                document.write("FAILURE");
+
+        } catch (ex) {
+            document.write(ex);
+        }
+
+    </script>
+</body>
+</html>
index bad4ad12d3d73bc018fa4cb987dad70f98ac842b..e844b45d7851abca6b71edc633af6b88d6fd9396 100644 (file)
@@ -1,3 +1,15 @@
+2006-07-29  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Darin.
+
+        Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=10147
+        REGRESSION: custom attribute values set via javascript are not persistent
+
+        Test: fast/dom/Element/setAttribute-case-insensitivity.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::setAttribute): Use the lowercased localName for retrieving the old value, too.
+
 2006-07-28  Timothy Hatcher  <timothy@apple.com>
 
         Suggested by Darin.
index cedb2d2a630be33a4404a911485dc00d68a3d8ec..7244ab898eb1ca6709c71767f2e435a463552aba 100644 (file)
@@ -331,8 +331,10 @@ void Element::setAttribute(const String& name, const String& value, ExceptionCod
         return;
     }
 
+    String localName = inHTMLDocument(this) ? name.lower() : name;
+
     // allocate attributemap if necessary
-    Attribute* old = attributes(false)->getAttributeItem(name);
+    Attribute* old = attributes(false)->getAttributeItem(localName);
 
     // NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
     if (namedAttrMap->isReadOnlyNode()) {
@@ -343,8 +345,6 @@ void Element::setAttribute(const String& name, const String& value, ExceptionCod
     if (inDocument())
         document()->incDOMTreeVersion();
 
-    String localName = inHTMLDocument(this) ? name.lower() : name;
-
     if (localName == idAttr.localName())
         updateId(old ? old->value() : nullAtom, value);