summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-03 19:05:03 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-03 19:06:07 -0800
commit42d75e3a6e66b334ca701a866c0517dcec8b0118 (patch)
tree2235d6feaf442d6000e29af5291e71eca9c737f1
parent2a477bb14758a2849c1e8aa14bafba6bb749bf35 (diff)
Improved js regex for html comments.
Closes #263. Note, this only affects inline comments. With block comments we parse differently, and don't guarantee that only valid HTML5 comments will pass. This all needs to be made more explicit in the spec. However, this fix addresses the cpu problem.
-rw-r--r--js/lib/inlines.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/js/lib/inlines.js b/js/lib/inlines.js
index e97ea5d..2df3630 100644
--- a/js/lib/inlines.js
+++ b/js/lib/inlines.js
@@ -33,7 +33,7 @@ var ATTRIBUTEVALUESPEC = "(?:" + "\\s*=" + "\\s*" + ATTRIBUTEVALUE + ")";
var ATTRIBUTE = "(?:" + "\\s+" + ATTRIBUTENAME + ATTRIBUTEVALUESPEC + "?)";
var OPENTAG = "<" + TAGNAME + ATTRIBUTE + "*" + "\\s*/?>";
var CLOSETAG = "</" + TAGNAME + "\\s*[>]";
-var HTMLCOMMENT = "<!--([^-]+|[-][^-]+)*-->";
+var HTMLCOMMENT = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->";
var PROCESSINGINSTRUCTION = "[<][?].*?[?][>]";
var DECLARATION = "<![A-Z]+" + "\\s+[^>]*>";
var CDATA = "<!\\[CDATA\\[([^\\]]+|\\][^\\]]|\\]\\][^>])*\\]\\]>";