Very odd problem. I have some code:
var container = document.getElementById("graph"); //container element
console.log("Containers id is " + container.id); //graph
var element = document.createElement(this.componentType); //"canvas"
element.id = "canvasId";
console.log(element.outerHTML); //<canvas id="canvasId"></canvas>
//container.innerHTML = element.outerHTML;
document.getElementById("graph").appendChild(element);
The code seems to work. If
this.componentType = "div"
or
this.componentType = "custom"
then it'll apply the closing tags, ie.
<div id="canvasId"></div>
or
<custom id="canvasId"></custom>
But if
this.componentType = "canvas"
then it'll only produce the opening tag
<canvas>
No closing tag !EVEN THOUGH! console.log displays the closing tag! So I do get a closing tag, but no matter wether I use the appendChild technique or the outerHtml technique, the Document only applies the opening tag of canvas (). Other tags and custom tags load.
I checked a few of the Similar Questions on the side, and thought the answer would be here by sheepy (down in the middle of the page). But someone else on reddit showed that his code worked.
var element = document.createElement('canvas');
document.body.appendChild(element);
console.log(element.outerHTML); // "<canvas></canvas>"
I checked on Chrome, and Safari, and both have same results in dev tools. Showing only the opening tag if it is canvas. All others show proper.
edit:Results