From 2069df746980d09d01bf94b86ff4eab4bfe6f22e Mon Sep 17 00:00:00 2001 From: yuanchuan Date: Mon, 27 Feb 2017 15:11:28 +0800 Subject: [PATCH] skip empty content --- css-doodle.js | 2 ++ src/index.js | 2 ++ 2 files changed, 4 insertions(+) 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);