Closed
Bug 273494
Opened 20 years ago
Closed 20 years ago
If document.onmousedown is hooked, window.onmousedown is fired too
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: aceman, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 If document.onmousedown is hooked, window.onmousedown is fired too. Is that the correct behaviour? Reproducible: Always Steps to Reproduce: 1. write the JS code: 2. document.onmousedown=your_func() 3. window.onmousedown=your_func() 4. press a mouse button on the page Actual Results: The function will run twice. Expected Results: I would expect it to run only once, because the document has caught the event and should not pass (bubble) it forward to the window. Of course, if some spec says otherwise... The same happens with onmouseup. For referrence, IE 5.5-6 only runs the function once, even if you hook all 4 events.
Comment 1•20 years ago
|
||
mousdown does bubble: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-MouseEvent "The mousedown event occurs when the pointing device button is pressed over an element. This event is valid for most elements. * Bubbles: Yes * Cancelable: Yes"
Comment 2•20 years ago
|
||
Reporter, please examine this page. http://www.webreference.com/programming/javascript/dhtmlref/chap6/2/3.html Mozilla's event propagation is the same as NetScape 6 in the graphic http://www.webreference.com/programming/javascript/dhtmlref/chap6/2/fig61.gif at that url. Note that event sent to the document are not bubbling to the window object in MSIE. Bubbling from the document object to the window object is not part of the DOM 2 Event interface or part of any standards. It's outside specs. So what does MSIE and what does Mozilla is neither good or bad. For some events, like resize, the event will be relayed to the window object in MSIE. FWIW, Opera 7.x often (never?) does not relay bubbling events to the window object either. Resolving as INVALID
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
If we're breaking Web pages because we're doing something that's not required by a spec, we should at least have a good reason for it -- and if we do, then the proper resolution would be wontfix rather than invalid.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
comment 3: this page was optimized mainly for IE, but they probably wanted to be sure so they hooked everything they could. They saw no harm on IE and opera, but aren't aware of the problems on Mozilla. I will tell them about this, so don't worry. And the function doesn't do anything serious, so the page isn't broken, just annoying (shows things 4x instead of 1x). You probably mean, we should have IE parity if nothing (any standard) prohibits it. I would agree with that. But I wanted to be sure what the standards say, so for me this bug is invalid too. If you wish wontfix, we would have to change the summary to say '... do the same as IE'. Thanks guys.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•