[webkit-dev] Introducing dumpAsMarkup

Maciej Stachowiak mjs at apple.com
Mon Jul 26 15:29:21 PDT 2010


On Jul 26, 2010, at 3:06 PM, Ryosuke Niwa wrote:

> If tests you write only require comparing DOMs, you want to read this.
> 
> We've recently added dump-as-markup. It allows your tests to be platform independent and gives output that is easier to read than render tree dumps. For example, if I have:
> <script src="../../resources/dump-as-markup.js"></script>
> <div id=foo>This is a dumpAsMarkup test.</div>
> <script>window.getSelection().selectAllChildren(foo);</script>
> 
> Then I get:
> 
> <HTML>
> <HEAD>
> <SCRIPT src="../../resources/dump-as-markup.js"></SCRIPT>
> <#text>
> </#text>
> </HEAD>
> <BODY>
> <DIV id="foo">
> <#text><selection-anchor>This is a dumpAsMarkup test.<selection-focus></#text>
> </DIV>
> <#text>
> </#text>
> <SCRIPT> window.getSelection().selectAllChildren(foo); </SCRIPT>
> <#text>
> </#text>
> </BODY>
> </HTML>
> 
> See Writing DumpAsMarkup Tests for more ways you can use dump-as-markup.js

Very cool! I suggest adding # signs to the selection pseudo-elements, just to avoid the tiny risk of conflicting with an actual element in a test. Also, perhaps it would be better to show tag names in lowercase - that can be achieved by using localName instead of nodeName or tagName.

Regards,
Maciej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100726/1fcbdf1a/attachment.html>


More information about the webkit-dev mailing list