/
index.html
52 lines (48 loc) · 1.45 KB
/
index.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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>mojule-h in browser</title>
<style>
html{ font-family: sans-serif; }
</style>
</head>
<body>
<script src="./dist/index.js"></script>
<script>
(function(){
'use strict'
var H = window.DomScript
// don't assume destructuring
var text = H.text
var comment = H.comment
var documentFragment = H.documentFragment
var element = H.element
var div = H.div
var p = H.p
var strong = H.strong
var input = H.input
var button = H.button
var fragment =
documentFragment(
comment('Whose line is it anyway?'),
div({id:'main'},
p('The quick brown fox jumps over the ',strong('lazy dog')),
input({type:'text',name:'firstName',placeholder:'Alex'})
),
comment('Fragment not (usually) necessary but make sure it works'),
documentFragment(
comment('Text not necessary but etc.'),
p(text('lol '),'wut')
),
button({type:'button', onclick:e=>alert('Clicked!')}, 'Click me'),
comment('But what if it is not in the spec?'),
element('customtag',{class:'kk'},
p('OK that works for me')
)
)
document.querySelector( 'body' ).appendChild( fragment )
})()
</script>
</body>
</html>