Re: Mouseover/mouseout event stopping over shadow scopes in sXBL

I agree with Ian's analysis. I will expand on it (and hope Ian agrees with 
this).

Event flow follows the flattened tree. In this case, the flattened tree 
looks like this:

svg:svg
   ex:test1
      rect
      ex:test2
          circle

Thus, if I remember my DOM Events properly, capture starts with the 
Document object and descends to the target element, and bubbling starts 
with the target element and ascends to the Document object.

XBL adds the extra wrinkle with event marshalling at the shadow tree 
boundary such that a new Event object is created when you capture/bubble 
across the boundary per the rules documented at 
(http://www.w3.org/TR/sXBL/#event7).

Jon


At 07:39 AM 2/8/2005, Ian Hickson wrote:

>On Thu, 20 Jan 2005, Cameron McCormack wrote:
> >
> > Say you had this document:
> >
> >   <svg ...>
> >     <xbl:xbl>
> >       <xbl:definition element="ex:test1">
> >         <xbl:template>
> >         <rect width="100" height="100"/>
> >         <ex:test2/>
> >       </xbl:template>
> >       </xbl:definition>
> >       <xbl:definition element="ex:test2">
> >         <xbl:template>
> >         <circle cx="100" cy="100" r="50"/>
> >       </xbl:template>
> >       </xbl:definition>
> >     </xbl:xbl>
> >
> >     <ex:test1/>
> >   </svg>
> >
> > and the mouse was moved from over the circle to over the rect.
> > Would I be right in guessing that these are the events that should be
> > fired?
> >
> >   phase       type            target          currentTarget
> >
> >   CAPTURING   mouseout        ex:test2        ex:test1
> >   CAPTURING   mouseout        circle          ex:test2
> >   AT_TARGET   mouseout        circle          circle
> >   BUBBLING    mouseout        circle          ex:test2
> >   BUBBLING    mouseout        ex:test2        ex:test1
> >   CAPTURING   mouseover       rect            ex:test1
> >   AT_TARGET   mouseover       rect            rect
> >   BUBBLING    mouseover       rect            ex:test1
>
>No, the retargetting/stopping happens before you hit the bound element. If
>you move the mouse from over the circle to over the rect you get:
>
>     CAPTURING   mouseout        ex:test2        ex:test2
>     AT_TARGET   mouseout        circle          circle
>     BUBBLING    mouseout        ex:test2        ex:test2
>     AT_TARGET   mouseover       rect            rect
>
>Note that the target is also changed (you can get to the real target by
>looking up the originalEvent object) -- it is possible to tell that the
>event was redirected without looking at originalEvent because the target
>and currentTarget will be the same without the phase being AT_TARGET.
>
>--
>Ian Hickson               U+1047E                )\._.,--....,'``.    fL
>http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
>Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 8 February 2005 23:17:09 UTC