Closed
Bug 254795
Opened 21 years ago
Closed 21 years ago
[FIXr]When using createEvent for a link middle-click, the normal click event also seems to get fired to the link
Categories
(Core :: DOM: Events, defect, P2)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
mozilla1.8alpha4
People
(Reporter: martijn.martijn, Assigned: bzbarsky)
Details
Attachments
(2 files, 1 obsolete file)
1.05 KB,
text/html
|
Details | |
2.01 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a3) Gecko/20040808 Firefox/0.9.1+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a3) Gecko/20040808 Firefox/0.9.1+
See upcoming testcase.
Clicking the button fires this function:
function openintab(sType,e) {
x.href='http://www.google.com';
var ev = document.createEvent("MouseEvents");
ev.initMouseEvent(sType, 0, 1, window, 1,0,0,0,0,0,0,0,0,1, x);
x.dispatchEvent(ev);
}
And that's working nice.
But when you left click on the button, not only the middle click action seems to
be fired on the dummy link, but also the left click action (although it is not
visible in the event listener).
The result is that not only a new link has been opened in a new tab, but also
the current tab gets replaced by the link location (http://www.google.com).
Reproducible: Always
Steps to Reproduce:
1. See testcase
2. Click button: 'open Google in new tab'
3.
Actual Results:
New tab appeared with 'http://www.google.com', but also this tab replaced with
'http://www.google.com'
Expected Results:
Only a new should appear with 'http://www.google.com'.
Reporter | ||
Comment 1•21 years ago
|
||
![]() |
Assignee | |
Comment 2•21 years ago
|
||
![]() |
Assignee | |
Comment 3•21 years ago
|
||
Comment on attachment 155527 [details] [diff] [review]
Fix
The short story is that InitEvent() sets the message based on the even name
only. That's not good enough in this case...
Attachment #155527 -
Flags: superreview?(jst)
Attachment #155527 -
Flags: review?(bryner)
Comment 4•21 years ago
|
||
Comment on attachment 155527 [details] [diff] [review]
Fix
sr=jst
Attachment #155527 -
Flags: superreview?(jst) → superreview+
Updated•21 years ago
|
Attachment #155527 -
Flags: review?(bryner) → review+
![]() |
Assignee | |
Updated•21 years ago
|
Assignee: events → bzbarsky
OS: Windows XP → All
Priority: -- → P2
Hardware: PC → All
Summary: When using createEvent for a link middle-click, the normal click event also seems to get fired to the link → [FIXr]When using createEvent for a link middle-click, the normal click event also seems to get fired to the link
Target Milestone: --- → mozilla1.8alpha4
![]() |
Assignee | |
Comment 5•21 years ago
|
||
Attachment #155527 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 6•21 years ago
|
||
Fix checked in for 1.8a4
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•