-
Notifications
You must be signed in to change notification settings - Fork 0
/
leak.html
42 lines (41 loc) · 961 Bytes
/
leak.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
/* document.write('object between js and dom');
function f(ele){
this.eleref=ele;
ele.prop=this;
}
function leak(){
for(var i=0;i<1000;i++){
new f(document.getElementById('a1'))
}
}
window.onload=function(){
var obj=document.getElementById('a1');
obj.onclick=function(){
alert('leak');
}
obj.str=new Array(1000).join(new Array(2000).join("==="))
}*/
var x={
length:0,
add:function(num){
Array.prototype.push.call(this,num)
},
addArray:function(ary){
Array.prototype.push.apply(this,ary)
}
}
x.add(1);x.add(2);x.add(3);
x.addArray([4,5,6])
console.log(x)
</script>
</head>
<body>
<!--<div id="a1">qqqq</div>-->
</body>
</html>