Cross Reference: /yui3/src/base/tests/manual/baseevents.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Base Event Test</title>
<script src="/YuiWip/yui3/build/yui/yui-min.js" type="text/javascript"></script>
</head>
<body>
<script>
YUI({filter:"raw"}).use("base", function(Y) {
var Parent = Y.extend(function () {Y.Base.apply(this, arguments);}, Y.Base, null, {NAME:"parent"});
var parent = new Parent({
after: {
'child:test' : function(e) {
Y.log("parent after child:test [" + e.id + "]");
}
},
on: {
'child:test' : function(e) {
Y.log("parent on child:test [" + e.id + "]");
}
}
});
var parent2 = new Parent({
after: {
'child:test' : function(e) {
Y.log("parent2 after child:test [" + e.id + "]");
}
},
on: {
'child:test' : function(e) {
Y.log("parent2 on child:test [" + e.id + "]");
}
}
});
var Child = Y.extend(function () {Y.Base.apply(this, arguments);}, Y.Base, {
test: function() {
this.fire("test", {id:this.id});
},
// Default bubbleTargets
_bubbleTargets:parent
}, {
NAME:"child"
});
var c1 = new Child();
c1.id = "c1";
var c2 = new Child({
bubbleTargets:null // anything falsey
});
c2.id = "c2";
var c3 = new Child({
bubbleTargets:[parent, parent2]
});
c3.id = "c3";
c1.test();
c2.test();
c3.test();
});
</script>
</body>
</html>