By SebCorbin on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
Summary
- 'even', 'odd', 'last', 'first' classes have been removed from most of the markup except tables
- CSS has been updated to use comparable CSS3 pseudo selectors in place of the removed class selectors
Reasoning
- Better compliance with CSS3 best practices
- Removes some markup bloat
- Removes PHP logic from theme functions and templates
- Old CSS selectors remain for tables due to issues caused by hidden table rows
Before
Example list output by theme_item_list() in Drupal 7
<ul>
<li class="first odd">Item 1</li>
<li class="even">Item 2</li>
<li class="odd">Item 3</li>
<li class="last even">Item 4</li>
</ul>CSS to style the first, last, even, and odd elements using class selectors
li.first { . . . }
li.last { . . . }
li.even { . . . }
li.odd { . . . }
After
Example list output by theme_item_list() in Drupal 8
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>CSS to style the first, last, even, and odd elements using CSS3 pseudo selectors
li:first-child { . . . }
li:last-child { . . . }
li:nth-of-type(even) { . . . }
li:nth-of-type(odd) { . . . }
Impacts:
Themers