Re: Web Components: two questions

On Thu Sep 11 2014 at 3:25:01 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?
>
>
No, the <input> is not considered.


> 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.
>
>
This sounds an orthogonal problem, doesn't that?
querlySelectorAll() can't select nodes in other node trees in any cases.



>
> 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>
>
>

Received on Thursday, 11 September 2014 07:04:59 UTC