Animal
2 Dec 2006, 11:39 AM
I think it's to do with passing scope || this into YAHOO's remove listener. If I declare a listener with no scope (such as one bound with yui-ext function extensions), and then remove it with no scope, it's never removed:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script src="js/yahoo.js" type="text/javascript"></script>
<script src="js/dom.js" type="text/javascript"></script>
<script src="js/event.js" type="text/javascript"></script>
<script src="js/animation.js" type="text/javascript"></script>
<script src="js/dragdrop.js" type="text/javascript"></script>
<script src="js/yui-ext.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/yui-ext.css"></link>
<script type="text/javascript">
YAHOO.util.Event.addListener(window, "load", function()
{
var e = getEl("foo");
e.on("click", test);
e.removeListener("click", test);
});
function test()
{
alert("clicked");
}
</script>
</head>
<body>
<div id="foo" style="background-color:red;height:50px;width:100px"></div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script src="js/yahoo.js" type="text/javascript"></script>
<script src="js/dom.js" type="text/javascript"></script>
<script src="js/event.js" type="text/javascript"></script>
<script src="js/animation.js" type="text/javascript"></script>
<script src="js/dragdrop.js" type="text/javascript"></script>
<script src="js/yui-ext.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/yui-ext.css"></link>
<script type="text/javascript">
YAHOO.util.Event.addListener(window, "load", function()
{
var e = getEl("foo");
e.on("click", test);
e.removeListener("click", test);
});
function test()
{
alert("clicked");
}
</script>
</head>
<body>
<div id="foo" style="background-color:red;height:50px;width:100px"></div>
</body>
</html>