Skip to content
Snippets Groups Projects
Commit b832b9ab authored by Thomas Fritsch's avatar Thomas Fritsch
Browse files

B.3.3. gestion autoclosing tag

parent c723fecc
Branches
No related tags found
No related merge requests found
......@@ -32,11 +32,16 @@ class Component {
}
render() {
return `<${this.tag}>
${this.children ? this.children : ''}
</${this.tag}>`;
return `<${this.tag} ${
this.children ?
`>${this.children}</${this.tag}>` :
' />'
}`;
}
}
const title = new Component( 'h1', 'La carte' );
document.querySelector('.pageTitle').innerHTML = title.render();
\ No newline at end of file
document.querySelector('.pageTitle').innerHTML = title.render();
const img = new Component( 'img' );
document.querySelector( '.pizzasContainer' ).innerHTML = img.render();
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment