Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Unified Diff: third_party/WebKit/Source/core/html/HTMLOptionElement.cpp

Issue 1541753002: HTMLOptionElement.prototype.selected setter should not make an option dirty if it doesn't change it… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/select/option-dirtiness.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp b/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
index 07ba7a7af1bbffe62c550678cbb6e14b3b149caa..c95d5883273a61184f6a0442bef61f1ab6af46ea 100644
--- a/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
@@ -267,7 +267,17 @@ bool HTMLOptionElement::selectedForBinding() const
void HTMLOptionElement::setSelectedForBinding(bool selected)
{
+ bool wasSelected = m_isSelected;
setSelected(selected);
+
+ // As of December 2015, the HTML specification says the dirtiness becomes
tfarina 2015/12/23 23:04:36 is it worth pointing to the link for that specific
+ // true by |selected| setter unconditionally. However it caused a real bug,
+ // crbug.com/570367, and is not compatible with other browsers.
+ // Firefox seems not to set dirtiness if an option is owned by a select
+ // element and selectedness is not changed.
+ if (ownerSelectElement() && wasSelected == m_isSelected)
+ return;
+
m_isDirty = true;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/select/option-dirtiness.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698