W3C home > Mailing lists > Public > www-svg@w3.org > March 2009

Re: View Source

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Tue, 17 Mar 2009 12:44:47 +0100
Message-ID: <49BF8D2F.9060504@lachy.id.au>
To: Henri Sivonen <hsivonen@iki.fi>
Cc: Doug Schepers <schepers@w3.org>, public-html@w3.org, www-svg@w3.org
Henri Sivonen wrote:
> I think a toggle between real source and reserialized source on the View 
> Source window, as Jonas suggested, would make sense.

There are problems that make simply reserialising the source less 
valuable to developers than you might think.  Consider this fragment:

<p>A paragraph with <a href="#">a link</p>
<p>Another paragraph</p>

When that's parsed, the <a> element is cloned so the second paragraph, 
and all subsequent markup until a </a> is found.  Simply reserialising 
would result in:

<p>A paragraph with <a href="#">a link</a></p><a href="#">
<p>Another paragraph</p></a>

(I used the HTML5lib parse tree viewer [1] to get that.  I didn't check 
the spec to make sure that's totally correct)

However, a more useful solution to cleaning up the source would be to 
simply close the <a> element at the end of the first paragraph and not 
clone it for subsequent content.

[1] http://james.html5.org/parsetree.html

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Tuesday, 17 March 2009 11:45:26 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:41 GMT