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
No related branches found
No related tags found
No related merge requests found
...@@ -32,11 +32,16 @@ class Component { ...@@ -32,11 +32,16 @@ class Component {
} }
render() { render() {
return `<${this.tag}> return `<${this.tag} ${
${this.children ? this.children : ''} this.children ?
</${this.tag}>`; `>${this.children}</${this.tag}>` :
' />'
}`;
} }
} }
const title = new Component( 'h1', 'La carte' ); const title = new Component( 'h1', 'La carte' );
document.querySelector('.pageTitle').innerHTML = title.render(); document.querySelector('.pageTitle').innerHTML = title.render();
\ No newline at end of file
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