#9298 closed enhancement (fixed)
$(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
Change History (9)
comment:1 follow-up: 4 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
Component: | unfiled → attributes |
---|---|
Milestone: | 1.next → 1.6.2 |
Priority: | undecided → low |
comment:4 Changed 12 years ago by
Replying to 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?
comment:5 Changed 12 years ago by
You can use this boilerplate to test the changes: http://jsfiddle.net/rwaldron/w49k8/
comment:6 follow-up: 7 Changed 12 years ago by
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.
comment:7 Changed 12 years ago by
Replying to 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?
comment:8 follow-up: 9 Changed 12 years ago by
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
comment:9 Changed 12 years ago by
Replying to 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...
Use getAttributeNode for on attributes in IE6/7 to avoid anonymous function wrapper. Fixes #9298.