find-conditional-comments
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -10,6 +10,9 @@ const CONDITIONAL_COMMENT_REGEX = /(<!(--)?\[if\s[()\w\s|&!]+\]>(?:<!--+>)?)((?:.|\n)*?)((?:<!--)?<!\[endif\]\2>)/gi; | ||
const bubble = open.endsWith("-->"); | ||
comments.push({ | ||
open, | ||
close, | ||
downlevel: commentDashes == "--" ? "hidden" : "revealed", | ||
bubble, | ||
downlevel: bubble || commentDashes !== "--" ? "revealed" : "hidden", | ||
range: [ | ||
@@ -16,0 +19,0 @@ CONDITIONAL_COMMENT_REGEX.lastIndex - match.length, |
@@ -51,1 +51,21 @@ const findConditionalComments = require("."); | ||
}); | ||
test("correctly marks comments as downlevel-revealed or downlevel-hidden", () => { | ||
expect( | ||
findConditionalComments(` | ||
<!--[if true]>downlevel-hidden<![endif]--> | ||
`)[0].downlevel | ||
).toEqual("hidden"); | ||
expect( | ||
findConditionalComments(` | ||
<![if !mso]>downlevel-revealed<![endif]> | ||
`)[0].downlevel | ||
).toEqual("revealed"); | ||
expect( | ||
findConditionalComments(` | ||
<!--[if !mso]><!-->downlevel-revealed<!--<![endif]--> | ||
`)[0].downlevel | ||
).toEqual("revealed"); | ||
}); |
{ | ||
"name": "find-conditional-comments", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Finds all conditional comments in a string", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
7522
77