1 function addDivElement(id, parentId) {
2 var element = document.createElement('div');
3 element.setAttribute('id', id);
4 if (parentId === 'body')
5 document.body.appendChild(element);
7 document.getElementById(parentId).appendChild(element);
10 function generateDom() {
11 addDivElement('container', 'body');
12 addDivElement('composited-background', 'container');
13 document.getElementById('composited-background').innerText = 'Text behind the orange box.';
14 addDivElement('ancestor', 'container');
15 addDivElement('composited-overlap-child', 'ancestor');