Open Bug 1559616 Opened 6 years ago Updated 7 days ago

Table inside SVG foreignObject breaks outer table context

Categories

(Core :: DOM: HTML Parser, defect, P2)

67 Branch
defect

Tracking

()

ASSIGNED

People

(Reporter: davmillar, Assigned: hsivonen)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36

Steps to reproduce:

  • Created an HTML page with a table. In the first TD is an SVG, the second TD has other content.
  • Added the foreignObject tag to the SVG to implant HTML form components.
  • Added a table inside the foreignObject tab to arrange the form components.

JSFiddle here: https://jsfiddle.net/davmillar/o3cyvaqj/

Actual results:

The second TD's contents do not appear inside the TD tag as expect, but just floating within the table. Looking at the source, the opening TD tag for the second TD is seen as 'unexpected' and disregarded.

Expected results:

The table context of the parent table should have been continued as normal and the second TD contents should be in their table cell.

Component: Untriaged → SVG
Product: Firefox → Core
Component: SVG → HTML: Parser
Flags: needinfo?(hsivonen)

Minimized: https://software.hixie.ch/utilities/js/live-dom-viewer/saved/7026
Notably, this supposedly permitted tag omission doesn't give the same result: https://software.hixie.ch/utilities/js/live-dom-viewer/saved/7027

Assignee: nobody → hsivonen
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(hsivonen)
Priority: -- → P2
Severity: normal normal → S3 S3

Hello. I appear to have encountered this issue indepedently, minimized to this codepen with original report.

We maintain a generator from LaTeX to HTML, including tabular and diagram content. In that setting, a "table - inside SVG - inside table" appeared naturally. Today's Chrome appears to render that naturally, but Gecko seems to rewrite the DOM to a different structure.

Thank you for any support - this kind of content arises naturally in scholarly documents so it would be helpful to have it interoperable on the web.

You need to log in before you can comment on or make changes to this bug.