Skip to main content

Bug Tracker

Side navigation

#9298 closed enhancement (fixed)

Opened May 16, 2011 01:42PM UTC

Closed May 16, 2011 02:21PM UTC

Last modified March 08, 2012 05:00PM UTC

$(elem).attr(eventName) not working properly in IE7

Reported by: s.ronak Owned by:
Priority: low Milestone: 1.6.2
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

http://jsbin.com/ociju4

Check this

IE7 returns value which is not proper as user has written.

Attachments (0)
Change History (9)

Changed May 16, 2011 02:21PM UTC by timmywil comment:1

resolution: → fixed
status: newclosed

Use getAttributeNode for ^on attributes in IE6/7 to avoid anonymous function wrapper. Fixes #9298.

Changeset: a5cf257a8a240f96f1ec255599fa1d1190f51ff5

Changed May 16, 2011 02:22PM UTC by timmywil comment:2

component: unfiledattributes
milestone: 1.next1.6.2
priority: undecidedlow

Changed May 16, 2011 02:48PM UTC by timmywil comment:3

#9299 is a duplicate of this ticket.

Changed May 16, 2011 03:07PM UTC by s.ronak comment:4

Replying to [comment:1 timmywil]:

Use getAttributeNode for ^on attributes in IE6/7 to avoid anonymous function wrapper. Fixes #9298. Changeset: a5cf257a8a240f96f1ec255599fa1d1190f51ff5

I don't this this fix will work. Can I've working example?

Changed May 16, 2011 03:18PM UTC by rwaldron comment:5

You can use this boilerplate to test the changes: http://jsfiddle.net/rwaldron/w49k8/

Changed May 16, 2011 03:19PM UTC by timmywil comment:6

_comment0: It does. IE6 and 7 wrap anything you put in inline event handlers with an anonymous function, which is why what you get back looks different. See the type check in IE6 or 7 in the fiddle created by this ticket's duplicate: http://jsfiddle.net/timmywil/nhExE/5/. All of this is not really a big concern to the jQuery team, but the fix was easy enough and short.1305559219444771

It does. IE6 and 7 wrap anything you put in inline event handlers with an anonymous function, which is why what you get back looks different. See the type check in IE6 or 7 in the fiddle created by this ticket's duplicate: http://jsfiddle.net/timmywil/nhExE/6/. All of this is not really a big concern to the jQuery team, but the fix was easy enough and short.

Changed May 17, 2011 05:52AM UTC by s.ronak comment:7

Replying to [comment:6 timmywil]:

It does. IE6 and 7 wrap anything you put in inline event handlers with an anonymous function, which is why what you get back looks different. See the type check in IE6 or 7 in the fiddle created by this ticket's duplicate: http://jsfiddle.net/timmywil/nhExE/6/. All of this is not really a big concern to the jQuery team, but the fix was easy enough and short.

Ok Timmy, you've fixed it. But what is jQuery edge?? And if I write elem.getAttributeNode('onclick') it returns object. What is the final solution implemented?

Changed May 17, 2011 02:50PM UTC by timmywil comment:8

jQuery edge is how jsfiddle refers to the git version of jQuery (I'm not sure why). See the list of libraries on jsfiddle. getAttributeNode does return objects (attribute nodes in fact), but you can then retrieve it's value.

elem.getAttributeNode("onclick").nodeValue

Changed May 18, 2011 06:00AM UTC by s.ronak comment:9

Replying to [comment:8 timmywil]:

jQuery edge is how jsfiddle refers to the git version of jQuery (I'm not sure why). See the list of libraries on jsfiddle. getAttributeNode does return objects (attribute nodes in fact), but you can then retrieve it's value.
> elem.getAttributeNode("onclick").nodeValue
> 

Hey, thanks Timmy. I know my bug was easy to solve, but still I'm super excited for next release as my query will be resolved in v1.6.2. Yeah...