Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22734

Re: Debugging Errors -- a conundrum -- I think

Message-ID <2206413.iZ0BqqUp4u@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2014-01-21 06:01 +0100
Subject Re: Debugging Errors -- a conundrum -- I think
Newsgroups comp.lang.javascript
References (5 earlier) <bk5es2F645gU1@mid.individual.net> <52dd8824$0$6563$9b4e6d93@newsspool4.arcor-online.net> <bk5mijF7pdgU1@mid.individual.net> <bk5o7pF84cqU1@mid.individual.net> <52ddb0fc$0$6549$9b4e6d93@newsspool4.arcor-online.net>

Show all headers | View raw


Christoph Michael Becker wrote:

> Mel Smith wrote:
>> <select id="uselectclub" style="margin-top:8px" name="selectclub"
>> size="4"
>>   onfocus="setFocusColor(this);shoaccoptbutt(true);"
>>   onclick="chkoptsel(this);">
> 
> If I'm not mistaken, the onclick and onfocus event handlers might
> interfere; especially the order of firing the events seems to be
> important.  You may check that with debug statements in the attribute's
> values, e.g.
> 
>   onfocus="console.log('onfocus');setFocusColor(this);
                                    ^^^^^^^^^^^^^^^^^^^^
Unnecessary these days.  There is the “:focus” CSS pseudo-class, and it is 
observed by recent layout engines not only for “a” elements:

<http://www.w3.org/TR/2011/REC-CSS2-20110607/selector.html#dynamic-pseudo-classes>
<http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#the-user-action-pseudo-classes-hover-act>

<http://caniuse.com/#feat=css-sel2>

>            shoaccoptbutt(true);"
>   onclick="console.log('onclick');chkoptsel(this);">
> 
> I don't know how the order of firing the events is specified, but it
> seems prudent to look that up and cater for eventual exceptions.

The “focus” event is being dispatched when the control receives the focus.

The “click” event is being dispatched when the pointer is positioned on the 
element, and the user pushes and releases a button of the pointing device 
(the event is not dispatched if the button causes a context menu to be 
displayed, so this is usually limited to the primary and tertiary buttons).

<http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#event-type-focus>
<http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#event-type-click>

The HTML “select” element appears to be special in that the “click” event is 
not dispatched when the element is focused with the pointing device if the 
“select” element is displayed as a drop-down list.  This is different when 
it is displayed as a list box (size > 1), or when the non-menu button is 
pushed and released on the drop-down list.  (Tested in Chromium 31.)


With Firebug it is not necessary to call console.log() for testing events.  
You can context-click an element in the “HTML” panel and “Log Events”.

<https://getfirebug.com/wiki/index.php/HTML_Panel>

With Chrome Dev Tools you can context-click an element and “Force [an] 
Element State”, e.g. “:focus”; it is also possible to do that in the 
“Styles” tab of the “Elements” panel by selecting the “Toggle Element State” 
button (a pointer cursor on a dotted rectangle).  Previous versions lost the 
state when you navigated to another element; current versions pin the state 
and mark this with a(n orange) dot on the left-hand side of the element.

<http://devtoolsecrets.com/secret/editing-styling-active-hover-focus-visited-states.html>

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Debugging Errors -- a conundrum -- I think "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-20 09:48 -0700
  Re: Debugging Errors -- a conundrum -- I think Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-20 17:59 +0100
    Re: Debugging Errors -- a conundrum -- I think "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-20 10:45 -0700
      Re: Debugging Errors -- a conundrum -- I think "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-20 12:50 -0700
        Re: Debugging Errors -- a conundrum -- I think Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-20 21:01 +0100
          Re: Debugging Errors -- a conundrum -- I think "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-20 13:22 -0700
            Re: Debugging Errors -- a conundrum -- I think Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-20 21:33 +0100
              Re: Debugging Errors -- a conundrum -- I think Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-20 21:42 +0100
              Re: Debugging Errors -- a conundrum -- I think "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-20 15:33 -0700
                Re: Debugging Errors -- a conundrum -- I think "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-20 16:02 -0700
                Re: Debugging Errors -- a conundrum -- I think Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-21 00:28 +0100
                Re: Debugging Errors -- a conundrum -- I think Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-21 06:01 +0100
                Re: Debugging Errors -- a conundrum -- I think "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-21 08:47 +0100
                Re: Debugging Errors -- a conundrum -- I think Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-21 13:01 +0100
                Re: Debugging Errors -- a conundrum -- I think John Harris <niam@jghnorth.org.uk.invalid> - 2014-01-22 15:18 +0000
                Re: Debugging Errors -- a conundrum -- I think Norman Peelman <npeelman@cfl.rr.com> - 2014-01-21 06:13 -0500
                Re: Debugging Errors -- a conundrum -- I think "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-21 10:01 -0700
          Re: Debugging Errors -- a conundrum -- I think Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-20 21:37 +0100

csiph-web