W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2014

Re: Web Components: two questions

From: 河内 隆仁 <kochi@google.com>
Date: Thu, 11 Sep 2014 16:00:14 +0900
Message-ID: <CADP2=hp_HnSkVCMbVyU8ErbdbmyizKF__LKn6yuek5MP43fBiQ@mail.gmail.com>
To: Ondřej Žára <ondrej.zara@firma.seznam.cz>
Cc: Hayato Ito <hayato@chromium.org>, public-webapps <public-webapps@w3.org>
Ondrej,

The short answer to whether <input> inside shadow root under a <form> will
be sent or not is "No".

The "node tree" mentioned in Hayato's mail means that <form> and <input>
belong to different trees.
Only elements in the same tree as <form> will be considered for submission.

So you don't have to worry about backward compatibility.


On Thu, Sep 11, 2014 at 3:24 PM, Ondřej Žára <ondrej.zara@firma.seznam.cz>
wrote:

>     1) Are form elements (input, select, textarea) inside a shadow dom
>>     considered when submitting a form?
>>
>>
>> The Shadow DOM spec doesn't say anything about this. Therefore,
>> form elements should be in the same node tree.
>>
>> For example, suppose a <form> element is in the node tree A. In this
>> case, form elements in node tree B,  where A != B,  are not considered
>> at all when submitting the form.
>>
>
> I am not sure I am able to fully interpret your response: do you imply
> that an <input> field inside a shadow dom inside a <form>
>
> (diagram:
>
> <form>
>    |
>   [shadow root]
>        |
>      <input>
>
> )
>
> shall get submitted?
>
> This might pose some backwards incompatibility for tools that
> automatically aggregate input values (for e.g. xhr-based submit) by
> executing form.querySelectorAll("input, select, textarea"). An input inside
> a shadow root (not visible to a querySelectorAll from the outside world)
> will get ommited.
>
>
> Sincerely,
> O. Zara
>
>
>
>> A composed tree shouldn't have any effect on submitting a from.
>>
>>     2) I am having troubles with lifecycle callback of custom elements
>> that
>>     are cloned from within a <template> element. More specifically, nor
>>     createdCallback nor attachedCallback are fired when an element in
>>     question is cloned from template.content or appended to an active
>>     document. Is this a specified behavior? How do I properly initialize
>>     custom elements that "live" inside a <template> ?
>>
>>
>>     Thanks a lot,
>>     sincerely,
>>     Ondrej Zara
>>
>>
>>
>>
>>     --
>>     *RNDr. Ondřej Žára*
>>     Programátor UI senior
>>
>>     https://twitter.com/0ndras
>>     ondrej.zara@firma.seznam.cz <mailto:ondrej.zara@firma.seznam.cz>
>>     <mailto:ondrej.zara@firma.__seznam.cz
>>     <mailto:ondrej.zara@firma.seznam.cz>>
>>     http://www.seznam.cz/
>>
>>     Seznam.cz, a.s., Radlická 3294/10, 150 00 Praha 5
>>     <http://mapy.cz/s/6rw4>
>>
>>
>>
> --
> *RNDr. Ondřej Žára*
> Programátor UI senior
>
> https://twitter.com/0ndras
> ondrej.zara@firma.seznam.cz <mailto:ondrej.zara@firma.seznam.cz>
> http://www.seznam.cz/
>
> Seznam.cz, a.s., Radlická 3294/10, 150 00 Praha 5 <http://mapy.cz/s/6rw4>
>
>
>


-- 
Takayoshi Kochi
Received on Thursday, 11 September 2014 07:01:06 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:26 UTC