Handle parsing of HTML <style> tags.

This basically re-applies the technique used for HTML <script> tags. With this
extra addition I decided to rename/normalize a few things so it's easier to add
any extra tags in the future. One downside of this setup is that the following
will not be parsed by Oga:

    <style>
        </script>
    </style>

The same applies to script tags containing a literal </style> tag. Since this
particular case is rather unlikely to occur I'm OK with not supporting it as it
_does_ simplify the lexer quite a bit.

Fixes #80
This commit is contained in:
Yorick Peterse committed 2015-03-03 16:28:05 +01:00
1 parent 73534375d5
commit 78e40b55c0
8 files changed
+51 -26

No files matched your search

+3 -4
View File
@@ -187,14 +187,13 @@ public class Lexer extends RubyObject
}
/**
* Returns true if we're in an HTML script tag. See
* Oga::XML::Lexer#inside_html_script? for more information.
* See * Oga::XML::Lexer#literal_html_element? for more information.
*/
public Boolean inside_html_script_p()
public Boolean literal_html_element_p()
{
ThreadContext context = this.runtime.getCurrentContext();
return this.callMethod(context, "inside_html_script?").isTrue();
return this.callMethod(context, "literal_html_element?").isTrue();
}
}