Re: Web Components: two questions
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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz mailto:ondrej.zara@firma.__seznam.cz mailto:ondrej.z...@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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz http://www.seznam.cz/ Seznam.cz, a.s., Radlická 3294/10, 150 00 Praha 5 http://mapy.cz/s/6rw4
Re: Web Components: two questions
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.z...@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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz mailto:ondrej.zara@firma.__seznam.cz mailto:ondrej.z...@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.z...@firma.seznam.cz mailto:ondrej.z...@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
Re: Web Components: two questions
On Thu Sep 11 2014 at 3:25:01 PM Ondřej Žára ondrej.z...@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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz mailto:ondrej.zara@firma.__seznam.cz mailto:ondrej.z...@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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz http://www.seznam.cz/ Seznam.cz, a.s., Radlická 3294/10, 150 00 Praha 5 http://mapy.cz/s/6rw4
Re: Web Components: two questions
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. Sweet, thanks for explanation. (Now only the second question remains...) Sincerely, O. Zara 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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz mailto:ondrej.zara@firma.__seznam.cz mailto:ondrej.z...@firma.seznam.cz mailto:ondrej.zara@firma. mailto:ondrej.zara@firma.__se__znam.cz http://seznam.cz mailto:ondrej.zara@firma.__seznam.cz mailto:ondrej.z...@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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz mailto:ondrej.zara@firma.__seznam.cz mailto:ondrej.z...@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 -- *RNDr. Ondřej Žára* Programátor UI senior https://twitter.com/0ndras ondrej.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz http://www.seznam.cz/ Seznam.cz, a.s., Radlická 3294/10, 150 00 Praha 5 http://mapy.cz/s/6rw4
Re: Web Components: two questions
On Thu Sep 11 2014 at 4:04:27 PM Hayato Ito hay...@chromium.org wrote: On Thu Sep 11 2014 at 3:25:01 PM Ondřej Žára ondrej.z...@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. Correction. If we use `/deep/` (or `::shadow') in the selector, we can. :) 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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz mailto:ondrej.zara@firma.__seznam.cz mailto:ondrej.z...@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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz http://www.seznam.cz/ Seznam.cz, a.s., Radlická 3294/10, 150 00 Praha 5 http://mapy.cz/s/6rw4
Re: Web Components: two questions
On Wed Sep 10 2014 at 8:26:43 PM Ondřej Žára ondrej.z...@firma.seznam.cz wrote: Hi, unable to seek a qualified answer via IRC or Web/spec, I decided to post my two beginner questions here. 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. 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.z...@firma.seznam.cz mailto:ondrej.z...@firma.seznam.cz http://www.seznam.cz/ Seznam.cz, a.s., Radlická 3294/10, 150 00 Praha 5 http://mapy.cz/s/6rw4