Document-createComment-createTextNode.js (935B)
1 function test_create(method, iface, nodeType, nodeName) { 2 ["\u000b", "a -- b", "a-", "-b", null, undefined].forEach(function(value) { 3 test(function() { 4 var c = document[method](value); 5 var expected = String(value); 6 assert_true(c instanceof iface); 7 assert_true(c instanceof CharacterData); 8 assert_true(c instanceof Node); 9 assert_equals(c.ownerDocument, document); 10 assert_equals(c.data, expected, "data"); 11 assert_equals(c.nodeValue, expected, "nodeValue"); 12 assert_equals(c.textContent, expected, "textContent"); 13 assert_equals(c.length, expected.length); 14 assert_equals(c.nodeType, nodeType); 15 assert_equals(c.nodeName, nodeName); 16 assert_equals(c.hasChildNodes(), false); 17 assert_equals(c.childNodes.length, 0); 18 assert_equals(c.firstChild, null); 19 assert_equals(c.lastChild, null); 20 }, method + "(" + format_value(value) + ")"); 21 }); 22 }