Re: View Source

On Mar 17, 2009, at 05:59, Doug Schepers wrote:

> Karl Dubost wrote (on 3/16/09 11:32 PM):
>>
>> The real issue is how to make it "canonical". There are many  
>> options and
>> we do not have yet decided of the right options.
>>
>> Things like
>> <center>foo</center>
>> Does it become
>> <span style="text-align:center;">foo</span>
>> or foo
>> or <span class="canon001">foo</span> (with external stylesheet)
>
> I would vote for it becoming
> <center>foo</center>
>
> Who knows what's hanging on that element... maybe some CSS scope  
> selector?

I agree it should stay as <center>foo</center>.

> There's things like adding quote marks, closing tags, and clearing  
> up validity errors...

But <center>foo</center> is a validity error. I think it follows that  
adding quote marks and closing tags should be in but clearing up  
validity errors shouldn't. In general, I think the clean-up should  
reserialize the DOM output of the HTML5 parser but shouldn't mutate  
the DOM before reserializing.

I think a toggle between real source and reserialized source on the  
View Source window, as Jonas suggested, would make sense. However, I  
think making line numbering match between the real source and the  
reserialized source would be complicated. I'd prefer to compute the  
offset in <script> and <style> line numbers instead so that tools like  
Firebug could adjust their JS and CSS line number offsets with the  
reserialized source toggle if they so chose. Then the reserializer  
could take line numbering-changing liberties in its pretty-printing.

P.S. The pretty-printing probably shouldn't add text nodes, since  
those could break scripts, so it should look like this:
<div
    ><div
        >foo</div
    ></div
 >
which is something authors aren't used to and isn't quite 'pretty'. :-(

A more traditional pretty-printing approach risks breaking scripts.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Tuesday, 17 March 2009 08:19:36 UTC