[jquery-dev] Re: A element click event, event.target.pathname

2009-06-18 Thread Karl Swedberg
On Jun 18, 2009, at 3:42 PM, Daniel Friesen wrote:


 Another option you have is grabbing .attr('href') and using a regex to
 extract the portion you want.

Yeah, that's what I do. Something like this:

this.pathname.replace(/^\//,'')

removes the initial slash

or

this.pathname.replace(/(^[^/])/,'/$1')

adds an initial slash if it isn't already there.

--Karl

 pbcomm wrote:
 I'm working with A elements and checking the pathname on click to
 provide different actions depending on link (href) path.
 But I do see what you mean, it will require setting the pathname
 property on the element.

 On Jun 18, 3:24 pm, John Resig jere...@gmail.com wrote:

 Unfortunately that would involve changing the property on the DOM
 object itself, which is something that jQuery doesn't handle.

 Which element(s) are you working with that have the pathname  
 associated with it?

 --John



 On Thu, Jun 18, 2009 at 2:06 PM, pbcommpbc...@gmail.com wrote:


 The pathname property of links is missing a leading slash on IE  
 and I
 was wondering if this should be the fix event functionality.




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
jQuery Development group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~--~~~~--~~--~--~---



[jquery-dev] Re: A element click event, event.target.pathname

2009-06-18 Thread pbcomm

True. On the other hand that would mean calling more functions and
using slow regex.
I would think prepending / if .browser.msie is faster.

On Jun 18, 3:42 pm, Daniel Friesen nadir.seen.f...@gmail.com wrote:
 Another option you have is grabbing .attr('href') and using a regex to
 extract the portion you want.

 ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]



 pbcomm wrote:
  I'm working with A elements and checking the pathname on click to
  provide different actions depending on link (href) path.
  But I do see what you mean, it will require setting the pathname
  property on the element.

  On Jun 18, 3:24 pm, John Resig jere...@gmail.com wrote:

  Unfortunately that would involve changing the property on the DOM
  object itself, which is something that jQuery doesn't handle.

  Which element(s) are you working with that have the pathname associated 
  with it?

  --John

  On Thu, Jun 18, 2009 at 2:06 PM, pbcommpbc...@gmail.com wrote:

  The pathname property of links is missing a leading slash on IE and I
  was wondering if this should be the fix event functionality.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
jQuery Development group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~--~~~~--~~--~--~---



[jquery-dev] Re: A element click event, event.target.pathname

2009-06-18 Thread Daniel Friesen

Regexes aren't slow. Regex stuff on strings is actually quite fast, and 
from the standpoint of practical speed there is no significant difference.

An example of what you're trying to do that I could fix up would be handy.

~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

pbcomm wrote:
 True. On the other hand that would mean calling more functions and
 using slow regex.
 I would think prepending / if .browser.msie is faster.

 On Jun 18, 3:42 pm, Daniel Friesen nadir.seen.f...@gmail.com wrote:
   
 Another option you have is grabbing .attr('href') and using a regex to
 extract the portion you want.

 ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]



 pbcomm wrote:
 
 I'm working with A elements and checking the pathname on click to
 provide different actions depending on link (href) path.
 But I do see what you mean, it will require setting the pathname
 property on the element.
   
 On Jun 18, 3:24 pm, John Resig jere...@gmail.com wrote:
   
 Unfortunately that would involve changing the property on the DOM
 object itself, which is something that jQuery doesn't handle.
 
 Which element(s) are you working with that have the pathname associated 
 with it?
 
 --John
 
 On Thu, Jun 18, 2009 at 2:06 PM, pbcommpbc...@gmail.com wrote:
 
 The pathname property of links is missing a leading slash on IE and I
 was wondering if this should be the fix event functionality.
   
 
   

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
jQuery Development group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~--~~~~--~~--~--~---