> > In this case you are fixing a bug that happens to appear in one 
> > browser, but why limit the fix to only that browser? What 
> > if another browser based on Safari comes out but has a
> > different user agent string and isn't recognized by jQuery?
> > Wouldn't you still want the bug to be fixed? What harm
> > would it cause to leave out the browser check?

> Why fix something that isn't broken?  You can play the 
> hypothetical both ways without satisfaction.  What if another 
> browser comes out that breaks when this fix is applied?  It's 
> a pragmatic solution to a problem that exists today.

In general, I agree with you. But look at the specific code again:

      // check if target is a textnode (safari)
      if (jQuery.browser.safari && event.target.nodeType == 3)
        event.target = originalEvent.target.parentNode;

The purpose of this code is to detect when event.target is a text node and
substitute the parent node instead.

The only reason to make this specific to Safari would be if we *want* to
allow event.target to be a text node in other browsers. But we don't want
event.target to be a text node, in any browser. We'd always want to get the
parent node in such a situation, even if it happened in some unknown future
browser.

-Mike

Reply via email to