WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/14/2015 10:13:03 PM (6 years ago)
Author:
helen
Message:

List tables: Use CSS :nth-child() selectors for zebra striping.

Note that this does not fix issues related to comment quick edit. Internal linking also continues to use the .alternate class for now. IE8 and below gracefully degrade by not having zebra striping.

There is some hoop jumping with adding an extra table row to maintain zebra striping during quick edit. Documenting that here for future reference; it is also in the inline documentation.

fixes #30981 and #26060. see #25060.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-users-list-table.php

    r30537 r31181  
    307307        $editable_roles = array_keys( get_editable_roles() );
    308308
    309         $style = '';
    310309        foreach ( $this->items as $userid => $user_object ) {
    311310            if ( count( $user_object->roles ) <= 1 ) {
     
    320319                continue;
    321320
    322             $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
    323             echo "\n\t" . $this->single_row( $user_object, $style, $role, isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
     321            echo "\n\t" . $this->single_row( $user_object, $style = '', $role, isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
    324322        }
    325323    }
     
    329327     *
    330328     * @since 3.1.0
     329     * @since 4.2.0 `$style` argument was deprecated.
    331330     * @access public
    332331     *
    333332     * @param object $user_object The current user object.
    334      * @param string $style       Optional. Style attributes added to the `<tr>` element.
    335      *                            Must be sanitized. Default empty.
     333     * @param string $style       Deprecated. Not used.
    336334     * @param string $role        Optional. Key for the $wp_roles array. Default empty.
    337335     * @param int    $numposts    Optional. Post count to display for this user. Defaults
     
    396394        $avatar = get_avatar( $user_object->ID, 32 );
    397395
    398         $r = "<tr id='user-$user_object->ID'$style>";
     396        $r = "<tr id='user-$user_object->ID'>";
    399397
    400398        list( $columns, $hidden ) = $this->get_column_info();
Note: See TracChangeset for help on using the changeset viewer.