Bug 163552

Summary: Using <form> in <template> causes following <form> to get swallowed
Product: WebKit Reporter: Dennis Morhardt <info>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, darin, esprehn+autocc, gyuyoung.kim, info, jimmy, maxime.pl, rniwa
Priority: P2    
Version: Safari 10   
Hardware: All   
OS: Unspecified   
URL: https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody:form-element-pointer-2
Attachments:
Description Flags
WIP Patch
none
Patch none

Dennis Morhardt
Reported 2016-10-17 11:02:32 PDT
If your using <form> in a <template>, every following <form> will be eaten up and only contains will be rendered. See http://jsbin.com/buwuteripu/edit?html,output for a demo. (First reported here: https://www.reddit.com/r/webdev/comments/3qid2h/psa_safari_9_eats_some_tags_after_templates_are/)
Attachments
WIP Patch (1.22 KB, patch)
2017-03-05 14:50 PST, Chris Dumez
no flags
Patch (4.43 KB, patch)
2017-03-05 15:25 PST, Chris Dumez
no flags
Maxime Plante
Comment 1 2016-10-22 10:07:36 PDT
(In reply to comment #0) > If your using <form> in a <template>, every following <form> will be eaten > up and only contains will be rendered. > > See http://jsbin.com/buwuteripu/edit?html,output for a demo. > > (First reported here: > https://www.reddit.com/r/webdev/comments/3qid2h/ > psa_safari_9_eats_some_tags_after_templates_are/) It seems to only eat the following form. Not every following form. See http://jsbin.com/razakunaca/edit?html,output for a (updated) demo.
Jimmy Wärting
Comment 2 2017-03-05 09:13:47 PST
Confirmed, Same goes for TP. just recently registerd to report this issue. But i found this. thanks maxime for the suggestion, going to put a empty form right before my following form so it can eat the first one instead
Chris Dumez
Comment 3 2017-03-05 11:03:35 PST
Looks like an HTML parser bug.
Chris Dumez
Comment 4 2017-03-05 14:50:33 PST
Created attachment 303467 [details] WIP Patch From spec: Insert an HTML element for the token, and, if there is no template element on the stack of open elements, set the form element pointer to point to the element created. It looks like we were setting the form element pointer even when there was a template element on the stack of open elements.
Chris Dumez
Comment 5 2017-03-05 15:25:27 PST
Sam Weinig
Comment 6 2017-03-05 17:08:58 PST
Comment on attachment 303474 [details] Patch Seems like a good testcase to contribute back.
WebKit Commit Bot
Comment 7 2017-03-05 17:36:33 PST
Comment on attachment 303474 [details] Patch Clearing flags on attachment: 303474 Committed r213438: <http://trac.webkit.org/changeset/213438>
WebKit Commit Bot
Comment 8 2017-03-05 17:36:39 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.