1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
9 <input id=search type=search value=query
>
11 <div id=
"console"></div>
13 description('Bug 46950: Search field cancel button keeps event capturing if the value is cleared in a focus event.');
15 var input
= document
.getElementById('search');
16 var cancelX
= input
.offsetLeft
+ input
.offsetWidth
- 6;
17 var middleX
= input
.offsetLeft
+ input
.offsetWidth
/ 2
18 var middleY
= input
.offsetTop
+ input
.offsetHeight
/ 2;
19 var mouseDownCount
= 0;
20 input
.addEventListener('mousedown', function(event
) {
24 function clearValue(event
) {
27 input
.addEventListener('focus', clearValue
, false);
28 // Click the cancel button.
29 eventSender
.mouseMoveTo(cancelX
, middleY
);
30 eventSender
.mouseDown();
31 eventSender
.mouseUp();
32 // Click the input element. The event should not be captured by the cancel button.
33 eventSender
.mouseMoveTo(middleX
, middleY
);
34 eventSender
.mouseDown();
35 eventSender
.mouseUp();
37 shouldBe('mouseDownCount', '2');
38 input
.removeEventListener('focus', clearValue
, false);