Just to chime in: case does matter. It's only uppercase in HTML documents (it's in its original case in XHTML docs).
--John On 2/5/09, George Adamson <[email protected]> wrote: > > I'm assuming tagName always returns the tag in upper case but judging > by jQuery's use of /i on the regex maybe that is not the case for all > browsers. > > If converting to upper case is necessary then it does slow it down but > it's still faster than regex. > > A quick glance over the jquery code suggests we could use this > technique in place of at least 3 regex's: > > * /^body|html$/i.test(offsetParent.tagName) becomes > {BODY:true, HTML:true}[offsetParent.tagName] > * /^t(able|d|h)$/i.test(elem.tagName) becomes > {TABLE:true,TD:true,TH:true}[elem.tagName] > * /href|src|style/.test(name) becomes > {href:true,src:true,style:true}[name] > > Perhaps performance could be squeezed little further by defining the > hashes before they are used. > > George > > On Feb 5, 6:12 am, kangax <[email protected]> wrote: >> I believe this should have been `offsetParent.tagName.toUpperCase();` >> (to make it somewhat identical toregexpversion). >> Is there still a significant difference after adding case conversion? > > > > -- --John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
