mouse.js
1.25 KB
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
define(["doh", "dojo/mouse", "dojo/on"], function(doh, mouse, on){
doh.register("tests.on", [
function mouseenter(t){
var order = [];
var div = document.body.appendChild(document.createElement("div"));
div2 = div.appendChild(document.createElement("div"));
div2.className = "item two";
div2.id = 2;
div3 = div.appendChild(document.createElement("div"));
div3.className = "item three";
div3.id = 3;
div4 = div2.appendChild(document.createElement("div"));
on(div, on.selector(".item", mouse.enter), function(){
order.push(this.id);
});
on.emit(div, "mouseover", {
bubbles: true,
relatedTarget: document.body
});
on.emit(div3, "mouseover", {
bubbles: true,
relatedTarget: div
});
on.emit(div3, "mouseover", {
bubbles: true,
relatedTarget: div3
});
on.emit(div2, "mouseover", {
bubbles: true,
relatedTarget: div3
});
on.emit(div4, "mouseover", {
bubbles: true,
relatedTarget: div2
});
on.emit(div2, "mouseover", {
bubbles: true,
relatedTarget: div4
});
on.emit(div, "mouseover", {
bubbles: true,
relatedTarget: div2
});
on.emit(div4, "mouseover", {
bubbles: true,
relatedTarget: div
});
t.is(order, [3, 2, 2]);
}
]);
});