1
// |reftest| pref(javascript.options.xml.content,true)
2
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
4
* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
11
START("13.4.4.10 - XML contains()");
13
TEST(++nTest, true, XML.prototype.hasOwnProperty("contains"));
17
<employee id="0"><name>Jim</name><age>25</age></employee>
18
<employee id="1"><name>Joe</name><age>20</age></employee>
21
TEST(++nTest, true, emps.contains(emps));
23
// Martin - bug 289706
25
expect = 'gods.contains(\'Kibo\')==false && (gods==\'Kibo\')==false';
32
printStatus('XML markup is:\r\n' + gods.toXMLString());
35
actual = 'gods.contains(\'' + string + '\')==' + gods.contains(string);
37
actual += '(gods==\'' + string + '\')==' + (gods == string);
39
TEST(++nTest, expect, actual);
41
// Martin - bug 289790
43
function containsTest(xmlObject, value)
45
var comparison = (xmlObject == value);
46
var containsCheck = xmlObject.contains(value);
47
var result = (comparison == containsCheck);
49
printStatus('Comparing ' + xmlObject.nodeKind() +
50
' against ' + (typeof value) + ':');
52
printStatus('==: ' + comparison + '; contains: ' + containsCheck +
53
'; check ' + (result ? 'passed' : 'failed'));
57
actual = containsTest(new XML('Kibo'), 'Kibo');
58
TEST(++nTest, true, actual);
60
actual = containsTest(<god>Kibo</god>, 'Kibo');
61
TEST(++nTest, true, actual);