Re: Proposal for CSS 'pointer-events' property

I had some notes in the HTML5 spec about what IE does for hit testing. It 
was brought to my attention that the general consensus is that this should 
be solved by applying the 'pointer-events' property to all content.

Since some interest has been expressed regarding the notes I had, I have 
included them below.

I have also removed this issue from HTML5, under the assumption that the 
CSS specifications will at some future point deal with the issue.


HIT TESTING TRANSPARENCY

Definition: IE considers a point of an element "transparent" if any
one of the following are true:

 1. All of the following are true:
    a: The computed value of 'background-image' is 'none', and
    b: The computed value of 'background-color' is 'transparent', and
    c: The point is over a pixel of an AlphaImageLoader filter image
       that has an alpha value of 0 (fully transparent), or the
       element does not have an AlphaImageLoader filter applied;

 2. The point is outside the element's CSS clip rectangle;

 3. The computed value of 'visibility' is 'hidden';

 4. The element is a transparent IFRAME (in IE, an IFRAME with the
    custom attribute "allowtransparency");

 5. The element is an OBJECT with the custom attribute "wmode" set to 
    "transparent" and the point in question is fully transparent.

Given those definitions, when a mouse event occurs, IE finds the
target element as follows:

   A. Take the topmost node that is under the point where the pointer
      was for the event. For CSS boxes, borders, padding areas and
      content areas are considered part of the node, margins and
      leading generated by the 'line-height' property are not.

   B. If there is no node at that point, no event is fired. STOP.

   C. If the node is a text node, then the event is fired at the text
      node's nearest ancestor element node. STOP.

   D. If the node is not an element, assign the node's nearest
      ancestor element node to a variable X. Otherwise, assign the
      element node itself to X.

   E. If the element X is the BODY element or the HTML element and its
      document is not the document of a transparent IFRAME, goto step
      H. Similarly, if the element X is a TABLE element, or is an IMG
      element, goto step H.

   F. If the point where the pointer was is, per the above definition,
      a point that on the element X is transparent, then ignore that
      element and assign the element that is below that element in the
      stacking order to X. If there is no element below X, or if the
      point on X is not transparent and so the previous condition
      doesn't apply, then leave X as is and go straight to step H.

   G. Goto step E.

   H. If the element X is now a BODY or TABLE element, but the element
      assigned to X in step D was some other element, assign the
      element originally assigned in step D back to X.

   I. The event goes to X. STOP

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

Received on Tuesday, 10 February 2009 01:19:22 UTC