properly add canvases to container

This commit is contained in:
Matt Walsh 2020-09-23 10:39:03 -05:00
parent e9b0e3bfcf
commit b9a85031bd

View file

@ -95,8 +95,14 @@ class WeatherDisplay {
// only create it once // only create it once
if (this.elemId) return; if (this.elemId) return;
this.elemId = elemId; this.elemId = elemId;
// create a canvas
const canvas = document.createElement('template');
canvas.innerHTML = `<canvas id='${elemId+'Canvas'}' width='${width}' height='${height}'/ style='display: none;'>`;
// add to the page
const container = document.getElementById('container'); const container = document.getElementById('container');
container.innerHTML += `<canvas id='${elemId+'Canvas'}' width='${width}' height='${height}'/ style='display: none;'>`; container.appendChild(canvas.content.firstChild);
} }
// get necessary data for this display // get necessary data for this display