Open
Bug 679566
Opened 14 years ago
Updated 2 years ago
javascript opens dual windows
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
NEW
People
(Reporter: ecdowney, Assigned: smaug)
Details
(Whiteboard: TE?)
Attachments
(1 file, 4 obsolete files)
54.14 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110615151330
Steps to reproduce:
went to http://www.clearskyinstitute.com/ham
Actual results:
clicked on any item in the blue menu system. the item opened in two windows. This only happens in Firefox 6. It works correctly in all older versions.
Expected results:
the item should only open in one window.
Comment 1•14 years ago
|
||
Confirmed on Mozilla/5.0 (Windows NT 5.1; rv:8.0a1) Gecko/20110816 Firefox/8.0a1 ID:20110816030741
Only 1 window opens on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18 ID:20110614230723
Clicking on the link causes 2 windows to be opened. Clicking on the surrounding box only opens 1 window.
There is both a href with a _blank target and this function:
function tdMouseClick(theElement)
{
eval(obj+'(theElement).click()')
}
TE?
Version: 6 Branch → 8 Branch
Reporter | ||
Comment 2•13 years ago
|
||
Still happens in 6.0.1
Comment 3•13 years ago
|
||
Boris -> If a link has both a HREF target="_blank" and an onclick event should 2 windows be opened or is this a regression? 3.6 opens 1, FF > 4 opens 2 windows.
Code in comment 1
Whiteboard: TE?
Version: 8 Branch → 9 Branch
Reporter | ||
Comment 4•13 years ago
|
||
Still happens in 6.0.2.
![]() |
||
Comment 5•13 years ago
|
||
In general, the markup shown should in fact trigger the link twice. It didn't use to in older versions of Gecko because we did not support click() on links.
The things that confuse me are:
1) Why does the event click() fires not bubble back up to the cell and cause another
recursive click()?
2) Why is there only one window created in WebKit/Presto?
Olli, could you take a look?
Component: General → Event Handling
Product: Firefox → Core
QA Contact: general → events
Assignee | ||
Comment 6•13 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #5)
> 1) Why does the event click() fires not bubble back up to the cell and
> cause another
> recursive click()?
It does propagate back up, but click() has a flag for recursion prevention.
> 2) Why is there only one window created in WebKit/Presto?
Still investigating...
Assignee | ||
Comment 7•13 years ago
|
||
Aha, webkit doesn't have a.click(). Javascript console in Chrome tells that
"foobar" has no method click().
Opera seems to create only on click in this case, and so does IE.
The spec is wrong but need to figure out how to fix it.
Assignee | ||
Comment 8•13 years ago
|
||
This gives us the behavior IE and Opera have.
It is a bit strange behavior though.
<a>some text <span> some text</span> some text</a> breaks the behavior, if
one clicks inside <span>.
Assignee: nobody → Olli.Pettay
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Updated•13 years ago
|
Attachment #559123 -
Attachment is obsolete: true
Assignee | ||
Comment 9•13 years ago
|
||
Uploaded to tryserver. Needs tests.
Assignee | ||
Comment 10•13 years ago
|
||
Attachment #559399 -
Attachment is obsolete: true
Assignee | ||
Comment 11•13 years ago
|
||
Uploaded to try.
I need to still file a spec bug.
Attachment #559401 -
Attachment is obsolete: true
Assignee | ||
Comment 12•13 years ago
|
||
Seems like some XUL tests relies on the old behavior.
I'm not sure whether we should actually do this.
Posted to tryserver.
Attachment #561186 -
Attachment is obsolete: true
Reporter | ||
Comment 13•13 years ago
|
||
Still happens in 7.0.
Thanks for the on going efforts.
Assignee | ||
Comment 14•13 years ago
|
||
Yes, it happens because nothing has changed.
The question is whether to change the spec (FF does what the spec says), or whether the web page
should be modified.
Reporter | ||
Comment 15•13 years ago
|
||
If you tell me the code on that page is bad, I'll accept that. But then I'd like to know why it works fine on Safari, Chrome, Opera and even Firefox prior to 5.0.
![]() |
||
Comment 16•13 years ago
|
||
Elwood, before Firefox 5 we didn't have a "click" method on anchors, so the JS just threw an exception.
It works in Safari and Chrome because they also have no such click method; Olli said so clearly in comment 7.
Why Opera works is the open question; they're not doing what the spec says to do, but the question is _what_ they're doing.
Assignee | ||
Comment 17•13 years ago
|
||
So based on my testing both IE and Opera set some kind of internal flag to click target while
handling a click, and while that flag is set, the target can't receive other click events.
But the handling of the flag isn't the same in Opera and IE.
(Based on the spec, the flag should be set only when calling .click(), http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#dom-click)
In case like
<a href="http://www.mozilla.org" target="_blank">foo<span onclick="this.parentNode.click()">bar</span></a>
if one clicks 'bar' in IE, it opens two new windows, but Opera only one.
Reporter | ||
Comment 18•13 years ago
|
||
Ok, well I really appreciate all your efforts. I fiddled with the javascript on that page and got the problem to go away using 7.0.1. You can close this as far as I am concerned. Thanks everyone.
Assignee | ||
Comment 19•13 years ago
|
||
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•