-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelementprops.html
112 lines (100 loc) · 3.32 KB
/
elementprops.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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>element</title>
<style>
body {background-color: white; color: black;}
</style>
</head>
<body>
<br><div><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement" target="blank">MDN HTMLAnchorElement</a></div>
<br><div id="output2"></div>
<br><hr>
<div><u>HTMLLinkElement</u></div>
<br><div id="output3"></div>
<br><hr>
<div><u>HTML Element</u></div>
<br><div id="output4"></div>
<br>
<script>
function sha1(str1){
for (var blockstart=0,
i = 0,
W = [],
H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0],
A, B, C, D, F, G,
word_array = [],
temp2,
s = unescape(encodeURI(str1)),
str_len = s.length;
i<=str_len;){
word_array[i>>2] |= (s.charCodeAt(i)||128)<<(8*(3-i++%4));
}
word_array[temp2 = ((str_len+8)>>6<<4)+15] = str_len<<3;
for (; blockstart <= temp2; blockstart += 16) {
A = H,i=0;
for (; i < 80;
A = [[
(G = ((s=A[0])<<5|s>>>27) + A[4] + (W[i] = (i<16) ? ~~word_array[blockstart + i] : G<<1|G>>>31) + 1518500249) + ((B=A[1]) & (C=A[2]) | ~B & (D=A[3])),
F = G + (B ^ C ^ D) + 341275144,
G + (B & C | B & D | C & D) + 882459459,
F + 1535694389
][0|i++/20] | 0, s, B<<30|B>>>2, C, D]
) {
G = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
}
for(i=5;i;) H[--i] = H[i] + A[i] | 0;
}
for(str1='';i<40;)str1 += (H[i>>3] >> (7-i++%8)*4 & 15).toString(16);
return str1
}
let el = document.getElementById("output2")
// HTMLAnchorElement
Object.keys(HTMLAnchorElement.prototype)
let props = Object.getOwnPropertyNames(HTMLAnchorElement.prototype) // includes the constructor
let output = sha1(props.join()) + " [" + props.length + "] unsorted<br>" + props.join(", ") + "<br><br>"
props.sort()
output += sha1(props.join()) + " [" + props.length + "] sorted<br>" + props.join(", ")
el.innerHTML = output
// HTMLLinkElement
el = document.getElementById("output3")
Object.keys(HTMLLinkElement.prototype)
props = Object.getOwnPropertyNames(HTMLLinkElement.prototype) // includes the constructor
output = sha1(props.join()) + " [" + props.length + "] unsorted<br>" + props.join(", ") + "<br><br>"
props.sort()
output += sha1(props.join()) + " [" + props.length + "] sorted<br>" + props.join(", ")
el.innerHTML = output
// from creep
const getHTMLElementVersion = () => {
return new Promise(resolve => {
try {
// create element
const id = 'html-element-version'
const element = document.createElement('div')
element.setAttribute('id', id)
// append element to dom
document.body.appendChild(element)
// get rendered element
const htmlElement = document.getElementById(id)
// get property keys in element object
const keys = []
for (const key in htmlElement) {
keys.push(key)
}
return resolve(keys)
} catch (error) {
return resolve(undefined)
}
})
}
let array = getHTMLElementVersion().then(response => {
el = document.getElementById("output4")
output = sha1(response.join()) + " [" + response.length + "] unsorted<br>" + response.join(", ") + "<br><br>"
response.sort()
output += sha1(response.join()) + " [" + response.length + "] sorted<br>" + response.join(", ") + "<br><br>"
el.innerHTML = output
})
</script>
</body>
</html>