W3C home > Mailing lists > Public > public-css-archive@w3.org > May 2017

Re: [csswg-drafts] [css-display][css-pseudo] Interaction of display:contents and ::first-line

From: Loirooriol via GitHub <sysbot+gh@w3.org>
Date: Mon, 22 May 2017 21:11:49 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-303221414-1495487508-sysbot+gh@w3.org>
Now I'm thinking that option 1 may be a bit more costly to implement, e.g. if you have

```html
<section>
  <div ><div ><div ><div ><div ><div ><div ><div ><div ><div >
    <span>Foo</span>
  </div></div></div></div></div></div></div></div></div></div>
</section>
```
```css
section::first-line { color: green }
div { display: contents }
```

When the browser generates the styles for the `section`, it sees a `::first-line` must be generated, but does not know where. I guess it must first iterate all the nested `div` because there could be some block container inside them. When it finds out that nope, then it goes back and creates a style for the outermost `div` which inherits from `section::first-line`, then a style for the second `div` which inherits from the previous style, and so on. Alternatively it could start creating these styles once it sees the first `display: contents` element, but if there were a block container inside, that work would have been useless.

Option 2 seems easier to implement: once you find a first-child inline-level inside a block container, create a `::first-line` fragment, let it inherit from the parent element of the inline, and place the inline-level (and following inline-level siblings, until the end of the line) inside that `::first-line`.



-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1310#issuecomment-303221414 using your GitHub account
Received on Monday, 22 May 2017 21:11:56 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 10:12:53 UTC