Re: View Source

On Tue, 17 Mar 2009 07:35:19 -0400, Lachlan Hunt <lachlan.hunt@lachy.id.au> wrote:

> Doug Schepers wrote:
>> There are UI features everyone today counts on, merely on convention...  
>> the status bar, tooltips, alerts, scrollbars, etc.  If we are trying to  
>> create a rich and compelling development platform, I see no harm in  
>> specifying such conventions, even if only as a SHOULD.
>
> The specification only needs to specify what is needed for  
> interoperability.  A view clean source feature is not required for  
> interoperability and has no business being mandated by HTML5, even as a  
> SHOULD requirement.
>
> Such a feature is something that browser vendors can develop to compete  
> with each each other, in this case, to attract web developers, and is  
> something already provided by the HTML Tidy extension [1] in Firefox.

It seems like HTML5's:

var uri = "data:text/plain;charset=utf-8" + document.innerHTML;
window.open(uri);

would be enough for a "View clean source" option.

Something like that can be done as a bookmarklet even.

It'll even output a doctype etc. if the browser adds doctype nodes to the DOM.

<http://shadow2531.com/js/html5_getInnerHTML_of_document.txt> is an example (although it's probably not perfect so consider it just an example)

-- 
Michael

Received on Tuesday, 17 March 2009 12:46:11 UTC