r106169 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106168‎ | r106169 | r106170 >
Date:09:40, 14 December 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Clean up access to document and body after building the tree.
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.HTML5TreeBuilder.node.js (modified) (history)
  • /trunk/extensions/VisualEditor/tests/parser/parserTests.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js
@@ -199,7 +199,7 @@
200200 pt.postProcessor.doPostProcess(treeBuilder.parser.document);
201201
202202 // And serialize the result.
203 - var out = treeBuilder.body().innerHTML;
 203+ var out = treeBuilder.document.body.innerHTML;
204204
205205 // Finally, check the result vs. the expected result.
206206 pt.checkResult( pt.currentItem, out );
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.HTML5TreeBuilder.node.js
@@ -62,6 +62,9 @@
6363 break;
6464 case "END":
6565 this.emit('end');
 66+ // HACK: This should not be needed really.
 67+ this.document = this.parser.document;
 68+ this.document.body = this.document.getElementsByTagName('body')[0];
6669 break;
6770 case "NEWLINE":
6871 //this.emit('end');
@@ -72,9 +75,6 @@
7376 }
7477 };
7578
76 -FauxHTML5.TreeBuilder.prototype.body = function () {
77 - return this.parser.document.getElementsByTagName('body')[0];
78 -}
7979
8080
8181 if (typeof module == "object") {

Status & tagging log