0
내 이벤트가 foo
에 발사되지 않는 이유는 무엇입니까? bar
?Y.Node addTarget 이벤트가 버블 링하지 않습니다.
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. I think it
//should because I expect myEvent to
//bubble from foo to bar since I used
//addTarget
Y.log("In bar listener");
});
foo.fire("myEvent");
JS 바이올린 : http://jsfiddle.net/steaks/tJnLf/
감사합니다! 나는이 대답을 막 쓰려고했다. –