html5lib/html5lib-tests

Compat issue: <div><table><svg><foreignObject><select><table><s>

Ms2ger opened this issue · 4 comments

Chrome:
Chrome
Firefox:
Firefox
Not sure who's right.

I think Firefox is correct. At least I can't find a reason why foreignObject would be popped from the stack of open elements.

@hsivonen @mfreed7?

I've changed my mind. WebKit and Chromium are correct.

Reasoning:

  • <div> gets put on the stack
  • <table> gets put on the stack
  • <svg> gets foster parented and put on the stack
  • <foreignObject> gets put on the stack
  • <select> gets put on the stack
  • <table> implies </select> which resets the insertion mode. That walks up the stack until it finds <table> which sets the insertion mode to "in table". Then <table> in that mode causes everything up to and including the prior <table> to be popped from the stack.
  • <s> gets foster parented.

Stepping through the spec I reach the same conclusion.

Notes
<div>
stack: html,body,div
im: in body

<table>
stack: html,body,div,table
im: in body -> in table

<svg>
stack: html,body,div,table
im: in table
Parse error. Enable foster parenting, process the token using the rules for the "in body" insertion mode, and then disable foster parenting.

<svg>
stack: html,body,div,table,svg
im: in table -> using the rules for in body
dom:
| <html>
|   <head>
|   <body>
|     <div>
|       <svg svg>
|       <table>

<foreignObject>
stack: html,body,div,table,svg
im: in table
Parse error. Enable foster parenting, process the token using the rules for the "in body" insertion mode, and then disable foster parenting.

<foreignObject>
stack: html,body,div,table,svg,foreignObject
im: in table, using the rules for in body; Process the token according to the rules given in the section for parsing tokens in foreign content.
dom:
| <html>
|   <head>
|   <body>
|     <div>
|       <svg svg>
|         <svg foreignObject>
|       <table>

<select>
stack: html,body,div,table,svg,foreignObject,select
im: in table, using the rules for in body -> in select in table
dom: 
| <html>
|   <head>
|   <body>
|     <div>
|       <svg svg>
|         <svg foreignObject>
|           <select>
|       <table>

<table>
Pop elements from the stack of open elements until a select element has been popped from the stack.
stack: html,body,div,table,svg,foreignObject
Reset the insertion mode appropriately.
im: in table
Reprocess the current token.

<table>
Pop elements from this stack until a table element has been popped from the stack.
stack: html,body,div
Reset the insertion mode appropriately.
im: in body
Reprocess the token.

<table>
stack: html,body,div,table
im: in body -> in table
dom:
| <html>
|   <head>
|   <body>
|     <div>
|       <svg svg>
|         <svg foreignObject>
|           <select>
|       <table>
|       <table>

<s>
stack: html,body,div,table,s
im: in table
Parse error. Enable foster parenting, process the token using the rules for the "in body" insertion mode, and then disable foster parenting.
dom:
| <html>
|   <head>
|   <body>
|     <div>
|       <svg svg>
|         <svg foreignObject>
|           <select>
|       <table>
|       <s>
|       <table>