// then, i define toggleOptions and togglePlay and so on...
});
Basically, I'm creating a Track behavior. A track has some links in
it, including .track_link and .play_link. Ok, but I get stuck:
1. "e" doesn't seem to be the event, it seems to be the target - is
this correct or am I smoking crack? I don't really need the event (i
don't think), but in the example on the danwebb blog, you explicitly
pass e.target.
2. In these two functions that I'm calling (like toggleOptions) if I
return false in the method, the event continues to bubble. Is this
right? I can change it to be
return this.toggleOptions(e)
with toggleOptions or even manually return false, in which case then
the event stops bubbling.
and this brings me to...
3. For some odd reason, I can only match against 1 selector. So, in
the above example, I can match either .track_link OR .play_link,
basically, whichever comes first.
HALP!
I'm very excited by what I *could* be doing once I get this working,
but something seems fishy here (else I'm having a bad coding day.)
In the end, I needed to satisfy the case that the source element
matched and the parent of the source matches with the precedence going
first to the source element.
Now, I'm sure this isn't the most beautiful way of going about things,
but it works, giving priority to matching against the source element
before checking parents.
In a way, allowing the source element to be a child opens a can of
worms: I'm willing to bet that someone out there (or me soon) is going
to need even more fine-grained precedence matching, wanting the
closest event to the source to fire ;)
Sorry, I've already got this checked in to my local git repos ready to push out to github but I have my first son on tuesday so haven't had a chance to read this list until now. Still hopefully working out how to fix it was educational :)
On Sat, Mar 29, 2008 at 6:38 PM, Sudara <markswilli...@gmail.com> wrote:
> Now, I'm sure this isn't the most beautiful way of going about things, > but it works, giving priority to matching against the source element > before checking parents.
This is an interesting point. I'll see what the implications might be. I think the times when it becomes an issue are really infrequent but as you say could be a pain.
Indeed, stepping through the low pro code for jquery was
enlightening.
Before, the code was a grey mass of WTF. Now, I understand where and
how everything is happening. Still working on the why, your
metaprogramming chops go beyond my comprehension.
Sudara
On 29 Mar, 20:30, "Dan Webb" <d...@danwebb.net> wrote:
> Sorry, I've already got this checked in to my local git repos ready to
> push out to github but I have my first son on tuesday so haven't had a
> chance to read this list until now. Still hopefully working out how
> to fix it was educational :)
> On Sat, Mar 29, 2008 at 6:38 PM, Sudara <markswilli...@gmail.com> wrote:
> > Now, I'm sure this isn't the most beautiful way of going about things,
> > but it works, giving priority to matching against the source element
> > before checking parents.
> This is an interesting point. I'll see what the implications might
> be. I think the times when it becomes an issue are really infrequent
> but as you say could be a pain.
> 3. For some odd reason, I can only match against 1 selector. [...] > basically, whichever comes first.
Apologies for digging up an old post but i believe this bug (Item #3 in the OP) still exists in both Dan's and Sudara's branches. In Sudara's fork the bug only shows up if none of the selectors match the event target itself _and_ the parent selector we want matched isn't the first in the ruleset.