[whatwg] Inert nodes and element.click()

Ian Hickson ian at hixie.ch
Fri Jul 12 13:42:18 PDT 2013


On Thu, 23 May 2013, Matt Falkenhagen wrote:
>
> I have some questions about these concepts.
> 
> 1. For an inert element, what happens on element.click() or 
> element.dispatchEvent(new Event('click'))? The spec says an inert node 
> is treated as absent "for the purposes of targeting user interaction 
> events" [1]. My interpretation is that the element receives the 'click' 
> event as usual; the intent is to block actual user interaction, e.g., if 
> user the physically clicks on the element.

Right, inert="" has no effect on .click() (and certainly has no effect on 
manual dispatch; that works on anything, it just doesn't usually do 
anything surprising -- for example, it doesn't click a button or link the 
way that .click() does.) The inert="" attribute basically just makes 
clicks not work and prevents focusing (so you can't activate things by 
keyboard either).


> 2. The definition of element.click() seems ambiguous. The spec says:
> The click() method must run synthetic click activation steps on the element.
> [2] There is a 6 step algorithm for "synthetic click activation steps" followed
> by a separate 6 step algorithm for "when a pointing device is clicked". Below
> that is a note which seems to say "the above" happens when the click() method
> is called [3]. It's ambiguous what "the above" refers to and if it's the second
> algorithm, that seems to contradict the click() definition text.
> 
> [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#inert-subtrees
> [2] http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#activation
> [3] http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#run-synthetic-click-activation-steps

The notes are non-normative, but I've tried to clarify what it means. Let 
me know if it's still confusing.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list