Opened 9 years ago
Closed 7 years ago
#17019 closed defect (patchwelcome)
dom-prop.set() fails remove old function.
Reported by: | ysobj | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | undecided | Milestone: | 1.13 |
Component: | HTML | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
dom-prop.set() can't remove function.
reproduce:
source
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <script src="dojo/dojo.js" data-dojo-config="async: true"></script> <script> require(['dojo/dom-attr','dojo/domReady!'], function(domAttr){ domAttr.set('btna',{onclick:function(e){ console.log('a1'); }}); domAttr.set('btna',{onclick:function(e){ console.log('a2'); }}); domAttr.set('btnb',{onclick:function(e){ console.log('b1'); }}); domAttr.set('btnb',{onclick:function(e){ console.log('b2'); }}); }); </script> <button id="btna">button A</button> <button id="btnb">button B</button> </body> </html>
click button a
a1 a2
click button b
b2
dom-props has a variable '_ctr' that start with 0. I think that variable should be start with 1.
'dom-props.js' around line 150
if(lang.isFunction(value)){ // special case: assigning an event handler // clobber if we can var attrId = node[_attrId]; if(!attrId){ attrId = _ctr++; node[_attrId] = attrId; }
This "if(!attrId)" is the cause of this bug.
Change History (2)
comment:1 Changed 9 years ago by
Component: | General → HTML |
---|---|
Owner: | set to Eugene Lazutkin |
comment:2 Changed 7 years ago by
Milestone: | tbd → 1.12 |
---|---|
Resolution: | → patchwelcome |
Status: | new → closed |
Given that no one has shown interest in creating a patch in the past 2+ years, I'm closing this as patchwelcome.
Note: See
TracTickets for help on using
tickets.
dom-prop or dom-attr? Half the time you mention one and the other half you mention the other.