JELaVallee / base2

Automatically exported from code.google.com/p/base2
0 stars 0 forks source link

bug when removing an event listener #97

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In my code I have a listnere that should be exectued once, so I remove it
the first time it's executed :
var upListener = function(e) {
                document.removeEventListener("mousemove", moveListener, false);
                this.removeEventListener('click',arguments.callee,false);
            }

It result in :
Firebug's log limit has been reached. %S entries not shown.     Preferences  
[Exception... "Illegal operation on WrappedNative prototype object"
nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS
frame :: http://localhost:5000/static/base2/lib/src/base2-dom.js ::
anonymous :: line 116" data: no]
[Break on this error] var fn = new Function(args.join(",...m](%3)", name,
args[0], args.slice(1)));

This code worked with beta2

Original issue reported on code.google.com by bchesn...@gmail.com on 25 Aug 2008 at 3:18

GoogleCodeExporter commented 9 years ago
var upListener = function(e) {
                document.removeEventListener("mousemove", moveListener, false);
                this.removeEventListener('mouseup',arguments.callee,false);
       }

Original comment by bchesn...@gmail.com on 25 Aug 2008 at 5:00

GoogleCodeExporter commented 9 years ago
full code how are handle event : http://friendpaste.com/LG2eqxNd

Original comment by bchesn...@gmail.com on 25 Aug 2008 at 5:05

GoogleCodeExporter commented 9 years ago
quick an dirty patch to fix it. It seem that the problem is teh wrappinf of 
removeEventListener function. 

Original comment by bchesn...@gmail.com on 25 Aug 2008 at 10:47

Attachments:

GoogleCodeExporter commented 9 years ago
Do you have a more complete test case?

Original comment by dean.edw...@gmail.com on 26 Aug 2008 at 2:12

GoogleCodeExporter commented 9 years ago
Here is full js code : 
http://friendpaste.com/7kDySgjt

It basicaly react when you click on a link <a href="#" 
class="createItem'>create</a> and fill a <div 
id="#createDesk"></div> in the page.

hope it could help.

Original comment by bchesn...@gmail.com on 26 Aug 2008 at 2:34

GoogleCodeExporter commented 9 years ago
It's OK, I can recreate the problem now.

Original comment by dean.edw...@gmail.com on 26 Aug 2008 at 2:40

GoogleCodeExporter commented 9 years ago
This is now fixed in the trunk:

http://base2.googlecode.com/svn/trunk/lib/

Original comment by dean.edw...@gmail.com on 26 Aug 2008 at 8:21

GoogleCodeExporter commented 9 years ago
Thanks for the fix. however I still have the problem with firefox running on 
mac. and I hink it will create the 
error on linux too. +Why not using @!gecko rather than  
"@Linux|Mac|opera|webkit[1-4]" ?

Original comment by bchesn...@gmail.com on 26 Aug 2008 at 8:59

GoogleCodeExporter commented 9 years ago
Sorry. You're right. "@!gecko" is probably what I want. :-)

Original comment by dean.edw...@gmail.com on 27 Aug 2008 at 12:17

GoogleCodeExporter commented 9 years ago
Fixed. Please verify.

Original comment by dean.edw...@gmail.com on 27 Aug 2008 at 2:30

GoogleCodeExporter commented 9 years ago
tested this morning, it works now. Thanks :)

Original comment by bchesn...@gmail.com on 27 Aug 2008 at 8:31