Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Want to trap both click and double-click
- From: paul at juniperwebcraft.com (Paul Novitski)
- Subject: [Javascript] Want to trap both click and double-click
- Date: Tue Dec 19 12:00:28 2006
>On Mon, 18 Dec 2006 17:01:46 -0800 Paul Novitski wrote: >Is the ondblclick event not well-supported cross-browser? At 12/19/2006 06:07 AM, Mike Dougherty wrote: >[iirc] the last time I looked at it, the >dblclick method was an IE extension and is not supported by Fx. Here's a little research I did this morning, not yet backed up by personal experimention with event handlers: On Peter-Paul Koch's mouse events page <http://www.quirksmode.org/js/events_mouse.html> there's a demo that shows the following events firing on double-click: mousedown mouseup click mousedown mouseup click dblclick (I get identical results in both Firefox 2.0 and IE 6.) That is to say, both clicks are registered singly, then dblclick is added to the pile once the system has had a chance to measure the interval between the clicks. Therefore in order for dblclick to predominate it needs to cancel any conflicting click, mousedown, and mouseup events using a method such as the delay Mike described on December 18th. Koch comments: "The dblclick event is rarely used. Even when you use it, you should be sure never to register both an onclick and an ondblclick event handler on the same HTML element. Finding out what the user has actually done is nearly impossible if you register both. "After all, when the user double?clicks on an element one click event takes place before the dblclick. Besides, in Netscape the second click event is also separately handled before the dblclick. Finally, alerts are dangerous here, too. "So keep your clicks and dblclicks well separated to avoid complications." http://www.quirksmode.org/js/events_mouse.html#dblclick dblclick is listed in the Mozilla Developer Center's Gecko DOM Reference <http://developer.mozilla.org/en/docs/DOM:element.ondblclick> as an element event, with the footnote, "DOM Level 0. Not part of specification." from <http://www.w3.org/TR/DOM-Level-2-Events/glossary.html#dt-DOM-Level-0>: The term "DOM Level 0" refers to a mix (not formally specified) of HTML document functionalities offered by Netscape Navigator version 3.0 and Microsoft Internet Explorer version 3.0. In some cases, attributes or methods have been included for reasons of backward compatibility with "DOM Level 0". On the Event Listener page, dblclick is not listed: http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-mouseevents-h3 Instead, the initMouseEvent event has a detailArg parameter, defined as "Specifies the Event's mouse click count." Perhaps it was decided that, rather than treating double-click as a special case, it would be better to devise a general system for responding to N number of clicks to accommodate future GUI conventions more naturally. However, for what it's worth, it does appear that contemporary browsers do still have dblclick in their event vocabulary. Regards, Paul
- References:
- [Javascript] Want to trap both click and double-click
- From: Miles Thompson
- [Javascript] Want to trap both click and double-click
- From: Mike Dougherty
- [Javascript] Want to trap both click and double-click
- From: Paul Novitski
- [Javascript] Want to trap both click and double-click
- From: Mike Dougherty
- [Javascript] Want to trap both click and double-click
- Prev by Date: [Javascript] return \n
- Next by Date: [Javascript] get <a> position
- Previous by thread: [Javascript] Want to trap both click and double-click
- Next by thread: [Javascript] Out of office ...
- Index(es):