/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
gTestfile = '13.5.4.4.js';
START("13.5.4.4 - XMLList child()");
TEST(1, true, XMLList.prototype.hasOwnProperty("child"));
// Test with XMLList of size 0
x = new XMLList()
TEST(2, "xml", typeof(x.child("bravo")));
TEST_XML(3, "", x.child("bravo"));
// Test with XMLList of size 1
x += onetwo;
TEST(4, "xml", typeof(x.child("bravo")));
TEST_XML(5, "two", x.child("bravo"));
x += three;
TEST(6, "xml", typeof(x.child("bravo")));
correct = <>twothree>;
TEST(7, correct, x.child("bravo"));
// Test no match, null and undefined
TEST(8, "xml", typeof(x.child("foobar")));
TEST_XML(9, "", x.child("foobar"));
try {
x.child(null);
SHOULD_THROW(10);
} catch (ex) {
TEST(10, "TypeError", ex.name);
}
// Test numeric inputs
x =
one
two
;
TEST(12, one, x.child(0));
TEST(13, two, x.child(1));
END();