From: ap Date: Sat, 29 Jul 2006 14:56:42 +0000 (+0000) Subject: Reviewed by Darin. X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=37e519005f2e6c8a703732c5a2f6c95ad7de2b36 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. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15686 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index bcc3679da2ee..766a8d33e203 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,13 @@ +2006-07-29 Alexey Proskuryakov + + 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 - 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 index 000000000000..cce21c3c62ed --- /dev/null +++ b/LayoutTests/fast/dom/Element/setAttribute-case-insensitivity-expected.txt @@ -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 index 000000000000..347b8adc7a71 --- /dev/null +++ b/LayoutTests/fast/dom/Element/setAttribute-case-insensitivity.html @@ -0,0 +1,29 @@ + + +

Text for bug 10147: + REGRESSION: custom attribute values set via javascript are not persistent.

+ + + + +
+ + + + diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index bad4ad12d3d7..e844b45d7851 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2006-07-29 Alexey Proskuryakov + + 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 Suggested by Darin. diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index cedb2d2a630b..7244ab898eb1 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -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);