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

Unified Diff: Source/core/html/HTMLTextFormControlElement.cpp

Issue 255163002: Dispatch change event for input type=checkbox when checked but value is null (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added tests for Radio to check onchange event trigger Created 6 years, 7 months 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
Index: Source/core/html/HTMLTextFormControlElement.cpp
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp
index c3f751a63f54d4eb643bdb97275b0ecbe1ae555c..bf3597a17159f2e0cad756e6e8be0ffc25b2bc4c 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -182,11 +182,17 @@ void HTMLTextFormControlElement::select()
setSelectionRange(0, numeric_limits<int>::max(), SelectionHasNoDirection);
}
+bool HTMLTextFormControlElement::shouldDispatchFormControlChangeEvent(String& oldValue, String& newValue)
+{
+ return !equalIgnoringNullity(oldValue, newValue);
+}
+
void HTMLTextFormControlElement::dispatchFormControlChangeEvent()
{
- if (!equalIgnoringNullity(m_textAsOfLastFormControlChangeEvent, value())) {
+ String newValue = value();
+ if (shouldDispatchFormControlChangeEvent(m_textAsOfLastFormControlChangeEvent, newValue)) {
dispatchChangeEvent();
- setTextAsOfLastFormControlChangeEvent(value());
+ setTextAsOfLastFormControlChangeEvent(newValue);
}
setChangedSinceLastFormControlChangeEvent(false);
}

Powered by Google App Engine
This is Rietveld 408576698