Feedback from the webkit-dev thread. 1. Selection markers should be # prefixed 2. nodenames should be lowercase (use localName instead of nodeName) 3. Text nodes should be delimited by quotes, not <#text> 4. Should indent.
Also, there are some things that LayoutTests/html5lib/resources/dom2string.js does that dump-as-markup should do as well: -prints doctype, -deals with misnested DOMs -comments nodes -namespaced nodes/attributes (e.g. svg/math)
Created attachment 62778 [details] Patch
Comment on attachment 62778 [details] Patch Very cool. Thanks for doing this. Unfortunately, we can't change the format of the html5lib test expectations. These data files are just a copy of the "official" ones at <http://code.google.com/p/html5lib/source/browse/#hg/testdata/tree-construction>. The data format in them is chosen to work with a number of different HTML5 parsers in a bunch of different languages (including many that don't execute JavaScript). Can we keep the new dump-as-markup but leave the HTML5lib test suite using the "old and busted" dom2string? Alternatively, we could dump-as-markup produce identical dumps for the HTML5lib test suite, but that might constrain our ability to make dom-as-markup more awesome in the future.
(In reply to comment #3) > Can we keep the new dump-as-markup but leave the HTML5lib test suite using the "old and busted" dom2string? Alternatively, we could dump-as-markup produce identical dumps for the HTML5lib test suite, but that might constrain our ability to make dom-as-markup more awesome in the future. We could pass some flag. e.g. In the .js file loaded for HTML5lib tests, we set Markup.html5lib = true. I don't know... maybe it's not worth combining the code if we have two modes.
The flag sounds like a good idea. I don't quite understand where the differences are coming from, so I'm not sure if they're bugs. Maybe they dump document fragments differently?
Created attachment 62888 [details] Patch
I've made the output match. The only difference before was whether we print the DOM root node passed in. Having as few testing frameworks as possible is a good thing for keeping our tests easy to work with. If we run into something we want to add to dump-as-markup that doesn't work for the html5lib tests, then we can add a flag then. For now, we can have the same output.
Comment on attachment 62888 [details] Patch Fantastic. Thanks Ojan. LayoutTests/html5lib/runner.html:94 + layoutTestController.notifyDone(); I'm curious why you added this. DRT waits until after the load event before finishing.
(In reply to comment #8) > + layoutTestController.notifyDone(); > I'm curious why you added this. DRT waits until after the load event before finishing. This is just the dump-as-markup API being dumb. Instead, I added Markup.noAutoDump, replaced the call to Markup.waitUntilDone, and got rid of the notifyDone call.
Committed r64303: <http://trac.webkit.org/changeset/64303>
http://trac.webkit.org/changeset/64303 might have broken Qt Linux Release