Opened 12 years ago
Closed 11 years ago
#6772 closed defect (fixed)
dojo.hasAttr busts when node doesn't have the getAttributeNode function
Reported by: | ptwobrussell | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.2 |
Component: | HTML | Version: | 1.1.0 |
Keywords: | Cc: | ptwobrussell@… | |
Blocked By: | Blocking: |
Description
Since dojo.attr uses dojo.hasAttr this issue also affects it.
Test case is this (as of the nightly):
<html> <head> <title></title> <script type="text/javascript" src="http://o.aolcdn.com/dojo/1.1/dojo/dojo.xd.js" djConfig="isDebug:true"> </script> <script type="text/javascript"> dojo.addOnLoad(function() { //busts on FF (maybe elsewhere too) //because the nextSibling is " " and does not have getAttributeNode //would have expected false as the response console.log(dojo.hasAttr(dojo.byId("foo").nextSibling, "blah")); }); </script> </head> <body> <span id="foo">foo</span> <span>bar</span> </body> </html>
Maybe the fix is to simply make this change to the dojo.hasAttr function:
var attr = d.byId(node).getAttributeNode(_fixAttrName(name));
=>
var attr = d.byId(node).getAttributeNode ? d.byId.getAttributeNode(_fixAttrName(name)) : false;
I guess this is a corner case. I discovered the issue while having to walk part of the DOM and test some attributes on nodes.
Change History (5)
comment:1 Changed 12 years ago by
Component: | Core → HTML |
---|---|
Owner: | changed from anonymous to sjmiles |
comment:2 Changed 11 years ago by
Milestone: | → tbd |
---|
comment:3 Changed 11 years ago by
Can someone please apply this patch for 1.2? I ran into this same problem again last night while trying to process an xml document with dojo.query. Unless I'm missing something, the fix is trivial.
comment:4 Changed 11 years ago by
Milestone: | tbd → 1.2 |
---|---|
Owner: | changed from sjmiles to bill |
Status: | new → assigned |
Yah, I'll do it.
comment:5 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
mark all (open) tickets w/blank milestones to be "tbd"; their milestones need to be set to a version number or to "future"