[webkit-dev] Introducing dumpAsMarkup

Adam Barth abarth at webkit.org
Mon Jul 26 15:12:50 PDT 2010


That looks similar to the dom2string library from HTML5lib.
dom2string makes DOM dumps that look like the following:

<!DOCTYPE html><li>hello<li>world<ul>how<li>do</ul>you</body><!--do-->

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <li>
|       "hello"
|     <li>
|       "world"
|       <ul>
|         "how"
|         <li>
|           "do"
|       "you"
|   <!-- do -->

It lets you see all the whitespace nodes and has special handling to
show you elements in the MathML and SVG namespaces.

There's probably no need to standardize on one of dumping the DOM, but
I thought you might be interested.

Adam


On Tue, Jul 27, 2010 at 12:06 AM, Ryosuke Niwa <rniwa at webkit.org> 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
> Best regards,
> Ryosuke Niwa
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>


More information about the webkit-dev mailing list