-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDom.html
58 lines (53 loc) · 1.51 KB
/
Dom.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
<!DOCTYPE html>
<html>
<head>
<title>Bonjour le monde</title>
</head>
<body>
Bonjour le monde
<div id="main"></div>
<script>
function creerElement(tagName, opts) {
return {
tagName,
attributs: opts.attributs,
enfants: opts.enfants,
};
};
function rendre(racine){
var doc = document.createElement('div');
if(doc.hasAttributes()){
for(var i =doc.length -1; i >=0; i--){
enfant.rendre(doc);
}
}
div.forEach(element => {
console.log(element);
},
)};
let div= creerElement('div', {
attributs: {
id: 'main',
},
enfants: [
creerElement('img', {
attributs: {
src: 'https://media.giphy.com/media/cdNSp4L5vCU7aQrYnV/giphy.gif',
},
}),
],
});
let img= creerElement('img',{
attributs:{},
enfants: [
creerElement('img', {
attributs: {
src: 'https://media.giphy.com/media/cdNSp4L5vCU7aQrYnV/giphy.gif',
},
}),
],
});
div.mount(document.getElementById(main))
</script>
</body>
</html>