File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ is_start_of_tag = (char)-> char is '<'
33is_whitespace = (char )-> / ^ \s + $ / .test char
44is_tag = (token )-> / ^ \s * <[^ >] + >\s * $ / .test token
55isnt_tag = (token )-> not is_tag token
6+ is_script_tag = (token ) -> token is ' <script'
7+ ends_in_end_script_tag = (token ) ->
8+ token_end = token .substr token .length - 9
9+ token_end is ' </script>'
610
711class Match
812 constructor : (@start_in_before , @start_in_after , @length )->
@@ -22,8 +26,7 @@ html_to_tokens = (html)->
2226 when ' script'
2327 if is_end_of_tag char
2428 current_word += ' >'
25- end = current_word .substr current_word .length - 9
26- if end is ' </script>'
29+ if ends_in_end_script_tag current_word
2730 words .push current_word
2831 current_word = ' '
2932 if is_whitespace char
@@ -33,7 +36,7 @@ html_to_tokens = (html)->
3336 else
3437 current_word += char
3538 when ' tag'
36- if current_word is ' <script '
39+ if is_script_tag current_word
3740 mode = ' script'
3841 current_word += char
3942 else if is_end_of_tag char
You can’t perform that action at this time.
0 commit comments