Re: [csswg-drafts] [css-display] Define interaction of display:contents and replaced elements

Thanks for the nice summary in the spec, of the current interpretations & open issues.

I do like the idea of using `display: contents` to un-replace replaced elements that also accept valid DOM children as accessible representations or fallback (`<canvas>`, `<audio>`, `<video>`, `<meter>`, `<progress>`), because I think that would be a nice feature to have.  

But I would prefer that the replaced-element behavior is consistent with the shadow-DOM model of these replaced elements (that is, rendered as if the real DOM children are masked by a closed shadow DOM that is rendered in its place).  **I'm not sure I understand what that is: are the "contents" of a shadow DOM host the plain DOM contents, or the flattened shadow DOM contents?**

If the "contents" of a shadow DOM host are the regular-DOM child nodes, then (_IMHO_) it makes sense that:

- Void replaced elements (like `<img>` and `<input>`) effectively become `display: none`, since they have no true contents to display.
- Replaced elements with valid DOM fallback children are treated as generic container elements with `display: contents`.

However, if the "contents" of a shadow DOM host are the flattened-tree contents, after slotting true children into the shadow tree, then `display: contents` wouldn't change which sub-elements are displayed, only their layout.  The closest matching behavior for replaced elements would be `display: inline` (as [previously spec'd](#issuecomment-274914703)).  

Another was of looking at the same end result would be to treat `display: contents` as if the replaced element has no box, but the replaced content is always quarantined inside an anonymous inline box that holds its layout together (preventing an `iframe` from "bleeding into the parent document", for example).



-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/540#issuecomment-286566744 using your GitHub account

Received on Tuesday, 14 March 2017 21:29:35 UTC