javascript - Y.Node addTarget event not bubbling -


why isn't event fired in foo bubbling bar?

var foo = y.one(".foo"),     bar = y.one(".bar");  foo.addtarget(bar);  foo.on("myevent", function () {     //this log statement executes     y.log("in foo listener"); });  bar.on("myevent", function () {     //this log statement doesn't execute.     //i don't understand why.  think     //should because expect myevent      //bubble foo bar since used     //addtarget     y.log("in bar listener"); });  foo.fire("myevent"); 

js fiddle: http://jsfiddle.net/steaks/tjnlf/

you have publish myevent foo , set emitfacade true. http://yuilibrary.com/yui/docs/event-custom/#facade

http://jsfiddle.net/tjnlf/27/

yui().use('event-custom', 'node', function(y) {     y.on('domready',function(e) {            var foo = y.one(".foo"),             bar = y.one(".bar");          foo.publish("myevent", {             emitfacade: true         });          foo.addtarget(bar);          foo.on("myevent", function () {             y.log("in foo listener");         });          bar.on("myevent", function () {             y.log("in bar listener");         });          foo.fire("myevent");     }); }); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -