-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
47 lines (44 loc) · 1.58 KB
/
index.html
File metadata and controls
47 lines (44 loc) · 1.58 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<p>Open dev tools to see the console.logged results of the</p>
<p>overridden functions</p>
<ul>
<li>Array.filter</li>
<li>String.toLocaleUpperCase</li>
<li>Node.childNodes</li>
<li>Date.now</li>
</ul>
<script>
// here we are overriding some native functions which our transpiled typescript
// will later attempt to use
window.Array.prototype.filter = ()=>"haha";
window.String.prototype.substr = ()=>"haha"
window.String.prototype.toLocaleUpperCase = ()=>"haha"
window.XMLHttpRequest.prototype.send = ()=>"haha xhr"
Object.defineProperty(Node.prototype, 'childNodes', {
get() {
if (this.surname) {
return `${this.surname}`;
} else {
return "haha"
}
},
set(value) {
this.surname = "name is: " + value;
}
});
Date.now = ()=>"haha";
</script>
<script src="app.js" type="text/javascript"></script>
<!-- uncomment iframe iframe.html to check loading a script on an iframe option -->
<!-- NOTE: Remember to comment out the app.js script too - don't run them together -->
<!-- <iframe src="iframe.html" style="border: 0; display:none"></iframe> -->
</body>
</html>