From cea30050560e1bf41043897dd3930e422028144f Mon Sep 17 00:00:00 2001 From: Ben Sholds Date: Mon, 25 Nov 2013 09:48:12 -0500 Subject: [PATCH] Fix invalid selector exception with empty class values After removing :before and :after pseudo selectors, a class name may be empty, causing an invalid selector string when joined. Remove empty elements before calling querySelectorAll. --- src/Parse.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Parse.js b/src/Parse.js index 1bca773..583e245 100644 --- a/src/Parse.js +++ b/src/Parse.js @@ -77,6 +77,9 @@ _html2canvas.Parse = function (images, options, cb) { for (i = 0, j = classes.length; i < j; i++) { classes[i] = classes[i].match(/(^[^:]*)/)[1]; } + + // remove empty values, if not could cause invalid selectors with querySelectorAll + classes = classes.filter(function (n) { return n }); } // Using the list of elements we know how pseudo el styles, create fake pseudo elements. @@ -1273,4 +1276,4 @@ _html2canvas.Parse = function (images, options, cb) { } } } -}; \ No newline at end of file +};