-
Notifications
You must be signed in to change notification settings - Fork 464
Open
Description
When rendering a component for a table row in specs it strips out the <tr>
and <td>
tags.
Steps to reproduce
Easily reproducible in rails console:
# without `<table>`
str = '<tr class="text-gray-500"><td>some content</td></tr>'
Nokogiri::HTML5.fragment(str)
=> #(DocumentFragment:0x269f8 { name = "#document-fragment", children = [ #(Text "some content")] })
# with `<table>`
str = '<table><tr class="text-gray-500"><td>some content</td></tr></table>'
Nokogiri::HTML4.fragment(str)
=>
#(DocumentFragment:0x26fb0 {
name = "#document-fragment",
children = [
#(Element:0x27028 {
name = "table",
children = [
#(Element:0x270a0 {
name = "tbody",
children = [ #(Element:0x27118 { name = "tr", attribute_nodes = [ #(Attr:0x27190 { name = "class", value = "text-gray-500" })], children = [ #(Element:0x27268 { name = "td", children = [ #(Text "some content")] })] })]
})]
})]
})
Expected behavior
I would expect it would render the component as is.
Actual behavior
Strips out the ill-formed HTML tags
Backtrace:
System configuration
Rails version: 7.2.2.1
Ruby version: 3.4.5
Gem version: 4.0.0
Metadata
Metadata
Assignees
Labels
No labels