[wp-testers] Code Kvetching

zamoose at gmail.com zamoose at gmail.com
Tue May 6 15:09:04 GMT 2008


On 5/6/08, Aaron D. Campbell <aaron at xavisys.com> wrote:
> Doug Stewart wrote:
> > You mean between PREs.  CODE is shorthand for monospace font, pre
> > respects existing spacing and markup.
> >
> I think CODE means exactly what it says.  "This is code."  If the
> user/browser wants to make that monospace, fine.  However, since it
> contains code, WordPress should treat it like it contains code.


Except that's not what the W3 standard says.  CODE elements say
nothing about formatting and the respecting thereof, they're simply
"phrase" elements.  It's semantic to label code with CODE, but it
doesn't preserve formatting any more than wrapping an emphasized
phrase in an EM element does.[1]

PRE elements are specifically supposed to respect the whitespacing of
the text contained within them.[2]

I misspoke --  the default browser behavior is for CODE-wrapped
phrases to be rendered in monospace font as an indicator of their
semantics.

Hope that helps.


1) http://www.w3.org/TR/2005/WD-xhtml2-20050527/mod-text.html#edef_text_code
2) http://www.w3.org/TR/2005/WD-xhtml2-20050527/mod-structural.html#edef_structural_pre
-- 
-Doug


More information about the wp-testers mailing list