On 8/2/05, Ben Curtis <[EMAIL PROTECTED]> wrote: > > Good catch. Now we're talking a good excuse for regular expressions. > Instead of my recommendation of: > > a[i].getAttribute('href').toUpperCase().indexOf("HTTP://") == 0 > > ...I now recommend: > > /^https?:\/\//i.test(a[i].getAttribute('href'))
Talk about technology for technology's sake! At least you admitted it ("good _excuse_ for regular expressions" ;) RegExp() is one of the top three resource hungry javascript functions to avoid. The other two biggies being eval( ) and setInterval. ( JS Gurus: please feel free to correct me on that one if you believe otherwise! ) I once had a reference sheet with all the js string manipulation methods in order of their speed; if I could find it you'd be clicking a link about now... I'd use this: if ( a[i].getAttribute('href').indexOf("://") >-1 ) { //do stuff } Cheers, Andrew. -------------------------------- http://leftjustified.net/ ****************************************************** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ******************************************************