-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathframe.html
160 lines (142 loc) · 4.85 KB
/
frame.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="../../node_modules/es6-promise/dist/es6-promise.auto.js"></script>
<script src="../../node_modules/whatwg-fetch/fetch.js"></script>
<script>
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
window.requestAnimationFrame = function(callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window.cancelAnimationFrame)
window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
}());
/**
* Custom event factories for cross-browser compatibility
*
* Gecko browsers are using non-standard `initKeyEvent`, where others implemented `initKeyboardEvent`.
* To make it more consistent, we try to use standardized `MouseEvent`/`KeyboardEvent` now
* and fallback to older implementations for legacy browsers only.
*
* See deprecation notes:
* https://developer.mozilla.org/en-US/docs/Web/API/Document/createEvent
* https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyEvent
* https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent
*
* References:
* https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent#Specifications
* https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Specifications
*/
function createMouseEvent (options) {
var options = {
bubbles: true,
cancelable: true,
view: window
}
if ('MouseEvent' in window) {
return new MouseEvent('click', options);
} else {
var event = document.createEvent('MouseEvent');
event.initMouseEvent(
'click',
options.bubbles,
options.cancelable,
options.view
);
return event;
}
}
function createKeyboardEvent (key) {
var options = {
bubbles: true,
cancelable: true,
view: window,
key: key || 'a'
}
options.charCode = options.key.charCodeAt();
if ('KeyboardEvent' in window) {
return new KeyboardEvent('keypress', options);
} else {
var event = document.createEvent('KeyboardEvent');
event.initKeyboardEvent(
'keypress',
options.bubbles,
options.cancelable,
options.view,
options.key,
options.charCode
);
return event;
}
}
</script>
<script src="../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../build/raven.js"></script>
<script>
// stub _makeRequest so we don't actually transmit any data
Raven._makeRequest = function () {};
// store references to original, unwrapped built-ins in order to:
// - get a clean, unwrapped setTimeout (so stack traces don't include
// frames from mocha)
// - make assertions re: wrapped functions
window.originalBuiltIns = {
setTimeout: setTimeout,
setInterval: setInterval,
requestAnimationFrame: requestAnimationFrame,
xhrProtoOpen: XMLHttpRequest.prototype.open,
headAddEventListener: document.head.addEventListener, // use <head> 'cause body isn't closed yet
headRemoveEventListener: document.head.removeEventListener
};
window.ravenData = [];
Raven.config('https://[email protected]/1', {
dataCallback: function (data) {
ravenData.push(data);
}
}).install();
function bar() {
baz();
}
function foo() {
bar();
}
function foo2() {
// identical to foo, but meant for testing
// different stack frame fns w/ same stack length
bar();
}
</script>
</head>
<body>
<!-- test element for breadcrumbs -->
<form id="foo-form">
<input name="foo" placeholder="lol"/>
<div class="contenteditable" contenteditable="true"></div>
</form>
<div class="c">
<div class="b">
<div class="a"/>
</div>
</div>
</body>
</html>