diff --git a/css-doodle.js b/css-doodle.js index d105b78..9506789 100644 --- a/css-doodle.js +++ b/css-doodle.js @@ -602,6 +602,8 @@ class Doodle extends HTMLElement { this.getAttribute('grid') || '1x1' ); + if (!this.innerHTML.trim()) return false; + // clear content before throwing error try { compiled = compile(this.innerHTML, this.size); diff --git a/src/index.js b/src/index.js index 2292773..c32fc57 100644 --- a/src/index.js +++ b/src/index.js @@ -52,6 +52,8 @@ class Doodle extends HTMLElement { this.getAttribute('grid') || '1x1' ); + if (!this.innerHTML.trim()) return false; + // clear content before throwing error try { compiled = compile(this.innerHTML, this.size);