content/test/unit/test_treewalker.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/test/unit/test_treewalker.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +function run_test()
    1.10 +{
    1.11 +  test_treeWalker_currentNode();
    1.12 +}
    1.13 +
    1.14 +// TEST CODE
    1.15 +
    1.16 +function test_treeWalker_currentNode()
    1.17 +{
    1.18 +  var XHTMLDocString = '<html xmlns="http://www.w3.org/1999/xhtml">';
    1.19 +  XHTMLDocString += '<body><input/>input</body></html>';
    1.20 +
    1.21 +  var doc = ParseXML(XHTMLDocString);
    1.22 +
    1.23 +  var body = doc.getElementsByTagName("body")[0];
    1.24 +  var filter = I.nsIDOMNodeFilter.SHOW_ELEMENT | I.nsIDOMNodeFilter.SHOW_TEXT;
    1.25 +  var walker = doc.createTreeWalker(body, filter, null);
    1.26 +  walker.currentNode = body.firstChild;
    1.27 +  walker.nextNode();
    1.28 +}
    1.29 +

mercurial