Ignore nested element start tags

This ensures that Oga is able to tokenize input such as the following:

    <script<script>foo</script>

Oga will now treat this as:

    <script>foo</script>

This is based on libxml behaviour, which seems to differ a bit from
Chromium which treats the node as a text node. This however would
require complex look-ahead logic (as far as I can tell) that I really
don't want to implement in Oga.

Fixes #186
This commit is contained in:
Yorick Peterse committed 2017-12-28 16:12:20 +01:00
1 parent 1e002de527
commit f574197ea6
2 files changed
+20

No files matched your search

+3
View File
@@ -389,6 +389,7 @@
element_start = '<' ident_char;
element_end = '</';
element_start_pattern = '<' identifier (':' identifier)?;
# Machine used for lexing the name/namespace of an element.
element_name := |*
@@ -551,6 +552,7 @@
# Machine used for processing the contents of an XML element's starting tag.
element_head := |*
newline => advance_newline;
element_start_pattern;
# Attribute names and namespaces.
identifier ':' => {
@@ -578,6 +580,7 @@
# tag.
html_element_head := |*
newline => advance_newline;
element_start_pattern;
html_identifier => {
callback(id_on_attribute, data, encoding, ts, te);