I have an analytics library, built with jQuery 1.1.x.  (It is my hope
to eventually make it into a plugin, but currently it is very tied to
our customer).  It registers a click event on the document, and then
inspects the target to see whether the clicked element will trigger a
navigation (e.g., a link, a form submit, etc.).  It needs to handle a
variety of different elements, and record different pertinent
information for each.

This piece of code worked well in 1.1, and fails in 1.2:
        var target = $(event.target).add($
(event.target).parents()).filter("[EMAIL PROTECTED], :submit, 
:image").filter(":first");
        if (!target.length) { return; }
        var params = {
                type: "navigation",
                // an image source, button value, or link text
                item: $(event.target).attr("src") || target.val() || 
target.text(),
                // passed in value, link href, or form action
                destination: dest || target.attr("href") ||
target.parents("form").filter(":first").attr("action")
        };
        ...

After some debugging, it seems as though it is the target.val()
statement which is failing.  In 1.1 it failed silently (returned null)
and moved on to the target.text() value.

I can probably find a workaround, at some cost in brevity, but I did
not expect this delta when upgrading to 1.2.

oliver

Reply via email to