-
Notifications
You must be signed in to change notification settings - Fork 0
/
lifecycle.html
126 lines (121 loc) · 2.83 KB
/
lifecycle.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Math Element Hooks Demo</title>
<script src="math_element_lifecycle.js"></script>
</head>
<body>
<p>A paragraph</p>
<p>And a paragraph with some inline <math display="inline">
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo>−</mo>
<mi>b</mi>
<mo>±</mo>
<msqrt>
<mrow>
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
<mo>−</mo>
<mn>4</mn>
<mi>a</mi>
<mi>c</mi>
</mrow>
</msqrt>
</mrow>
<mrow>
<mn>2</mn>
<mi>a</mi>
</mrow>
</mfrac>
</mrow>
</math> MathML.</p>
<p>Then some block style MathML:</p>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>σ</mi>
<mo>=</mo>
<msqrt>
<mrow>
<mfrac>
<mrow>
<mn>1</mn>
</mrow>
<mrow>
<mi>N</mi>
</mrow>
</mfrac>
<mstyle displaystyle="true">
<mrow>
<munderover>
<mrow>
<mo>∑</mo>
</mrow>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>N</mi>
</mrow>
</munderover>
<mrow>
<msup>
<mrow>
<mo stretchy="false">(</mo>
<msub>
<mrow>
<mi>x</mi>
</mrow>
<mrow>
<mi>i</mi>
</mrow>
</msub>
<mo>−</mo>
<mi>μ</mi>
<mo stretchy="false">)</mo>
</mrow>
<mrow>
<mn>2</mn>
</mrow>
</msup>
</mrow>
</mrow>
</mstyle>
</mrow>
</msqrt>
<mo>.</mo>
</mrow>
</math>
<p>And this is <em>the end</em>.</p>
<script>
(function () {
window.MathElementLifecycle.register({
created: function (node) {
console.log('created', node);
},
attached: function (node) {
console.log('attached', node);
},
detached: function (node) {
console.log('detached', node);
}
});
window.onload = function () {
var e = document.createElementNS(window.MathElementLifecycle.MML, 'math');
document.body.appendChild(e);
e = document.createElement('div');
e.innerHTML = '<span><math display="inline"><mi>x</mi></math></span>';
document.body.appendChild(e);
}
})();
</script>
</body>
</html>