This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26552 - [Shadow]: consider supporting :first-child, nth-child() in content select
Summary: [Shadow]: consider supporting :first-child, nth-child() in content select
Status: RESOLVED DUPLICATE of bug 24872
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement
Target Milestone: ---
Assignee: Hayato Ito
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-11 11:11 UTC by Tomek Wytrębowicz
Modified: 2014-08-13 02:47 UTC (History)
3 users (show)

See Also:


Attachments

Description Tomek Wytrębowicz 2014-08-11 11:11:57 UTC
"3.6 Satisfying Matching Criteria"

Consider following case. Custom Element that extends ordered list(, and creates a pyramid of news)
my-article-list shadow root:

<div class="lead">
    <h1>Breaking news:</h1>
    <content select=":first-child"></content>
</div>
<div class="asides">
    <content select=":nth-child(2)"></content>
    <content select=":nth-child(3)"></content>
</div>
<div>
    <content></content>
</div>

And input should look like:

<my-article-list>
    <article>Most important article</article>
    <article>Important article</article>
    <article>Important article</article>
    <article>article</article>
    ...
</my-article-list>


Without those pseudo-classes my-articles-list needs to modify light DOM, or at least CSS properties of child nodes, which seems very intrusive to me.

Use of ".first", ".second", ... classes also does not seem right. As the user of my-article-list should now be aware how long should he count, and as for ordered list nodes order already serves this information.

I know that it was removed via 21924, but unfortunately I have no idea how hard it would be to implement it, and how it could affect performance. I just guess it could be not much worse than `:not()`.
Comment 1 Hayato Ito 2014-08-13 02:46:37 UTC
Could you re-use bug 24872?
Please feel free to re-open bug 24872.

*** This bug has been marked as a duplicate of bug 24872 ***