Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Add <container> element #1616

Closed
dawidgarus opened this issue Aug 31, 2018 · 2 comments
Closed

Add <container> element #1616

dawidgarus opened this issue Aug 31, 2018 · 2 comments

Comments

@dawidgarus
Copy link

I propose to add new HTML element to spec: <container> (I had pick some name, but it could be other).
The idea is that <container> element would still be there in DOM, but it would be ignored when displaying document as if it contents was directly in place of <container>.
Example:

<div class="parent">
  <div class="form">A</div>
  <container>
    <div class="form">B</div>
    <div class="form">C</div>
  </container>
  <div class="form">D</div>
</div>

should be displayed as:

<div class="parent">
  <div class="form">A</div>
  <div class="form">B</div>
  <div class="form">C</div>
  <div class="form">D</div>
</div>

Also CSS selectors should ignore existence of <container>.
Selectors like: .form + .form or .parent > .form should match B and C div.

One could use <container> element as a parent for related elements, which could be detached and attached to DOM as a single element without inconvenience of having extra host element that could ruin Your layout.

This feature would also be helpful for library/framework developers who often simulate this behavior, usually with comments marking start and end of "container" block.

@SebastianZ
Copy link

SebastianZ commented Nov 5, 2018

Note that the CSS Display spec. already defines a contents value for display, which basically covers your use case of the container element not influencing the layout in any way.

Also, the <div> element already serves the use case of being a container element, even when it actually doesn't have a special meaning.

The selector "invisibility" part should rather be brought up in the CSSWG, though I guess the chances for this getting buy in from the implementors and spec. writers are relatively low, because that would mean some new selector logic, as all elements are selectable, so far.

Regarding detaching and attaching several sibling elements at once, the DocumentFragment interface and the Range.extractContents() method come in handy, without requiring a container element.

Sebastian

@siusin
Copy link
Contributor

siusin commented Jul 29, 2019

Thanks all.

We're closing this issue on the W3C HTML specification because the W3C and WHATWG are now working together on HTML, and all issues are being discussed on the WHATWG repository.

If you filed this issue and you still think it is relevant, please open a new issue on the WHATWG repository and reference this issue (if there is useful information here). Before you open a new issue, please check for existing issues on the WHATWG repository to avoid duplication.

If you have questions about this, please open an issue on the W3C HTML WG repository or send an email to public-html@w3.org.

@siusin siusin closed this as completed Jul 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants