Side navigation
#11739 closed bug (invalid)
Opened May 08, 2012 08:51PM UTC
Closed May 08, 2012 08:55PM UTC
Last modified May 08, 2012 09:30PM UTC
Attr on a "javascript:" will return a function in IE 7
Reported by: | Kumu | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Came across issue when trying to calling:
$("#dropdownid").attr("onchange") in IE7
$("#dropdownid").attr("onchange") value is "javascript:dosomething()"
on other browsers it returns a string of "javascript:dosomething()" which is the correct behavior defined in the documents, but when running this function in IE7 it returns a function:
function onchange(){ dosomething(); }
Suggestion:
ret = elem.getAttribute( name ); if(typeof ret === "function"){ //use getAttributeNode only if needed due to efficiency ret = elem.getAttributeNode(name); }
Attachments (0)
Change History (2)
Changed May 08, 2012 08:55PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Changed May 08, 2012 09:30PM UTC by comment:2
The specific issue here is that IE7 treats attributes and properties the same, kind of like jQuery itself did before 1.6.
I don't understand what kind of code is looking at the onchange
attribute string and trying to do something with it. If you just need to know if one is present, that is still possible given what is currently returned. Otherwise, this probably applies: http://docs.jquery.com/Won't_Fix#Inline_Event_Handlers
inline event handlers are treated as properties, not attributes.