After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 779127 - Add CSS selectors :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type
Add CSS selectors :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Class: GtkStyleContext
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-02-23 11:36 UTC by Daniel Boles
Modified: 2018-05-02 18:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Daniel Boles 2017-02-23 11:36:57 UTC
In CSS,

        [other-selectors] node-name:nth-of-type(N)

selects the first child of that name, in the context of the preceding selectors. It's like :nth-child(N), but it only counts across nodes with the matching name.

:nth-last-of-type does the same, but from the other end of the list of children.

:first- and :last-of-type are just convenient aliases for the :nth selectors.

These could be really useful to have in GTK+. At the least, having these would obviate the need to add classes/IDs to widgets that need special styling for their place in a container.

AFAICT, these selectors are still in Working Draft status in CSS Selectors Level 4. However, they are widely implemented in browsers - even IE v9 supported them, according to these:

 * https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type
 * https://www.w3schools.com/cssref/sel_nth-of-type.asp
Comment 1 GNOME Infrastructure Team 2018-05-02 18:09:29 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/766.