Bug 163552 - Using <form> in <template> causes following <form> to get swallowed
Summary: Using <form> in <template> causes following <form> to get swallowed
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 10
Hardware: All Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://html.spec.whatwg.org/multipag...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-17 11:02 PDT by Dennis Morhardt
Modified: 2017-03-05 17:36 PST (History)
9 users (show)

See Also:


Attachments
WIP Patch (1.22 KB, patch)
2017-03-05 14:50 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (4.43 KB, patch)
2017-03-05 15:25 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Morhardt 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/)
Comment 1 Maxime Plante 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.
Comment 2 Jimmy Wärting 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
Comment 3 Chris Dumez 2017-03-05 11:03:35 PST
Looks like an HTML parser bug.
Comment 4 Chris Dumez 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.
Comment 5 Chris Dumez 2017-03-05 15:25:27 PST
Created attachment 303474 [details]
Patch
Comment 6 Sam Weinig 2017-03-05 17:08:58 PST
Comment on attachment 303474 [details]
Patch

Seems like a good testcase to contribute back.
Comment 7 WebKit Commit Bot 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>
Comment 8 WebKit Commit Bot 2017-03-05 17:36:39 PST
All reviewed patches have been landed.  Closing bug.