This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10063 - Foster Parenting Paragraph is confusing
Summary: Foster Parenting Paragraph is confusing
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: Other other
: P1 critical
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks: 10080
  Show dependency treegraph
 
Reported: 2010-07-02 08:06 UTC by contributor
Modified: 2010-10-04 14:31 UTC (History)
7 users (show)

See Also:


Attachments

Description contributor 2010-07-02 08:06:53 UTC
Section: http://www.whatwg.org/specs/web-apps/current-work/#foster-parenting

Comment:
When is it ever possible for the last table element to have a parent who is
not an element?

Posted from: 128.12.145.60
Comment 1 Eric Seidel 2010-07-02 08:09:19 UTC
I don't believe such would be possible since <html> is always the bottom of the stack, and the only non-element ContainerNodes are Document and DocumentFrament?

Also, the sentence before: " If there is no table element in the stack of open elements (fragment case), then the foster parent element is the first element in the stack of open elements (the html element)"

I don't see why that's the fragment case has an "html" element, but maybe I've not read enough of the fragment case parts of the spec yet.
Comment 2 Eric Seidel 2010-07-02 08:18:21 UTC
Furthermore, this part of that paragraph is ambiguous:

If the foster parent element is the parent element of the last table element in the stack of open elements, then node must be inserted immediately before the last table element in the stack of open elements in the foster parent element...

Two readings:

1. node must be inserted immediately before the-last-table-element-in-the-stack-of-open-elements.
and
2. node must be inserted in the stack of open elements, immediately before the-last-table-element.

I'm assuming you meant reading #1.
Comment 3 Eric Seidel 2010-07-02 08:19:04 UTC
An easy way to clarify the bug in comment #2 is to say "inserted into the dom" instead of "inserted"
Comment 4 Eric Seidel 2010-07-04 06:24:27 UTC
Retitling the bug, since the whole foster parenting paragraph is confusing, per the 3 different issues pointed out above.
Comment 5 Ian 'Hixie' Hickson 2010-07-14 19:02:29 UTC
(In reply to comment #0)
> When is it ever possible for the last table element to have a parent who is
> not an element?

   <table>
   <script>
   var t = document.getElementsByTagName('table');
   var f = document.createDocumentFragment();
   f.appendChild(t);
   </script>
   X


(In reply to comment #1)
> Also, the sentence before:

(I assume you mean after.)

> "If there is no table element in the stack of open
> elements (fragment case), then the foster parent element is the first element
> in the stack of open elements (the html element)"
> 
> I don't see why that's the fragment case has an "html" element, but maybe I've
> not read enough of the fragment case parts of the spec yet.

I'm not sure I follow what you're saying, but yes, in the fragment case (e.g. setting innerHTML on a <table>) the stack of open elements will just have a single <html> element at the top, and no <table>. Not sure how to clarify this further; it's assumed throughout the parser that that is a given, so clarifying it just here would be a bit weird.


(In reply to comment #2)
> Furthermore, this part of that paragraph is ambiguous:
> 
> If the foster parent element is the parent element of the last table element in
> the stack of open elements, then node must be inserted immediately before the
> last table element in the stack of open elements in the foster parent
> element...
> 
> Two readings:
> 
> 1. node must be inserted immediately before
> the-last-table-element-in-the-stack-of-open-elements.
> and
> 2. node must be inserted in the stack of open elements, immediately before
> the-last-table-element.
> 
> I'm assuming you meant reading #1.

Yeah. Fixed.


EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below, which hopefully clarifies most of the points raised herein.
Rationale: Concurred with reporter's comments.
Comment 6 contributor 2010-07-14 19:05:04 UTC
Checked in as WHATWG revision r5161.
Check-in comment: Some parser clarifications.
http://html5.org/tools/web-apps-tracker?from=5160&to=5161