Unable to parse <template> tag in the body
jwoertink opened this issue · comments
This is almost the same issue as kostya/myhtml#21 but with a small difference
input = "<template>Test</template>"
html = Lexbor::Parser.new(input)
html.body!.children.each do |child_tag|
puts "never gets here"
end
input = "<div><template>Test</template></div>"
html = Lexbor::Parser.new(input)
html.body!.children.each do |child_tag|
puts "this works"
end
If I wrap the <template>
tag inside of another tag that shows up in the body, then I can access it from html.body!
. Otherwise I have to use html.head!
to access it. But the <template>
tag never goes in the <head>
, it only goes in the <body>
.
I looked up the spec for this tag which shows it does go in the <body>
. I also looked up the lexbor tests that show they are parsing it from within the body.
I was going to post the issue on their repo, but since I don't know how it works, I wasn't sure how to test it. Do you have any ideas?
I added to master method inner_html=
, try: node.inner_html = "<template>Test</template>"
, it would parse fragment html.