From: Shinya Ohira Date: Sat, 9 Mar 2013 17:29:06 +0000 (+0900) Subject: Fix prefix in element X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=254279144eac8711e6b0e9637c2e0ddc4658cb43;p=html-minifier.git Fix prefix in element --- diff --git a/src/htmlparser.js b/src/htmlparser.js index 2795676..8ea0530 100644 --- a/src/htmlparser.js +++ b/src/htmlparser.js @@ -27,7 +27,7 @@ (function(global){ // Regular Expressions for parsing tags and attributes - var startTag = /^<(\w+)((?:\s*[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, + var startTag = /^<([\w:-]+)((?:\s*[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, endTag = /^<\/(\w+)[^>]*>/, attr = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g, doctype = /^]+>/i; diff --git a/tests/minify_test.js b/tests/minify_test.js index 13ccba1..e610426 100644 --- a/tests/minify_test.js +++ b/tests/minify_test.js @@ -36,6 +36,9 @@ equal(minify('foo'), 'foo'); equal(minify('

x'), '

x

'); equal(minify('

x

'), '

x

', 'trailing quote should be ignored'); + + equal(minify(''), ''); + equal(minify(''), ''); }); test('`minifiy` exists', function() {