Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix behavior of nested click event on label element with checkbox
Fix behavior of nested click event on label element with checkbox https://bugs.webkit.org/show_bug.cgi?id=249789 Reviewed by Ryosuke Niwa. This patch is to align WebKit with Blink / Chromium and Gecko / Firefox. Merge - https://src.chromium.org/viewvc/blink?view=revision&revision=183243 This patch removes static variable in HTMLLabelElement::defaultEventHandler, which interferes with handling of nested event on another label element. This is to promote this variable to class variable in the header so this interference can be avoided. * Source/WebCore/html/HTMLLabelElement.cpp: (HTMLLabelElement::defaultEventHandler): removed static variable and rename usage with SetForScope * Source/WebCore/html/HTMLLabelElement.h: Add bool 'm_processingClick' with false * LayoutTests/fast/form/checkbox-nested-click-event-on-label.html: Add Test Case * LayoutTests/fast/form/checkbox-nested-click-event-on-label-expected.txt: Add Test Case Expectation Canonical link: https://commits.webkit.org/258287@main
- Loading branch information
1 parent
0894432
commit 4ee89ea3f12cb36cc05e36f80c77c73553e62d28
Showing
4 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
checkbox1 checkbox2 | ||
Tests nested click event on label element with checkbox | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS document.getElementById('ch2').checked is true | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<input type="checkbox" name="ch1" id="ch1" value="1" /><label id="for_ch1" for="ch1">checkbox1</label> | ||
<input type="checkbox" name="ch2" id="ch2" value="2" /><label id="for_ch2" for="ch2">checkbox2</label> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script src="../../resources/js-test.js"></script> | ||
<script> | ||
description('Tests nested click event on label element with checkbox'); | ||
document.getElementById('ch1').addEventListener('click', function() { | ||
document.getElementById('for_ch2').click(); | ||
}, false); | ||
document.getElementById('for_ch1').click(); | ||
shouldBeTrue("document.getElementById('ch2').checked"); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters