On Tue, Feb 10, 2009 at 4:17 PM, Klaus Hartl <klaus.ha...@googlemail.com> wrote:
>
> I've created the ticket aready:
> http://dev.jqueryui.com/ticket/4109
>

Thanks, Klaus. I think I've sorted this out, actually. Although I'm
not certain of a fix.

I should have been logging this[0].tagName, not
inner(this)[0].tagName. The answer was staring me right in the face,
above that cleanup block:

var inner = function(parent) {
        var $parent = $(parent), $inner = $parent.find('*:last');
        return $inner.length && $inner.is(':not(img)') && $inner || $parent;
};


It's the $parent.find('*:last') that's the culprit. Wrapping the img
in a span does no good because the img, being deepest, will be
selected every time. Because we don't want the img returned, we'll
always get $parent--which won't ever be the parent of the IMG because
that's wrapped in the EM.

I changed that to:
$inner = $parent.find('*:not(img):last');

This works!

Of course, it fails if I have:
spinner: '<span><img src="/css/images/misc/spinner.gif" /></span>'

... because the SPAN will be returned by inner() instead of the desired EM.

So, it seems that there needs to be some other way to get the inner
element. Maybe the spinner option html fragment needs to be parsed and
the tags saved in data to better access them later?

Or, what if, instead of having the EM always, you instead made the
default to be:
<em>loading ...</em>

Don't wrap the user-provided HTML fragment inside of an EM and store
the data in the A instead of the EM. ... and, I'm not sure where I'm
going with this. I'll have to think about it some.

Anyway, this seems to be the problem.

Reply via email to