[wp-trac] [WordPress Trac] #17632: HTML 5 Validation issues (theme independent)

WordPress Trac wp-trac at lists.automattic.com
Thu Mar 29 21:08:13 UTC 2012


#17632: HTML 5 Validation issues (theme independent)
--------------------------+------------------------------
 Reporter:  amirhabibi    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.1.3
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Comment (by pbiron):

 [crap, I spent 20 mins composing a reply and Trac just lost it...now I
 have to redo it :-(  Oh, well...this draft is clearer than my first one
 anyway]

 [/ticket/17632#comment:13 @bamajr]

   If the WordPress core is going to use rel="category" and rel="category
 tag" then it should take the steps necessary to ensure they are properly
 defined in a specification.

 I couldn't agree more and that's what my initial comment [1] was all
 about.

 re:

   You can't just write it... you have to maintain it and then defend it's
 position when other people want to change it.

 As I mentioned, the spec for `@rel='category'` does not have to be a
 formal spec approved by a standards body (nor need to be defended "when
 other people want to change it").  It can be as simple as a new section
 (or even a single sentence :-) in the WordPress docs for
 `get_the_category_list()` [2], which have to be maintained along with the
 code anyway.

 As to what `@rel='category'` means, again, I haven't a clue, but
 apparently whoever wrote line 163 of `wp-includes/category-template.php`
 [3] thought it means something different than `@rel='tag'`:

 {{{
 $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ?
 'rel="category tag"' : 'rel="category"';
 }}}

 and that the difference has "something" to do with whether
 `$wp_rewrite->using_permalinks()` returns true or false.

 Since, I don't know what revision-control system is used for WordPress
 core, is there anyway to find out who wrote that line and ask them what it
 means and have that meaning added to [2]? (And again, I'll do all the rest
 for getting conforming validators to not flag `@rel='category'` as a
 validation error).

 re:
   I despise when developers start throwing invalid code in something which
 is supposed to be a core framework.

 Again, I couldn't agree more! After all, I am a co-editor of the W3C XML
 Schema spec [4] and several HL7 specs [5], and I hate it when people
 deploy illegal XML Schemas in a production system just so that XML Spy's
 buggy schema implementation will accept them :-(.

 In fact, I think a convincing argument can be made that
 `get_the_category_list()`'s generation of `@rel='tag'` is actually what is
 incorrect (in at least some cases, see below); and hence, that applying
 the patch would be the wrong thing to do...similar to people deploying
 incorrect XML Schemas just to get XML Spy's buggy schema implementation to
 say they are OK).

 How do people use `get_the_category_list()`?  I can't speak for others,
 but I use it like Twenty Eleven does:

 {{{
 $categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
 <span class="cat-links">
         <?php printf( __( '<span class="%1$s">Posted in</span> %2$s',
 'twentyeleven' ),
                 'entry-utility-prep entry-utility-prep-cat-links',
 $categories_list );
 </span>
 }}}

 e.g., in a theme's `content.php`.

 Consider the definition of `@rel='tag'` in the HTML5 spec (I know, it's
 just a draft and can change at any time, so let's not go there again) [6]:

   The tag keyword indicates that the tag that the referenced document
 represents applies to the current document.

 Use of `@rel='tag'` is appropriate for use on a link within
 `article//span[@class='entry-meta']` when used in `{single,category}.php`
 (since the category applies to all posts those templates generate).

 However, it is not appropriate when used in `content.php` (e.g., on a
 site's home page that contains posts from many different categories),
 since then it is saying '''the category applies to the home page''', which
 is certainly '''not''' what I intend in that case!

 So, irrespective of whether `@rel='category'` is generated (and/or what it
 means), I think that what should be changed in the code of
 `get_the_category_list()` is that it should allow a parameter to control
 whether `@rel='tag'` is generated and that [2] should be clear that that
 param should only be `true` when it is known that all posts in the loop
 have the same category applied to them!

 [1] http://core.trac.wordpress.org/ticket/17632#comment:10 [[BR]]
 [2] http://codex.wordpress.org/Function_Reference/get_the_category_list
 [[BR]]
 [3] http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes
 /category-template.php [[BR]]
 [4] http://www.w3.org/TR/xmlschema-2 [[BR]]
 [5] http://www.hl7.org (sorry, the specs themselves are not publicly
 accessible) [[BR]]
 [6] http://www.w3.org/TR/html5/links.html#link-type-tag [[BR]]

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17632#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list