Make WordPress Core

Opened 13 years ago

Last modified 23 months ago

#17520 new enhancement

cite element used incorrectly

Reported by: holizz's profile holizz Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch needs-refresh
Focuses: Cc:


Here's what the HTML5 specification says about the cite element:

The cite element represents the title of a work (e.g. a book, a paper, an essay, a poem, a score, a song, a script, a film, a TV show, a game, a sculpture, a painting, a theatre production, a play, an opera, a musical, an exhibition, a legal case report, etc). […]

A person's name is not the title of a work — even if people call that person a piece of work — and the element must therefore not be used to mark up people's names. (In some cases, the b element might be appropriate for names; e.g. in a gossip article where the names of famous people are keywords rendered with a different style to draw attention to them. In other cases, if an element is really needed, the span element can be used.)

The element is used plugins/hello.php correctly to mark up the title "Hello, Dolly". But many more places it is used incorrectly to mark up an author's name.

The obvious fix would be to replace all but the one correct instance of the cite element with spans with an appropriate class.

Attachments (1)

17520.patch (4.3 KB) - added by jakub.tyrcha 13 years ago.

Download all attachments as: .zip

Change History (12)

#1 @aaroncampbell
13 years ago

  • Priority changed from normal to low
  • Type changed from defect (bug) to enhancement

According to the working draft for HTML5 you are correct about cite. However, that's for HTML5 and the WordPress admin doctype is XHTML 1.0 Transitional.

Although previous versions of HTML implied that the cite element can be used to mark up the name of a person, that usage is no longer considered conforming.

It seems to me that we're fine until we switch wp-admin to HTML5. I could see possibly fixing the one occurrence of this in twentyeleven, but even then it doesn't seem like this is a bug.

#2 @holizz
13 years ago

According to the HTML 4.01 spec (XHTML 1.0 doesn't define any elements - it relies on HTML4 for that):

Contains a citation or a reference to other sources.

I wouldn't consider a person's name to fit that definition, though it's not as specific about names as the HTML5 spec.

And cite does appear several places outside of wp-admin.

#3 @iandstewart
13 years ago

In [18030]:

Twenty Eleven: using the cite element to markup a name doesn't conform to the HTML spec; Props holizz and aaroncampbell; See #17520

13 years ago

#4 @jakub.tyrcha
13 years ago

Some of these cite tags were immediately stripped out just after being defined anyway, in other places I double checked with firebug to make sure all styles are maintained

#5 @jakub.tyrcha
13 years ago

  • Keywords has-patch added

#6 @ocean90
13 years ago

  • Component changed from General to Administration
  • Milestone changed from Awaiting Review to 3.3

It's HTML5 time.

#7 @ryan
13 years ago

  • Milestone changed from 3.3 to Future Release

Punting enhancements from 3.3.

#8 @chriscct7
10 years ago

  • Severity changed from trivial to normal

#9 @chriscct7
9 years ago

  • Keywords needs-refresh added
  • Priority changed from low to normal

#10 @desrosj
23 months ago

  • Component changed from Administration to General
  • Milestone set to Future Release

Looks like the milestone was removed on this one, so re-adding.

Looks like there are 6 occurrences of <cite> in core itself today and 9 occurrences across 5 default themes.

4 tags are found within wp-admin/includes should be able to get changed without much ripple effect. The <cite> tags within wp_widget_rss_output(), Walker_Comment::comment(), and the default themes will be more difficult because they could cause display issues with themes or child themes for bundled themes.

One way this could be addressed is by using the html5 feature of add_theme_support()/current_theme_supports() to allow theme authors to opt into the switch. I don't love requiring themes to opt-in to the correct behavior, but another backwards compatible approach is not yet coming to mind.

#11 @desrosj
23 months ago

I only looked at the Core PHP code base above, but it should also be confirmed that Gutenberg uses <cite> correctly.

Note: See TracTickets for help on using tickets.