[whatwg] [HTML5] About the <pre> element

Tab Atkins Jr. a ?crit :
> On Tue, Nov 24, 2009 at 11:07 PM, David Bruant
> <bruant at enseirb-matmeca.fr> wrote:
>   
>> Writing the following is semantically sufficient and handles the
>> presentation as expected :
>> <code style="white-space:pre;">
>> #include <stdlib.h>
>> int main(){
>>    return EXIT_SUCCESS; // Because we always succeed !
>> }
>> </code>
>>     
>
> This would break as soon as you met a client without CSS support, or
> with insufficient CSS support.
>
>   
>> My proposition is to remove the <pre> element since it doesn't have
>> another semantic than "present the information as I did (white spaces,
>> line breaks)"
>>     
>
> That's actually very valuable semantic information.  If whitespace is
> important, then the information about it as such should be carried
> with the document.  For an extreme example, consider a block of python
> or haskell code - without the whitespace, it's simply a non-working
> program.
>   
=> This argument and the previous one are enough to keep the <pre> element.
>> For the ASCII art use case, what is said about "an alternative
>> description" strongly reminds the alt attribute of the img element.
>> Perhaps ASCII art should be done inside of an <img> element. The <img>
>> element is probably the HTML element which has the closest semantic of
>> the ASCII artist intention.
>>     
>
> ASCII art is indeed semantically closest to <img> (it's just an image
> done in a different medium), but there's no way to actually use <img>
> as such.  <pre> is the second-closest thing if you're going to include
> such a thing.
>   
=> However, for this point, I am confused. It's true that currently,
<img> elements are not intended to have a content, but ASCII art, as
images, is probably the best (if not only ?) reason to allow text
content in img elements, thus naturally allowing the alt attribute which
doesn't exist in the "second-closest" semantic element.

David
> ~TJ
>
>   

Received on Tuesday, 24 November 2009 21:50:40 UTC