Side navigation
#7994 closed bug (wontfix)
Opened January 17, 2011 10:02PM UTC
Closed January 20, 2011 03:05PM UTC
Last modified March 10, 2012 11:53AM UTC
.attr('href', ...) may change the text part.
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | attributes | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
On IE8, I have element <a href="http://testurl">test@test</a>
and use .attr('href', 'http://testurl2') to change the href. But the text part (test@test) is changed to http://testurl2 too.
The repro is at: http://jsfiddle.net/7x3RV/2/
Attachments (0)
Change History (5)
Changed January 17, 2011 10:52PM UTC by comment:1
component: | unfiled → attributes |
---|---|
priority: | undecided → low |
Changed January 17, 2011 10:56PM UTC by comment:2
status: | new → open |
---|
Changed January 18, 2011 01:48AM UTC by comment:3
This is a bug in IE not jQuery as this test case demonstrates.
Related information found by quick googling
- http://webbugtrack.blogspot.com/2008/07/bug-140-changing-mailto-links-error-in.html
- http://social.msdn.microsoft.com/forums/en-US/iewebdevelopment/thread/aa6bf9a5-0c0b-4a02-a115-c5b85783ca8c
I'm not sure if this is fixable.
Changed January 18, 2011 09:49AM UTC by comment:4
Well a fix would add, imo, too much overhead. As jitter's second link mentions (though i put in a check for the @ before bothering with replacing crap)
var $a = $(this), // assuming your link element in a click handler or whatever old = $a.html(); $a.attr('href', '//whaver'); // set the href if ( old.match( /@/ ) ) { // or indexOf , whatever $a.html( old ); }
Changed January 20, 2011 03:05PM UTC by comment:5
resolution: | → wontfix |
---|---|
status: | open → closed |
Given that there is a workaround for this but the workaround is impractical to get into jQuery core I close this one.