Use separate Ragel machines for script/style tags
Previously a single Ragel machine was used for processing HTML
script and style tags. This had the unfortunate side-effect that the
following was not parsed correctly (while being valid HTML):
<script>
var foo = "</style>";
</script>
The same applied to style tags:
<style>
/* </script> */
</style>
By using separate machines we can work around the above issue. The
downside is that this can produce multiple T_TEXT nodes, which have to
be stitched back together in the parser.
This commit is contained in:
1 parent
2d43e459a1
commit
73fbbfbdbd
7 files changed
+118
-54
No files matched your search
@@ -194,13 +194,23 @@ public class Lexer extends RubyObject
|
||||
}
|
||||
|
||||
/**
|
||||
* See * Oga::XML::Lexer#literal_html_element? for more information.
|
||||
* @see Oga::XML::Lexer#html_script?
|
||||
*/
|
||||
public Boolean literal_html_element_p()
|
||||
public Boolean html_script_p()
|
||||
{
|
||||
ThreadContext context = this.runtime.getCurrentContext();
|
||||
|
||||
return this.callMethod(context, "literal_html_element?").isTrue();
|
||||
return this.callMethod(context, "html_script?").isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Oga::XML::Lexer#html_style?
|
||||
*/
|
||||
public Boolean html_style_p()
|
||||
{
|
||||
ThreadContext context = this.runtime.getCurrentContext();
|
||||
|
||||
return this.callMethod(context, "html_style?").isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user