[whatwg] Undefined action parsing HTML fragment with <select> context

Nolan Waite nolan at nolanw.ca
Sun Jul 21 00:43:12 PDT 2013

Hello! I am confused about parsing an HTML fragment when the context is a "select" element. http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#parsing-html-fragments step 4.6 instructs me to "reset the parser's insertion mode appropriately". I head over to http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#parsing-html-fragments but I see a problem in step 4.

In step 4.1 I let ancestor = node. At this point, I have:

- stack of open elements =
    - <html>
- last = true
- node = the context element, a "select" element
- ancestor = the context element, a "select" element

In step 4.2 ancestor is not the first node in the stack of open elements (the context "select" element is not and has never been on the stack), so I continue to step 4.3.

Now I am to "let ancestor be the node before ancestor in the stack of open elements". There is no such node! At this point, ancestor is not on the stack of open elements, so there is no node "before" it.

I assume the intention is to effectively jump to the step labeled *done* if ancestor is the context element? That makes sense to me.

More information about the whatwg mailing list