You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should parse in Quirks Mode if doctype not set #2197
The table tag inside span of p tag is unwrapped as next sibling of p tag. Additionally an empty p tag is created as the next sibling of the unwrapped table tag. This output is not seen in Chrome and Firefox browsers
In HtmlTreeBuilderState, we are treating the document as No Quirks, but because there is no doctype, it should be treated as Quirks, and so the p should not be closed when the table gets opened.
jsoup's doesn't currently implement Quirks Mode completely. We do go into quirks mode when parsing invalid doctypes, but don't have the expected doctype tests. Implementing that would allow this to be fixed.
Checked in Chrome and if there is a valid doctype and so in No-Quirks mode, Chrome does parse the same as jsoup does currently:
changed the title [-]Jsoup Issue: <table> tag inside <span> of <p> tags are getting unwrapped outside and empty <p> tags are created[/-][+]Should parse in Quirks Mode if doctype not set[/+]on Sep 10, 2024
Activity
jhy commentedon Sep 10, 2024
Hi,
The parse you are getting is coming from the implementation of this rule:
A start tag whose tag name is "table".
In HtmlTreeBuilderState, we are treating the document as No Quirks, but because there is no doctype, it should be treated as Quirks, and so the
pshould not be closed when thetablegets opened.jsoup's doesn't currently implement Quirks Mode completely. We do go into quirks mode when parsing invalid doctypes, but don't have the expected doctype tests. Implementing that would allow this to be fixed.
Checked in Chrome and if there is a valid doctype and so in No-Quirks mode, Chrome does parse the same as jsoup does currently:
[-]Jsoup Issue: <table> tag inside <span> of <p> tags are getting unwrapped outside and empty <p> tags are created[/-][+]Should parse in Quirks Mode if doctype not set[/+]jhy commentedon Sep 10, 2024
Thanks for reporting! Fixed.
Parse in quirksmode if no doctype html
chore(deps): update all non-major dependencies (mulk/mulkcms2!58)