-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathplayground.html
48 lines (37 loc) · 1.06 KB
/
playground.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
<!-- example/browser.html -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jstest</title>
</head>
<body>
<script src="./lib/mutant.js"></script>
<script type="text/javascript">
var div = document.createElement('DIV');
document.body.appendChild(div);
var img = document.createElement('IMG');
img.setAttribute('src','https://ci.testling.com/gitterhq/mutant.js.png?q=' + Date.now());
div.appendChild(img);
var count = 0;
function callback() {
count++;
if(count === 1) {
setTimeout(function() {
/* Insert a second one, after monitoring has started */
var img = document.createElement('IMG');
img.setAttribute('src','https://ci.testling.com/gitterhq/mutant.js.png?q=' + (Date.now() + 1));
div.appendChild(img);
}, 1);
return;
}
mutant.disconnect();
if(count !== 2) {
throw new Error('assert');
}
}
var Mutant = window.Mutant;
var mutant = new Mutant(div, callback);
</script>
</body>
</html>