Initial commit
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1500
File diff suppressed because it is too large
Load Diff
+13
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1 id="lorem">Lore Ipsum</h1>
|
||||
<p>
|
||||
Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam quis risus eget urna mollis ornare vel eu leo. Donec <a href="https://github.com">git</a> ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue.
|
||||
</p>
|
||||
<p class="foo">
|
||||
Cras mattis <tt class="foo">consectetur</tt> purus sit amet fermentum. Donec ullamcorper nulla non metus auctor fringilla. Etiam porta sem malesuada magna mollis euismod. Duis mollis, est non commodo luctus, nisi erat porttitor <tt class="foo bar baz">ligula</tt>, eget lacinia odio sem nec elit. Donec ullamcorper nulla non metus auctor fringilla. Donec ullamcorper nulla non metus auctor fringilla.
|
||||
</p>
|
||||
<div id="tw"><div id="hello">Hello <em id="world" title="World: The Title">World</em></div>ignore<div id="foo" title="Foo: The Title">Foo, <strong id="bar">bar</strong></div></div>
|
||||
</body>
|
||||
</html>
|
||||
+9597
File diff suppressed because it is too large
Load Diff
+9831
File diff suppressed because it is too large
Load Diff
+80692
File diff suppressed because it is too large
Load Diff
+2
@@ -0,0 +1,2 @@
|
||||
exports.w3c = require('./w3c');
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
var domino = require('../');
|
||||
var html5lib_tests = require('./html5lib-tests.json');
|
||||
|
||||
// These test cases are taken from the `html5lib/html5lib-tests` package
|
||||
// on github, in the directory `tree-construction`. The filename in that
|
||||
// directory is the name of each suite of tests.
|
||||
|
||||
function cases(filename, tc) {
|
||||
return tc.filter(function(test) {
|
||||
// We don't support some of these test cases...
|
||||
if (test.fragment && test.fragment.ns) { return false; }
|
||||
// Scripting is always enabled in domino.
|
||||
if (test.script === 'off') { return false; }
|
||||
return true;
|
||||
}).reduce(function(r, test) {
|
||||
var input = test.data, expected = test.document.html,
|
||||
fragment = test.fragment && test.fragment.name;
|
||||
// Come up with a helpful name for the testcase.
|
||||
var trimmed = input, n, candidate;
|
||||
if (trimmed==='') { trimmed = '{no input}'; }
|
||||
if (fragment) { trimmed = fragment + ':' + trimmed; }
|
||||
if (r[trimmed]) {
|
||||
//console.warn("Duplicate test in "+filename+": "+trimmed);
|
||||
}
|
||||
for (n = 40; n < trimmed.length; n += 5) {
|
||||
candidate = trimmed.slice(0, n) + '...';
|
||||
if (!r[candidate]) { trimmed = candidate; break; }
|
||||
}
|
||||
if (/\n/.test(trimmed)) {
|
||||
candidate = trimmed.split(/\n/)[0] + '...';
|
||||
if (!r[candidate]) { trimmed = candidate; }
|
||||
}
|
||||
r[trimmed] = makeOneTest(fragment, input, expected);
|
||||
return r;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function makeOneTest(fragment, input, expected) {
|
||||
return function() {
|
||||
var doc, context;
|
||||
if (fragment) {
|
||||
doc = domino.createDocument();
|
||||
context = (fragment==='body') ? doc.body : doc.createElement(fragment);
|
||||
context.innerHTML = input;
|
||||
context.innerHTML.should.equal(expected);
|
||||
} else {
|
||||
doc = domino.createDocument(input, true);
|
||||
doc.outerHTML.should.equal(expected);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.parseAlgorithm = Object.keys(html5lib_tests).reduce(function(r, file) {
|
||||
r[file] = cases(file, html5lib_tests[file]);
|
||||
return r;
|
||||
}, {});
|
||||
|
||||
// Some extra tests.
|
||||
|
||||
// https://github.com/html5lib/html5lib-tests/issues/20
|
||||
exports.parseAlgorithm['github issue #20'] = {
|
||||
'test1': makeOneTest(
|
||||
'body', '<table><li><li></table>', '<li></li><li></li><table></table>'
|
||||
)
|
||||
};
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
/**
|
||||
* Process entities.json from the HTML5 spec into an array and regular
|
||||
* expression suitable for use in domino's HTMLParser.js implementation.
|
||||
*/
|
||||
var entities_json = process.argv[2];
|
||||
var entities = require(path.resolve(__dirname, entities_json));
|
||||
var keys = Object.keys(entities).map(function(s) {
|
||||
console.assert(s[0] === '&');
|
||||
return s.slice(1); // Don't include leading '&'
|
||||
}).sort();
|
||||
|
||||
var s = '';
|
||||
s += '/*\n';
|
||||
s += ' * This table is generated with test/tools/update-entities.js\n';
|
||||
s += ' */\n';
|
||||
s += 'var namedCharRefs = {\n __proto__: null,\n';
|
||||
|
||||
for (var i=0; i<keys.length; i++) {
|
||||
if (i%2==0) { s+=' '; } else { s += ' '; }
|
||||
s += JSON.stringify(keys[i]);
|
||||
s += ':';
|
||||
var c = entities['&' + keys[i]].characters;
|
||||
if (c.length === 1) {
|
||||
s += '0x' + c.charCodeAt(0).toString(16);
|
||||
} else {
|
||||
s += '[';
|
||||
for (var j=0; j<c.length; j++) {
|
||||
if (j>0) { s+=','; }
|
||||
s += '0x' + c.charCodeAt(j).toString(16);
|
||||
}
|
||||
s += ']';
|
||||
}
|
||||
s += ',';
|
||||
if (i%2==1 || i===keys.length-1) { s+='\n'; }
|
||||
}
|
||||
s += '};\n';
|
||||
|
||||
// Construct a regular expression matching exactly the keys of this table.
|
||||
var esc = function(s) { return s.replace(/[\^\\$*+?.()|{}\[\]\/]/g, '\\$&'); };
|
||||
var prefix = function(keys) {
|
||||
console.assert(keys.length>0 && keys[0].length>0);
|
||||
var first = '', subkeys, accept;
|
||||
var result = [];
|
||||
var emit = function() {
|
||||
if (first==='') { return; }
|
||||
var sub = subkeys.length > 0 ? prefix(subkeys) : [];
|
||||
if (accept) { sub.push(''); }
|
||||
sub = sub.length>1 ? ('(?:' + sub.join('|') + ')') : sub[0];
|
||||
if (sub==='(?:;|)') { sub = ';?'; /* optimization */ }
|
||||
result.push(esc(first) + sub);
|
||||
};
|
||||
for (var i=0; i<keys.length; i++) {
|
||||
if (keys[i][0] !== first) {
|
||||
emit();
|
||||
first = keys[i][0];
|
||||
subkeys = [];
|
||||
accept = false;
|
||||
}
|
||||
if (keys[i].length>1) {
|
||||
subkeys.push(keys[i].slice(1));
|
||||
} else {
|
||||
accept = true;
|
||||
}
|
||||
}
|
||||
emit();
|
||||
return result;
|
||||
};
|
||||
var re = prefix(keys).join('|');
|
||||
s += '/*\n';
|
||||
s += ' * This regexp is generated with test/tools/update-entities.js\n';
|
||||
s += ' * It will always match at least one character -- but note that there\n';
|
||||
s += ' * are no entities whose names are a single character long.\n';
|
||||
s += ' */\n';
|
||||
s += 'var NAMEDCHARREF = /(' + re + ')|[\\s\\S]/g;\n';
|
||||
|
||||
// Verify the property mentioned in the comment above.
|
||||
var lens = keys.map(function(s) { return s.length; });
|
||||
var minlen = Math.min.apply(Math, lens);
|
||||
var maxlen = Math.max.apply(Math, lens);
|
||||
console.assert(minlen > 1);
|
||||
|
||||
s += '\nvar NAMEDCHARREF_MAXLEN = ' + maxlen + ';\n';
|
||||
|
||||
// Emit the result
|
||||
console.log(s);
|
||||
+355
@@ -0,0 +1,355 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var process = require('process');
|
||||
var domino = require('../../');
|
||||
|
||||
/** Rebuild test/html5lib-tests.json based on the test specifications in
|
||||
* the html5lib-tests submodule.
|
||||
*/
|
||||
|
||||
var NAMESPACE = {
|
||||
html: 'http://www.w3.org/1999/xhtml',
|
||||
xml: 'http://www.w3.org/XML/1998/namespace',
|
||||
xmlns: 'http://www.w3.org/2000/xmlns/',
|
||||
math: 'http://www.w3.org/1998/Math/MathML',
|
||||
svg: 'http://www.w3.org/2000/svg',
|
||||
xlink: 'http://www.w3.org/1999/xlink'
|
||||
};
|
||||
// menuitem is no longer EMPTY, see https://github.com/whatwg/html/pull/907
|
||||
// This list comes from https://html.spec.whatwg.org/multipage/syntax.html#serialising-html-fragments
|
||||
var EMPTY = {
|
||||
area: true,
|
||||
base: true,
|
||||
basefont: true,
|
||||
bgsound: true,
|
||||
br: true,
|
||||
col: true,
|
||||
embed: true,
|
||||
frame: true,
|
||||
hr: true,
|
||||
img: true,
|
||||
input: true,
|
||||
keygen: true,
|
||||
link: true,
|
||||
meta: true,
|
||||
param: true,
|
||||
source: true,
|
||||
track: true,
|
||||
wbr: true
|
||||
};
|
||||
var EXTRA_NL = {
|
||||
/* Removed in https://github.com/whatwg/html/issues/944
|
||||
pre: true,
|
||||
textarea: true,
|
||||
listing: true
|
||||
*/
|
||||
};
|
||||
var NO_ESCAPE = {
|
||||
style: true, script: true, xmp:true, iframe:true, noembed:true,
|
||||
noframes:true, plaintext:true,
|
||||
noscript: true // <- assumes that scripting is enabled.
|
||||
};
|
||||
|
||||
var localname = function(namestring) {
|
||||
return namestring.replace(/^(svg|math|xlink|xml|xmlns) /, '');
|
||||
};
|
||||
var namespace = function(namestring) {
|
||||
var m = /^(svg|math|xlink|xml|xmlns) /.exec(namestring);
|
||||
// Save some space by using 'undefined' to represent the html namespace.
|
||||
return m ? NAMESPACE[m[1]] : undefined/*NAMESPACE.html*/;
|
||||
};
|
||||
|
||||
var ParseError = function ParseError(desc, filename, input) {
|
||||
Error.call(this);
|
||||
this.name = this.constructor.name;
|
||||
this.message = desc + ' ['+filename+']: ' + JSON.stringify(input);
|
||||
};
|
||||
ParseError.prototype = Object.create(Error.prototype);
|
||||
ParseError.prototype.constructor = ParseError;
|
||||
|
||||
|
||||
var list_tests = function() {
|
||||
var base = path.join(__dirname, '..', 'html5lib-tests', 'tree-construction');
|
||||
var testfiles = fs.readdirSync(base).filter(function(filename) {
|
||||
return /\.dat$/.test(filename);
|
||||
}).map(function(f) { return path.normalize(path.join(base, f)); });
|
||||
testfiles.sort();
|
||||
return testfiles;
|
||||
};
|
||||
|
||||
var parse_test_file = function(filename) {
|
||||
var basename = path.basename(filename, '.dat');
|
||||
var cases = fs.readFileSync(filename, 'utf8').replace(/\n$/,'')
|
||||
.split(/\n\n(?=#data\n)/g);
|
||||
return cases.map(function(c) {
|
||||
return twiddle_test(basename, parse_one_test(basename, c));
|
||||
});
|
||||
};
|
||||
|
||||
var parse_one_test = function(filename, testcase) {
|
||||
var m = /^#data\n(?:([^]*?)\n)?(?:#script-(on|off)\n)?#errors\n((?:[^\n]*\n)*?)(?:#document-fragment\n([^\n]*)\n)?(?:#script-(on|off)\n)?#document\n([^]*?)$/.exec(testcase+'\n');
|
||||
if (!m) {
|
||||
throw new ParseError("Can't parse test case", filename, testcase);
|
||||
}
|
||||
// According to the README, there should always be at least two newlines
|
||||
// between #data and #errors, but some test cases have only one.
|
||||
// `data` will be null in that case.
|
||||
var fragment = m[4] ? { name: localname(m[4]), ns:namespace(m[4]) } :
|
||||
undefined;
|
||||
return {
|
||||
//file: filename,
|
||||
data: m[1] || '',
|
||||
errors: m[3].split(/\n/g).slice(0,-1),
|
||||
fragment: fragment,
|
||||
script: m[2] || m[5],
|
||||
document: serialize_doc(filename, fragment, m[6])
|
||||
};
|
||||
};
|
||||
|
||||
// Parse the node tree spec, emitting a serialized output string as well
|
||||
// as a JSON representation of the tree.
|
||||
var serialize_doc = function(filename, fragment, doc) {
|
||||
var result = "", stack = [], can_add_attr = false, props = {tags:{}};
|
||||
var root = { children: [] }, parent, obj;
|
||||
if (fragment) { root.tag = fragment.name; root.ns = fragment.ns; }
|
||||
var clear_add_attr = function() {
|
||||
if (can_add_attr) {
|
||||
result += '>';
|
||||
can_add_attr = false;
|
||||
}
|
||||
};
|
||||
var pop_stack = function() {
|
||||
clear_add_attr();
|
||||
var old = stack.pop();
|
||||
if (old.content !== true) {
|
||||
if (old.ns===namespace('html') && EMPTY[old.tag]) {
|
||||
if (old.children.length > 0) {
|
||||
throw new ParseError("Empty elements ("+old.tag+") can't have children",
|
||||
filename, doc);
|
||||
}
|
||||
} else {
|
||||
result += '</' + old.tag + '>';
|
||||
}
|
||||
}
|
||||
// save some space in the JSON output by omitting empty lists
|
||||
if (old.children.length===0) { old.children = undefined; }
|
||||
if (old.attrs && old.attrs.length===0) { old.attrs = undefined; }
|
||||
return old;
|
||||
};
|
||||
var stack_top = function() {
|
||||
if (stack.length === 0) { return root; }
|
||||
return stack[stack.length-1];
|
||||
};
|
||||
var escape = function(s) {
|
||||
return s.replace(/[&<>\u00A0]/g, function(c) {
|
||||
switch(c) {
|
||||
case '&': return '&';
|
||||
case '<': return '<';
|
||||
case '>': return '>';
|
||||
case '\u00A0': return ' ';
|
||||
}
|
||||
});
|
||||
};
|
||||
var escapeAttr = function(s) {
|
||||
return s.replace(/[&"\u00A0]/g, function(c) {
|
||||
switch(c) {
|
||||
case '&': return '&';
|
||||
case '"': return '"';
|
||||
case '\u00A0': return ' ';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
while (doc.length > 0) {
|
||||
var m = /^\| ((?: )*)(?:<([^!?>][^>]*)>|([^="\n][^=\n]*)="([^"]*)"|"((?:[^"]|"(?!\n))*)"|<!-- ((?:[^](?!-->))*) -->|<!DOCTYPE ([^>]*)>|<\?([^>]+)>|(content))\n/.exec(doc);
|
||||
if (!m) {
|
||||
throw new ParseError('Bad document line', filename, doc);
|
||||
}
|
||||
doc = doc.slice(m[0].length);
|
||||
var indent = m[1].length / 2;
|
||||
while (indent < stack.length) {
|
||||
pop_stack();
|
||||
}
|
||||
if (indent !== stack.length) {
|
||||
throw new ParseError('Indentation error', filename, doc);
|
||||
}
|
||||
var tagname = m[2], attrname = m[3], attrvalue = m[4];
|
||||
var text = m[5], comment = m[6], doctype = m[7], processing = m[8];
|
||||
var template_content = m[9];
|
||||
if (attrname !== undefined) {
|
||||
if (!can_add_attr)
|
||||
throw new ParseError('Late attribute', filename, m);
|
||||
obj = {
|
||||
name:localname(attrname),
|
||||
ns:namespace(attrname),
|
||||
value:attrvalue
|
||||
};
|
||||
if (attrvalue !== escapeAttr(attrvalue)) {
|
||||
obj.escaped = props.escaped = true;
|
||||
}
|
||||
var serializedName;
|
||||
if (obj.ns === namespace('html')) {
|
||||
serializedName = obj.name;
|
||||
} else if (obj.ns === NAMESPACE.xml) {
|
||||
serializedName = 'xml:' + obj.name;
|
||||
} else if (obj.ns == NAMESPACE.xmlns) {
|
||||
if (obj.name === 'xmlns') {
|
||||
serializedName = 'xmlns';
|
||||
} else {
|
||||
serializedName = 'xmlns:' + obj.name;
|
||||
}
|
||||
} else if (obj.ns === NAMESPACE.xlink) {
|
||||
serializedName = 'xlink:' + obj.name;
|
||||
} else {
|
||||
throw new Error("don't know what qualified name to use");
|
||||
}
|
||||
result += ' ' + serializedName + '="' + escapeAttr(obj.value) + '"';
|
||||
stack_top().attrs.push(obj);
|
||||
if (/[<"]/.test(serializedName)) {
|
||||
props.attrWithFunnyChar = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
clear_add_attr();
|
||||
if (tagname !== undefined) {
|
||||
result += '<' + localname(tagname);
|
||||
can_add_attr = true;
|
||||
props.tags[tagname] = true;
|
||||
if (/</.test(tagname)) {
|
||||
props.tagWithLt = true;
|
||||
}
|
||||
parent = stack_top();
|
||||
stack.push({
|
||||
tag: localname(tagname),
|
||||
ns: namespace(tagname),
|
||||
attrs: [],
|
||||
children: []
|
||||
});
|
||||
parent.children.push(stack_top());
|
||||
continue;
|
||||
}
|
||||
if (text !== undefined) {
|
||||
obj = { text: text };
|
||||
if (stack_top().ns === namespace('html') &&
|
||||
NO_ESCAPE[stack_top().tag]) {
|
||||
obj.no_escape = props.no_escape = true;
|
||||
}
|
||||
if (stack_top().ns === namespace('html') &&
|
||||
EXTRA_NL[stack_top().tag] &&
|
||||
stack_top().children.length === 0 &&
|
||||
/^\n/.test(text)) {
|
||||
result += '\n';
|
||||
obj.extraNL = props.extraNL = true;
|
||||
}
|
||||
if (text !== escape(text) && !obj.no_escape) {
|
||||
obj.escaped = props.escaped = true;
|
||||
}
|
||||
result += obj.no_escape ? text : escape(text);
|
||||
stack_top().children.push(obj);
|
||||
continue;
|
||||
}
|
||||
if (comment !== undefined) {
|
||||
result += '<!--' + comment + '-->';
|
||||
props.comment = true;
|
||||
stack_top().children.push({ comment: comment });
|
||||
continue;
|
||||
}
|
||||
if (doctype !== undefined) {
|
||||
// HTML serialization spec says just include the name, not the
|
||||
// public or system identifiers.
|
||||
result += '<!DOCTYPE ' + doctype.replace(/ .*$/, '') + '>';
|
||||
props.doctype = true;
|
||||
stack_top().children.push({ doctype: doctype });
|
||||
continue;
|
||||
}
|
||||
if (processing !== undefined) {
|
||||
result += '<?' + processing + '>';
|
||||
props.processing = true;
|
||||
stack_top().children.push({ processing: processing });
|
||||
continue;
|
||||
}
|
||||
if (template_content !== undefined) {
|
||||
parent = stack_top();
|
||||
stack.push({content:true, children:[]});
|
||||
parent.children.push(stack_top());
|
||||
can_add_attr = false;
|
||||
props.template = true;
|
||||
continue;
|
||||
}
|
||||
throw new ParseError("Unknown line type", filename, m);
|
||||
}
|
||||
while (stack.length > 0) {
|
||||
pop_stack();
|
||||
}
|
||||
return {
|
||||
props: props,
|
||||
tree: root.children,
|
||||
html: result
|
||||
};
|
||||
};
|
||||
|
||||
var twiddle_test = function(filename, tc) {
|
||||
// Adjust the expected HTML serialization for some tests so that
|
||||
// output attribute order always matches input attributes order.
|
||||
var expected = tc.document.html;
|
||||
|
||||
// Tweak the order of attributes:
|
||||
if (/^isindex$/.test(filename) &&
|
||||
/<isindex name="A" action="B" prompt="C" foo="D"/.test(tc.data) &&
|
||||
/<isindex action="B" foo="D" name="A" prompt="C"/.test(expected)) {
|
||||
expected = expected.replace(/<(isindex) (action="B") (foo="D") (name="A") (prompt="C")/,
|
||||
'<$1 $4 $2 $5 $3');
|
||||
}
|
||||
if (/^tests(9|10)$/.test(filename) &&
|
||||
/<(g|mi) xml:lang=en xlink:href=foo/.test(tc.data) &&
|
||||
/<(g|mi) xlink:href="foo" xml:lang="en"/.test(expected)) {
|
||||
expected = expected.replace(/<(g|mi) (xlink[^> ]+) (xml[^> ]+)/g,
|
||||
'<$1 $3 $2');
|
||||
}
|
||||
if (filename==='tests19' &&
|
||||
/<html c=d>.*<html a=b>/.test(tc.data) &&
|
||||
/<html a="b" c="d">/.test(expected)) {
|
||||
expected = expected.replace(/a="b" c="d"/, 'c="d" a="b"');
|
||||
}
|
||||
if (filename==='tests19' &&
|
||||
/http-equiv="content-type" content="[^\"]+"/.test(tc.data) &&
|
||||
/content="[^\"]+" http-equiv="content-type"/.test(expected)) {
|
||||
expected = expected.replace(/(content=[^> ]+) (http-equiv=[^> ]+)/g, '$2 $1');
|
||||
}
|
||||
if (filename==='tests23' &&
|
||||
/size=4 id=a/.test(tc.data) &&
|
||||
/id="a" size="4"/.test(expected)) {
|
||||
expected = expected.replace(/(id=[^> ]+) (size=[^> ]+)/g, '$2 $1');
|
||||
}
|
||||
if (filename==='tests26' &&
|
||||
/<code code="" x<="">/.test(expected)) {
|
||||
expected = expected.replace(/(code=[^> ]+) (x<=[^> ]+)/g, '$2 $1');
|
||||
}
|
||||
if (filename==='webkit01' &&
|
||||
/<rdar: 6869687="" problem="">/.test(expected)) {
|
||||
expected = expected.replace(/(6869687=[^> ]+) (problem=[^> ]+)/g, '$2 $1');
|
||||
}
|
||||
tc.document.html = expected;
|
||||
// Will this pass if parsed as a <body> fragment in no-quirks mode?
|
||||
// This property is used by some third-party consumers of the parsed
|
||||
// tests.
|
||||
var dd = domino.createDocument();
|
||||
dd.body.innerHTML = tc.data;
|
||||
tc.document.noQuirksBodyHtml = dd.body.innerHTML;
|
||||
|
||||
return tc;
|
||||
};
|
||||
|
||||
var result = list_tests().reduce(function(result, filename){
|
||||
result[path.basename(filename)] = parse_test_file(filename);
|
||||
return result;
|
||||
}, {});
|
||||
//console.log(JSON.stringify(result, null, 2));
|
||||
if (process.argv[2]) {
|
||||
fs.writeFileSync(process.argv[2], JSON.stringify(result, null, 2), 'utf8');
|
||||
console.warn('Wrote', process.argv[2]);
|
||||
} else {
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# Document Object Model (DOM) Conformance Test Suites
|
||||
|
||||
http://www.w3.org/DOM/Test/
|
||||
|
||||
Since domino doesn't implement deprecated DOM features some tests are no longer relevant. These tests have been moved to the `obsolete` directory so that they are excluded from the suite.
|
||||
|
||||
## Attributes vs. Nodes
|
||||
|
||||
The majority of the excluded level1/core tests expect Attributes to inherit from the Node interface which is no longer required in DOM level 4. Also `Element.attributes` no longer returns a NamedNodeMap but a read-only array.
|
||||
|
||||
## Obsolete Attributes
|
||||
|
||||
Another big hunk of excluded tests checks the support of reflected attributes that have become obsolete in HTML 5.
|
||||
+438
@@ -0,0 +1,438 @@
|
||||
/*
|
||||
Copyright (c) 2001-2005 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, Institut National de
|
||||
Recherche en Informatique et en Automatique, Keio University). All
|
||||
Rights Reserved. This program is distributed under the W3C's Software
|
||||
Intellectual Property License. This program is distributed in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
See W3C License http://www.w3.org/Consortium/Legal/ for more details.
|
||||
*/
|
||||
|
||||
function assertSize(descr, expected, actual) {
|
||||
var actualSize;
|
||||
assertNotNull(descr, actual);
|
||||
actualSize = actual.length;
|
||||
assertEquals(descr, expected, actualSize);
|
||||
}
|
||||
|
||||
function assertEqualsAutoCase(context, descr, expected, actual) {
|
||||
if (builder.contentType == "text/html") {
|
||||
if(context == "attribute") {
|
||||
assertEquals(descr, expected.toLowerCase(), actual.toLowerCase());
|
||||
}
|
||||
else {
|
||||
assertEquals(descr, expected.toUpperCase(), actual);
|
||||
}
|
||||
}
|
||||
else {
|
||||
assertEquals(descr, expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function assertEqualsCollectionAutoCase(context, descr, expected, actual) {
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
|
||||
//
|
||||
// if there length is the same, then every entry in the expected list
|
||||
// must appear once and only once in the actual list
|
||||
var expectedLen = expected.length;
|
||||
var expectedValue;
|
||||
var actualLen = actual.length;
|
||||
var i;
|
||||
var j;
|
||||
var matches;
|
||||
for(i = 0; i < expectedLen; i++) {
|
||||
matches = 0;
|
||||
expectedValue = expected[i];
|
||||
for(j = 0; j < actualLen; j++) {
|
||||
if (builder.contentType == "text/html") {
|
||||
if (context == "attribute") {
|
||||
if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (expectedValue.toUpperCase() == actual[j]) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(expectedValue == actual[j]) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(matches == 0) {
|
||||
assert(descr + ": No match found for " + expectedValue,false);
|
||||
}
|
||||
if(matches > 1) {
|
||||
assert(descr + ": Multiple matches found for " + expectedValue, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function assertEqualsCollection(descr, expected, actual) {
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
//
|
||||
// if there length is the same, then every entry in the expected list
|
||||
// must appear once and only once in the actual list
|
||||
var expectedLen = expected.length;
|
||||
var expectedValue;
|
||||
var actualLen = actual.length;
|
||||
var i;
|
||||
var j;
|
||||
var matches;
|
||||
for(i = 0; i < expectedLen; i++) {
|
||||
matches = 0;
|
||||
expectedValue = expected[i];
|
||||
for(j = 0; j < actualLen; j++) {
|
||||
if(expectedValue == actual[j]) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
if(matches == 0) {
|
||||
assert(descr + ": No match found for " + expectedValue,false);
|
||||
}
|
||||
if(matches > 1) {
|
||||
assert(descr + ": Multiple matches found for " + expectedValue, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function assertEqualsListAutoCase(context, descr, expected, actual) {
|
||||
var minLength = expected.length;
|
||||
if (actual.length < minLength) {
|
||||
minLength = actual.length;
|
||||
}
|
||||
//
|
||||
for(var i = 0; i < minLength; i++) {
|
||||
assertEqualsAutoCase(context, descr, expected[i], actual[i]);
|
||||
}
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
}
|
||||
|
||||
function assertEqualsList(descr, expected, actual) {
|
||||
var minLength = expected.length;
|
||||
if (actual.length < minLength) {
|
||||
minLength = actual.length;
|
||||
}
|
||||
//
|
||||
for(var i = 0; i < minLength; i++) {
|
||||
if(expected[i] != actual[i]) {
|
||||
assertEquals(descr, expected[i], actual[i]);
|
||||
}
|
||||
}
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
}
|
||||
|
||||
function assertInstanceOf(descr, type, obj) {
|
||||
if(type == "Attr") {
|
||||
assertEquals(descr,2,obj.nodeType);
|
||||
var specd = obj.specified;
|
||||
}
|
||||
}
|
||||
|
||||
function assertSame(descr, expected, actual) {
|
||||
if(expected != actual) {
|
||||
assertEquals(descr, expected.nodeType, actual.nodeType);
|
||||
assertEquals(descr, expected.nodeValue, actual.nodeValue);
|
||||
}
|
||||
}
|
||||
|
||||
function assertURIEquals(assertID, scheme, path, host, file, name, query, fragment, isAbsolute, actual) {
|
||||
//
|
||||
// URI must be non-null
|
||||
assertNotNull(assertID, actual);
|
||||
|
||||
var uri = actual;
|
||||
|
||||
var lastPound = actual.lastIndexOf("#");
|
||||
var actualFragment = "";
|
||||
if(lastPound != -1) {
|
||||
//
|
||||
// substring before pound
|
||||
//
|
||||
uri = actual.substring(0,lastPound);
|
||||
actualFragment = actual.substring(lastPound+1);
|
||||
}
|
||||
if(fragment != null) assertEquals(assertID,fragment, actualFragment);
|
||||
|
||||
var lastQuestion = uri.lastIndexOf("?");
|
||||
var actualQuery = "";
|
||||
if(lastQuestion != -1) {
|
||||
//
|
||||
// substring before pound
|
||||
//
|
||||
uri = actual.substring(0,lastQuestion);
|
||||
actualQuery = actual.substring(lastQuestion+1);
|
||||
}
|
||||
if(query != null) assertEquals(assertID, query, actualQuery);
|
||||
|
||||
var firstColon = uri.indexOf(":");
|
||||
var firstSlash = uri.indexOf("/");
|
||||
var actualPath = uri;
|
||||
var actualScheme = "";
|
||||
if(firstColon != -1 && firstColon < firstSlash) {
|
||||
actualScheme = uri.substring(0,firstColon);
|
||||
actualPath = uri.substring(firstColon + 1);
|
||||
}
|
||||
|
||||
if(scheme != null) {
|
||||
assertEquals(assertID, scheme, actualScheme);
|
||||
}
|
||||
|
||||
if(path != null) {
|
||||
assertEquals(assertID, path, actualPath);
|
||||
}
|
||||
|
||||
if(host != null) {
|
||||
var actualHost = "";
|
||||
if(actualPath.substring(0,2) == "//") {
|
||||
var termSlash = actualPath.substring(2).indexOf("/") + 2;
|
||||
actualHost = actualPath.substring(0,termSlash);
|
||||
}
|
||||
assertEquals(assertID, host, actualHost);
|
||||
}
|
||||
|
||||
if(file != null || name != null) {
|
||||
var actualFile = actualPath;
|
||||
var finalSlash = actualPath.lastIndexOf("/");
|
||||
if(finalSlash != -1) {
|
||||
actualFile = actualPath.substring(finalSlash+1);
|
||||
}
|
||||
if (file != null) {
|
||||
assertEquals(assertID, file, actualFile);
|
||||
}
|
||||
if (name != null) {
|
||||
var actualName = actualFile;
|
||||
var finalDot = actualFile.lastIndexOf(".");
|
||||
if (finalDot != -1) {
|
||||
actualName = actualName.substring(0, finalDot);
|
||||
}
|
||||
assertEquals(assertID, name, actualName);
|
||||
}
|
||||
}
|
||||
|
||||
if(isAbsolute != null) {
|
||||
assertEquals(assertID + ' ' + actualPath, isAbsolute, actualPath.substring(0,1) == "/");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// size() used by assertSize element
|
||||
function size(collection) {
|
||||
return collection.length;
|
||||
}
|
||||
|
||||
function same(expected, actual) {
|
||||
return expected === actual;
|
||||
}
|
||||
|
||||
function getSuffix(contentType) {
|
||||
switch(contentType) {
|
||||
case "text/html":
|
||||
return ".html";
|
||||
|
||||
case "text/xml":
|
||||
return ".xml";
|
||||
|
||||
case "application/xhtml+xml":
|
||||
return ".xhtml";
|
||||
|
||||
case "image/svg+xml":
|
||||
return ".svg";
|
||||
|
||||
case "text/mathml":
|
||||
return ".mml";
|
||||
}
|
||||
return ".html";
|
||||
}
|
||||
|
||||
function equalsAutoCase(context, expected, actual) {
|
||||
if (builder.contentType == "text/html") {
|
||||
if (context == "attribute") {
|
||||
return expected.toLowerCase() == actual;
|
||||
}
|
||||
return expected.toUpperCase() == actual;
|
||||
}
|
||||
return expected == actual;
|
||||
}
|
||||
|
||||
function catchInitializationError(blder, ex) {
|
||||
if (blder == null) {
|
||||
alert(ex);
|
||||
}
|
||||
else {
|
||||
blder.initializationError = ex;
|
||||
blder.initializationFatalError = ex;
|
||||
}
|
||||
}
|
||||
|
||||
function checkInitialization(blder, testname) {
|
||||
if (blder.initializationError != null) {
|
||||
if (blder.skipIncompatibleTests) {
|
||||
info(testname + " not run:" + blder.initializationError);
|
||||
return blder.initializationError;
|
||||
}
|
||||
else {
|
||||
//
|
||||
// if an exception was thrown
|
||||
// rethrow it and do not run the test
|
||||
if (blder.initializationFatalError != null) {
|
||||
throw blder.initializationFatalError;
|
||||
} else {
|
||||
//
|
||||
// might be recoverable, warn but continue the test
|
||||
warn(testname + ": " + blder.initializationError);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function createTempURI(scheme) {
|
||||
if (scheme == "http") {
|
||||
return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
|
||||
}
|
||||
return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml";
|
||||
}
|
||||
|
||||
|
||||
function EventMonitor() {
|
||||
this.atEvents = new Array();
|
||||
this.bubbledEvents = new Array();
|
||||
this.capturedEvents = new Array();
|
||||
this.allEvents = new Array();
|
||||
}
|
||||
|
||||
EventMonitor.prototype.handleEvent = function(evt) {
|
||||
switch(evt.eventPhase) {
|
||||
case 1:
|
||||
monitor.capturedEvents[monitor.capturedEvents.length] = evt;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
monitor.atEvents[monitor.atEvents.length] = evt;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
monitor.bubbledEvents[monitor.bubbledEvents.length] = evt;
|
||||
break;
|
||||
}
|
||||
monitor.allEvents[monitor.allEvents.length] = evt;
|
||||
}
|
||||
|
||||
function DOMErrorImpl(err) {
|
||||
this.severity = err.severity;
|
||||
this.message = err.message;
|
||||
this.type = err.type;
|
||||
this.relatedException = err.relatedException;
|
||||
this.relatedData = err.relatedData;
|
||||
this.location = err.location;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function DOMErrorMonitor() {
|
||||
this.allErrors = new Array();
|
||||
}
|
||||
|
||||
DOMErrorMonitor.prototype.handleError = function(err) {
|
||||
errorMonitor.allErrors[errorMonitor.allErrors.length] = new DOMErrorImpl(err);
|
||||
}
|
||||
|
||||
DOMErrorMonitor.prototype.assertLowerSeverity = function(id, severity) {
|
||||
var i;
|
||||
for (i = 0; i < errorMonitor.allErrors.length; i++) {
|
||||
if (errorMonitor.allErrors[i].severity >= severity) {
|
||||
assertEquals(id, severity - 1, errorMonitor.allErrors[i].severity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function UserDataNotification(operation, key, data, src, dst) {
|
||||
this.operation = operation;
|
||||
this.key = key;
|
||||
this.data = data;
|
||||
this.src = src;
|
||||
this.dst = dst;
|
||||
}
|
||||
|
||||
function UserDataMonitor() {
|
||||
this.allNotifications = new Array();
|
||||
}
|
||||
|
||||
UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) {
|
||||
userDataMonitor.allNotifications[this.allNotifications.length] =
|
||||
new UserDataNotification(operation, key, data, src, dst);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function checkFeature(feature, version)
|
||||
{
|
||||
if (!builder.hasFeature(feature, version))
|
||||
{
|
||||
//
|
||||
// don't throw exception so that users can select to ignore the precondition
|
||||
//
|
||||
builder.initializationError = "builder does not support feature " + feature + " version " + version;
|
||||
}
|
||||
}
|
||||
|
||||
function preload(frame, varname, url) {
|
||||
return builder.preload(frame, varname, url);
|
||||
}
|
||||
|
||||
function load(frame, varname, url) {
|
||||
return builder.load(frame, varname, url);
|
||||
}
|
||||
|
||||
function getImplementationAttribute(attr) {
|
||||
return builder.getImplementationAttribute(attr);
|
||||
}
|
||||
|
||||
|
||||
function setImplementationAttribute(attribute, value) {
|
||||
builder.setImplementationAttribute(attribute, value);
|
||||
}
|
||||
|
||||
function setAsynchronous(value) {
|
||||
if (builder.supportsAsyncChange) {
|
||||
builder.async = value;
|
||||
} else {
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toLowerArray(src) {
|
||||
var newArray = new Array();
|
||||
var i;
|
||||
for (i = 0; i < src.length; i++) {
|
||||
newArray[i] = src[i].toLowerCase();
|
||||
}
|
||||
return newArray;
|
||||
}
|
||||
|
||||
function getImplementation() {
|
||||
return builder.getImplementation();
|
||||
}
|
||||
|
||||
function warn(msg) {
|
||||
//console.log(msg);
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
var fs = require('fs');
|
||||
var vm = require('vm');
|
||||
var assert = require('assert');
|
||||
var util = require('util');
|
||||
var Path = require('path');
|
||||
var domino = require('../../../lib');
|
||||
var impl = domino.createDOMImplementation();
|
||||
var Window = require('../../../lib/Window');
|
||||
|
||||
var globals = {
|
||||
assertEquals: function(message, expected, actual) {
|
||||
assert.equal(actual, expected, message + ': expected ' +
|
||||
util.inspect(expected, false, 0) + ' got ' +
|
||||
util.inspect(actual, false, 0)
|
||||
);
|
||||
},
|
||||
assertTrue: function(message, actual) {
|
||||
globals.assertEquals(message, true, actual);
|
||||
},
|
||||
assertFalse: function(message, actual) {
|
||||
assert.ok(!actual, message);
|
||||
},
|
||||
assertNull: function(message, actual) {
|
||||
globals.assertEquals(message, null, actual);
|
||||
},
|
||||
assertNotNull: function(message, actual) {
|
||||
assert.notEqual(actual, null, message);
|
||||
},
|
||||
console: console
|
||||
};
|
||||
|
||||
function list(dir, re, fn) {
|
||||
dir = Path.resolve(__dirname, '..', dir);
|
||||
fs.readdirSync(dir).forEach(function(file) {
|
||||
var path = Path.join(dir, file);
|
||||
var m = re.exec(path);
|
||||
if (m) fn.apply(null, m);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function(path) {
|
||||
|
||||
function run(ctx, file) {
|
||||
vm.runInContext(fs.readFileSync(file, 'utf8'), ctx, file);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
function makeContext() {
|
||||
var ctx = vm.createContext(); // create new independent context
|
||||
Object.keys(globals).forEach(function(k) {
|
||||
ctx[k] = globals[k]; // shallow clone
|
||||
});
|
||||
|
||||
ctx.createConfiguredBuilder = function() {
|
||||
return {
|
||||
contentType: 'text/html',
|
||||
hasFeature: function(feature, version) {
|
||||
return impl.hasFeature(feature, version);
|
||||
},
|
||||
getImplementation: function() {
|
||||
return impl;
|
||||
},
|
||||
setImplementationAttribute: function(attr, value) {
|
||||
// Ignore
|
||||
},
|
||||
preload: function(docRef, name, href) {
|
||||
return 1;
|
||||
},
|
||||
load: function(docRef, name, href) {
|
||||
var doc = Path.resolve(__dirname, '..', path, 'files', href) + '.html';
|
||||
var html = fs.readFileSync(doc, 'utf8');
|
||||
var url = 'http://example.com/'+Path.join(path,'files',href)+'.html';
|
||||
|
||||
var document = domino.createDocument(html);
|
||||
document.address = url;
|
||||
var win = new Window(document);
|
||||
return win.document;
|
||||
}
|
||||
};
|
||||
};
|
||||
run(ctx, __dirname + '/DomTestCase.js');
|
||||
return ctx;
|
||||
}
|
||||
|
||||
var tests = {};
|
||||
list(path, /(.*?)\.js$/, function(file, basename) {
|
||||
tests[basename] = function() {
|
||||
var ctx = makeContext();
|
||||
run(ctx, file);
|
||||
ctx.setUpPage();
|
||||
ctx.runTest();
|
||||
};
|
||||
});
|
||||
return tests;
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
var suite = require('./harness');
|
||||
|
||||
exports.level1 = {
|
||||
core: suite('level1/core/'),
|
||||
html: suite('level1/html/')
|
||||
};
|
||||
/*
|
||||
exports.level2 = {
|
||||
core: suite('level2/core/'),
|
||||
html: suite('level2/html/')
|
||||
};
|
||||
*/
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctypenodtd";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("validating", false);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_nodtdstaff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getDoctype()" method returns null for XML documents
|
||||
without a document type declaration.
|
||||
Retrieve the XML document without a DTD and invoke the
|
||||
"getDoctype()" method. It should return null.
|
||||
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31
|
||||
*/
|
||||
function documentgetdoctypenodtd() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "documentgetdoctypenodtd") != null) return;
|
||||
var doc;
|
||||
var docType;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_nodtdstaff");
|
||||
docType = doc.doctype;
|
||||
|
||||
assertNull("documentGetDocTypeNoDTDAssert",docType);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
documentgetdoctypenodtd();
|
||||
}
|
||||
Generated
Vendored
+143
@@ -0,0 +1,143 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
checkFeature("XML", null);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "createProcessingInstruction(target,data) method
|
||||
raises an INVALID_CHARACTER_ERR DOMException if the
|
||||
specified tagName contains an invalid character.
|
||||
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
|
||||
*/
|
||||
function documentinvalidcharacterexceptioncreatepi() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi") != null) return;
|
||||
var doc;
|
||||
var badPI;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html" && false /*CSA: allowed in DOM 4*/)
|
||||
|
||||
) {
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction("foo","data");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 9);
|
||||
}
|
||||
assertTrue("throw_NOT_SUPPORTED_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction("invalid^Name","data");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 5);
|
||||
}
|
||||
assertTrue("throw_INVALID_CHARACTER_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
documentinvalidcharacterexceptioncreatepi();
|
||||
}
|
||||
Generated
Vendored
+140
@@ -0,0 +1,140 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
checkFeature("XML", null);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Creating a processing instruction with an empty target should cause an INVALID_CHARACTER_ERR.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
|
||||
*/
|
||||
function documentinvalidcharacterexceptioncreatepi1() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi1") != null) return;
|
||||
var doc;
|
||||
var badPI;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html" && false /*CSA: allowed in DOM 4*/)
|
||||
|
||||
) {
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction("foo","data");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 9);
|
||||
}
|
||||
assertTrue("throw_NOT_SUPPORTED_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction("","data");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 5);
|
||||
}
|
||||
assertTrue("throw_INVALID_CHARACTER_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
documentinvalidcharacterexceptioncreatepi1();
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hc_nodtdstaff</title></head><body onload="parent.loadComplete()">
|
||||
<p>
|
||||
<em>EMP0001</em>
|
||||
<strong>Margaret Martin</strong>
|
||||
<code>Accountant</code>
|
||||
<sup>56,000</sup>
|
||||
<var>Female</var>
|
||||
<acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
|
||||
</p>
|
||||
</body></html>
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd" >
|
||||
<!-- This is comment number 1.-->
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hc_staff</title><script type="text/javascript" src="svgunit.js"></script><script charset="UTF-8" type="text/javascript" src="svgtest.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()">
|
||||
<p>
|
||||
<em>EMP0001</em>
|
||||
<strong>Margaret Martin</strong>
|
||||
<code>Accountant</code>
|
||||
<sup>56,000</sup>
|
||||
<var>Female</var>
|
||||
<acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
|
||||
</p>
|
||||
<p>
|
||||
<em>EMP0002</em>
|
||||
<strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2;
|
||||
This is an adjacent CDATASection with a reference to a tab &tab;</strong>
|
||||
<code>Secretary</code>
|
||||
<sup>35,000</sup>
|
||||
<var>Female</var>
|
||||
<acronym title="Yes" class="Yes">β Dallas, γ
|
||||
98554</acronym>
|
||||
</p>
|
||||
<p>
|
||||
<em>EMP0003</em>
|
||||
<strong>Roger
|
||||
Jones</strong>
|
||||
<code>Department Manager</code>
|
||||
<sup>100,000</sup>
|
||||
<var>δ</var>
|
||||
<acronym title="Yes" class="No">PO Box 27 Irving, texas 98553</acronym>
|
||||
</p>
|
||||
<p>
|
||||
<em>EMP0004</em>
|
||||
<strong>Jeny Oconnor</strong>
|
||||
<code>Personnel Director</code>
|
||||
<sup>95,000</sup>
|
||||
<var>Female</var>
|
||||
<acronym title="Yes" class="Yα">27 South Road. Dallas, Texas 98556</acronym>
|
||||
</p>
|
||||
<p>
|
||||
<em>EMP0005</em>
|
||||
<strong>Robert Myers</strong>
|
||||
<code>Computer Specialist</code>
|
||||
<sup>90,000</sup>
|
||||
<var>male</var>
|
||||
<acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
|
||||
</p>
|
||||
</body></html>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<!ELEMENT employeeId (#PCDATA)>
|
||||
<!ELEMENT name (#PCDATA)>
|
||||
<!ELEMENT position (#PCDATA)>
|
||||
<!ELEMENT salary (#PCDATA)>
|
||||
<!ELEMENT address (#PCDATA)>
|
||||
<!ELEMENT entElement ( #PCDATA ) >
|
||||
<!ELEMENT gender ( #PCDATA | entElement )* >
|
||||
<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
|
||||
<!ELEMENT staff (employee)+>
|
||||
<!ATTLIST entElement
|
||||
attr1 CDATA "Attr">
|
||||
<!ATTLIST address
|
||||
domestic CDATA #IMPLIED
|
||||
street CDATA "Yes">
|
||||
<!ATTLIST entElement
|
||||
domestic CDATA "MALE" >
|
||||
|
||||
Generated
Vendored
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddata";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "appendData(arg)" method appends a string to the end
|
||||
of the character data of the node.
|
||||
|
||||
Retrieve the character data from the second child
|
||||
of the first employee. The appendData(arg) method is
|
||||
called with arg=", Esquire". The method should append
|
||||
the specified data to the already existing character
|
||||
data. The new value return by the "getLength()" method
|
||||
should be 24.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
|
||||
*/
|
||||
function hc_characterdataappenddata() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataappenddata") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childValue;
|
||||
var childLength;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.appendData(", Esquire");
|
||||
childValue = child.data;
|
||||
|
||||
childLength = childValue.length;
|
||||
assertEquals("characterdataAppendDataAssert",24,childLength);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataappenddata();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddatagetdata";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
On successful invocation of the "appendData(arg)"
|
||||
method the "getData()" method provides access to the
|
||||
concatentation of data and the specified string.
|
||||
|
||||
Retrieve the character data from the second child
|
||||
of the first employee. The appendData(arg) method is
|
||||
called with arg=", Esquire". The method should append
|
||||
the specified data to the already existing character
|
||||
data. The new value return by the "getData()" method
|
||||
should be "Margaret Martin, Esquire".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
|
||||
*/
|
||||
function hc_characterdataappenddatagetdata() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataappenddatagetdata") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.appendData(", Esquire");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataAppendDataGetDataAssert","Margaret Martin, Esquire",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataappenddatagetdata();
|
||||
}
|
||||
Generated
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatabegining";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method removes a range of
|
||||
characters from the node. Delete data at the beginning
|
||||
of the character data.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=0 and count=16.
|
||||
The method should delete the characters from position
|
||||
0 thru position 16. The new value of the character data
|
||||
should be "Dallas, Texas 98551".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedatabegining() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedatabegining") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(0,16);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("data","Dallas, Texas 98551",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedatabegining();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataend";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method removes a range of
|
||||
characters from the node. Delete data at the end
|
||||
of the character data.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=30 and count=5.
|
||||
The method should delete the characters from position
|
||||
30 thru position 35. The new value of the character data
|
||||
should be "1230 North Ave. Dallas, Texas".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedataend() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedataend") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(30,5);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataDeleteDataEndAssert","1230 North Ave. Dallas, Texas ",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedataend();
|
||||
}
|
||||
Generated
Vendored
+125
@@ -0,0 +1,125 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataexceedslength";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
If the sum of the offset and count used in the
|
||||
"deleteData(offset,count) method is greater than the
|
||||
length of the character data then all the characters
|
||||
from the offset to the end of the data are deleted.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=4 and count=50.
|
||||
The method should delete the characters from position 4
|
||||
to the end of the data since the offset+count(50+4)
|
||||
is greater than the length of the character data(35).
|
||||
The new value of the character data should be "1230".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedataexceedslength() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedataexceedslength") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(4,50);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataDeleteDataExceedsLengthAssert","1230",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedataexceedslength();
|
||||
}
|
||||
Generated
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatagetlengthanddata";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
On successful invocation of the "deleteData(offset,count)"
|
||||
method, the "getData()" and "getLength()" methods reflect
|
||||
the changes.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=30 and count=5.
|
||||
The method should delete the characters from position
|
||||
30 thru position 35. The new value of the character data
|
||||
should be "1230 North Ave. Dallas, Texas" which is
|
||||
returned by the "getData()" method and "getLength()"
|
||||
method should return 30".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedatagetlengthanddata() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedatagetlengthanddata") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
var childLength;
|
||||
var result = new Array();
|
||||
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(30,5);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("data","1230 North Ave. Dallas, Texas ",childData);
|
||||
childLength = child.length;
|
||||
|
||||
assertEquals("length",30,childLength);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedatagetlengthanddata();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatamiddle";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method removes a range of
|
||||
characters from the node. Delete data in the middle
|
||||
of the character data.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=16 and count=8.
|
||||
The method should delete the characters from position
|
||||
16 thru position 24. The new value of the character data
|
||||
should be "1230 North Ave. Texas 98551".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedatamiddle() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedatamiddle") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(16,8);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataDeleteDataMiddleAssert","1230 North Ave. Texas 98551",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedatamiddle();
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetdata";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
The "getData()" method retrieves the character data
|
||||
|
||||
currently stored in the node.
|
||||
|
||||
Retrieve the character data from the second child
|
||||
|
||||
of the first employee and invoke the "getData()"
|
||||
|
||||
method. The method returns the character data
|
||||
|
||||
string.
|
||||
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
*/
|
||||
function hc_characterdatagetdata() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatagetdata") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataGetDataAssert","Margaret Martin",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatagetdata();
|
||||
}
|
||||
Generated
Vendored
+119
@@ -0,0 +1,119 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetlength";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getLength()" method returns the number of characters
|
||||
stored in this nodes data.
|
||||
Retrieve the character data from the second
|
||||
child of the first employee and examine the
|
||||
value returned by the getLength() method.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C
|
||||
*/
|
||||
function hc_characterdatagetlength() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatagetlength") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childValue;
|
||||
var childLength;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
childValue = child.data;
|
||||
|
||||
childLength = childValue.length;
|
||||
assertEquals("characterdataGetLengthAssert",15,childLength);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatagetlength();
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified count
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its "deleteData(offset,count)"
|
||||
method with offset=10 and count=-3. It should raise the
|
||||
desired exception since the count is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
*/
|
||||
function hc_characterdataindexsizeerrdeletedatacountnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedatacountnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childSubstring;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
childSubstring = child.substringData(10,-3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
return; // CSA: latest DOM spec doesn't throw for negative count
|
||||
hc_characterdataindexsizeerrdeletedatacountnegative();
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetgreater";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is greater that the number of characters in the string.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its "deleteData(offset,count)"
|
||||
method with offset=40 and count=3. It should raise the
|
||||
desired exception since the offset is greater than the
|
||||
number of characters in the string.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
|
||||
*/
|
||||
function hc_characterdataindexsizeerrdeletedataoffsetgreater() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedataoffsetgreater") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.deleteData(40,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throw_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrdeletedataoffsetgreater();
|
||||
}
|
||||
Generated
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its "deleteData(offset,count)"
|
||||
method with offset=-5 and count=3. It should raise the
|
||||
desired exception since the offset is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdataindexsizeerrdeletedataoffsetnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedataoffsetnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.deleteData(-5,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrdeletedataoffsetnegative();
|
||||
}
|
||||
Generated
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetgreater";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "insertData(offset,arg)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is greater than the number of characters in the string.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its insertData"(offset,arg)"
|
||||
method with offset=40 and arg="ABC". It should raise
|
||||
the desired exception since the offset is greater than
|
||||
the number of characters in the string.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
|
||||
*/
|
||||
function hc_characterdataindexsizeerrinsertdataoffsetgreater() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrinsertdataoffsetgreater") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.deleteData(40,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throw_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrinsertdataoffsetgreater();
|
||||
}
|
||||
Generated
Vendored
+129
@@ -0,0 +1,129 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "insertData(offset,arg)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its insertData"(offset,arg)"
|
||||
method with offset=-5 and arg="ABC". It should raise
|
||||
the desired exception since the offset is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
*/
|
||||
function hc_characterdataindexsizeerrinsertdataoffsetnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrinsertdataoffsetnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.replaceData(-5,3,"ABC");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrinsertdataoffsetnegative();
|
||||
}
|
||||
Generated
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "replaceData(offset,count,arg)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified count
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its
|
||||
"replaceData(offset,count,arg) method with offset=10
|
||||
and count=-3 and arg="ABC". It should raise the
|
||||
desired exception since the count is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
*/
|
||||
function hc_characterdataindexsizeerrreplacedatacountnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedatacountnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var badString;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badString = child.substringData(10,-3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
return; // CSA: latest DOM spec doesn't throw for negative count
|
||||
hc_characterdataindexsizeerrreplacedatacountnegative();
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetgreater";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "replaceData(offset,count,arg)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is greater than the length of the string.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its
|
||||
"replaceData(offset,count,arg) method with offset=40
|
||||
and count=3 and arg="ABC". It should raise the
|
||||
desired exception since the offset is greater than the
|
||||
length of the string.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=242
|
||||
*/
|
||||
function hc_characterdataindexsizeerrreplacedataoffsetgreater() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedataoffsetgreater") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.deleteData(40,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throw_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrreplacedataoffsetgreater();
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "replaceData(offset,count,arg)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its
|
||||
"replaceData(offset,count,arg) method with offset=-5
|
||||
and count=3 and arg="ABC". It should raise the
|
||||
desired exception since the offset is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
|
||||
*/
|
||||
function hc_characterdataindexsizeerrreplacedataoffsetnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedataoffsetnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.replaceData(-5,3,"ABC");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrreplacedataoffsetnegative();
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringcountnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "substringData(offset,count)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified count
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its "substringData(offset,count)
|
||||
method with offset=10 and count=-3. It should raise the
|
||||
desired exception since the count is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
*/
|
||||
function hc_characterdataindexsizeerrsubstringcountnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrsubstringcountnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var badSubstring;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badSubstring = child.substringData(10,-3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
return; // CSA: latest DOM spec doesn't throw for negative count
|
||||
hc_characterdataindexsizeerrsubstringcountnegative();
|
||||
}
|
||||
Generated
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringnegativeoffset";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "substringData(offset,count)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its "substringData(offset,count)
|
||||
method with offset=-5 and count=3. It should raise the
|
||||
desired exception since the offset is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
*/
|
||||
function hc_characterdataindexsizeerrsubstringnegativeoffset() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrsubstringnegativeoffset") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var badString;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badString = child.substringData(-5,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrsubstringnegativeoffset();
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "substringData(offset,count)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is greater than the number of characters in the string.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its "substringData(offset,count)
|
||||
method with offset=40 and count=3. It should raise the
|
||||
desired exception since the offsets value is greater
|
||||
than the length.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
|
||||
*/
|
||||
function hc_characterdataindexsizeerrsubstringoffsetgreater() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrsubstringoffsetgreater") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var badString;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badString = child.substringData(40,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throw_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrsubstringoffsetgreater();
|
||||
}
|
||||
Generated
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatabeginning";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "insertData(offset,arg)" method will insert a string
|
||||
at the specified character offset. Insert the data at
|
||||
the beginning of the character data.
|
||||
|
||||
Retrieve the character data from the second child of
|
||||
the first employee. The "insertData(offset,arg)"
|
||||
method is then called with offset=0 and arg="Mss.".
|
||||
The method should insert the string "Mss." at position 0.
|
||||
The new value of the character data should be
|
||||
"Mss. Margaret Martin".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
|
||||
*/
|
||||
function hc_characterdatainsertdatabeginning() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatainsertdatabeginning") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.insertData(0,"Mss. ");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataInsertDataBeginningAssert","Mss. Margaret Martin",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatainsertdatabeginning();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdataend";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "insertData(offset,arg)" method will insert a string
|
||||
at the specified character offset. Insert the data at
|
||||
the end of the character data.
|
||||
|
||||
Retrieve the character data from the second child of
|
||||
the first employee. The "insertData(offset,arg)"
|
||||
method is then called with offset=15 and arg=", Esquire".
|
||||
The method should insert the string ", Esquire" at
|
||||
position 15. The new value of the character data should
|
||||
be "Margaret Martin, Esquire".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
|
||||
*/
|
||||
function hc_characterdatainsertdataend() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatainsertdataend") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.insertData(15,", Esquire");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataInsertDataEndAssert","Margaret Martin, Esquire",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatainsertdataend();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatamiddle";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "insertData(offset,arg)" method will insert a string
|
||||
at the specified character offset. Insert the data in
|
||||
the middle of the character data.
|
||||
|
||||
Retrieve the character data from the second child of
|
||||
the first employee. The "insertData(offset,arg)"
|
||||
method is then called with offset=9 and arg="Ann".
|
||||
The method should insert the string "Ann" at position 9.
|
||||
The new value of the character data should be
|
||||
"Margaret Ann Martin".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F
|
||||
*/
|
||||
function hc_characterdatainsertdatamiddle() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatainsertdatamiddle") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.insertData(9,"Ann ");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataInsertDataMiddleAssert","Margaret Ann Martin",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatainsertdatamiddle();
|
||||
}
|
||||
Generated
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatabegining";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "replaceData(offset,count,arg)" method replaces the
|
||||
characters starting at the specified offset with the
|
||||
specified string. Test for replacement in the
|
||||
middle of the data.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "replaceData(offset,count,arg)"
|
||||
method is then called with offset=5 and count=5 and
|
||||
arg="South". The method should replace characters five
|
||||
thru 9 of the character data with "South".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
|
||||
*/
|
||||
function hc_characterdatareplacedatabegining() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatareplacedatabegining") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.replaceData(0,4,"2500");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataReplaceDataBeginingAssert","2500 North Ave. Dallas, Texas 98551",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatareplacedatabegining();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataend";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "replaceData(offset,count,arg)" method replaces the
|
||||
characters starting at the specified offset with the
|
||||
specified string. Test for replacement at the
|
||||
end of the data.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "replaceData(offset,count,arg)"
|
||||
method is then called with offset=30 and count=5 and
|
||||
arg="98665". The method should replace characters 30
|
||||
thru 34 of the character data with "98665".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
|
||||
*/
|
||||
function hc_characterdatareplacedataend() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatareplacedataend") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.replaceData(30,5,"98665");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataReplaceDataEndAssert","1230 North Ave. Dallas, Texas 98665",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatareplacedataend();
|
||||
}
|
||||
Generated
Vendored
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofarg";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "replaceData(offset,count,arg)" method replaces the
|
||||
characters starting at the specified offset with the
|
||||
specified string. Test the situation where the length
|
||||
of the arg string is greater than the specified offset.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "replaceData(offset,count,arg)"
|
||||
method is then called with offset=0 and count=4 and
|
||||
arg="260030". The method should replace characters one
|
||||
thru four with "260030". Note that the length of the
|
||||
specified string is greater that the specified offset.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
|
||||
*/
|
||||
function hc_characterdatareplacedataexceedslengthofarg() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatareplacedataexceedslengthofarg") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.replaceData(0,4,"260030");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataReplaceDataExceedsLengthOfArgAssert","260030 North Ave. Dallas, Texas 98551",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatareplacedataexceedslengthofarg();
|
||||
}
|
||||
Generated
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofdata";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
If the sum of the offset and count exceeds the length then
|
||||
all the characters to the end of the data are replaced.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "replaceData(offset,count,arg)"
|
||||
method is then called with offset=0 and count=50 and
|
||||
arg="2600". The method should replace all the characters
|
||||
with "2600". This is because the sum of the offset and
|
||||
count exceeds the length of the character data.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
|
||||
*/
|
||||
function hc_characterdatareplacedataexceedslengthofdata() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatareplacedataexceedslengthofdata") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.replaceData(0,50,"2600");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataReplaceDataExceedsLengthOfDataAssert","2600",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatareplacedataexceedslengthofdata();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatamiddle";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "replaceData(offset,count,arg)" method replaces the
|
||||
characters starting at the specified offset with the
|
||||
specified string. Test for replacement in the
|
||||
middle of the data.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "replaceData(offset,count,arg)"
|
||||
method is then called with offset=5 and count=5 and
|
||||
arg="South". The method should replace characters five
|
||||
thru 9 of the character data with "South".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
|
||||
*/
|
||||
function hc_characterdatareplacedatamiddle() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatareplacedatamiddle") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.replaceData(5,5,"South");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataReplaceDataMiddleAssert","1230 South Ave. Dallas, Texas 98551",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatareplacedatamiddle();
|
||||
}
|
||||
Generated
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasetnodevalue";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "setNodeValue()" method changes the character data
|
||||
currently stored in the node.
|
||||
Retrieve the character data from the second child
|
||||
of the first employee and invoke the "setNodeValue()"
|
||||
method, call "getData()" and compare.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
*/
|
||||
function hc_characterdatasetnodevalue() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatasetnodevalue") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
var childValue;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.nodeValue = "Marilyn Martin";
|
||||
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("data","Marilyn Martin",childData);
|
||||
childValue = child.nodeValue;
|
||||
|
||||
assertEquals("value","Marilyn Martin",childValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatasetnodevalue();
|
||||
}
|
||||
Generated
Vendored
+120
@@ -0,0 +1,120 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringexceedsvalue";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
If the sum of the "offset" and "count" exceeds the
|
||||
"length" then the "substringData(offset,count)" method
|
||||
returns all the characters to the end of the data.
|
||||
|
||||
Retrieve the character data from the second child
|
||||
of the first employee and access part of the data
|
||||
by using the substringData(offset,count) method
|
||||
with offset=9 and count=10. The method should return
|
||||
the substring "Martin" since offset+count > length
|
||||
(19 > 15).
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
|
||||
*/
|
||||
function hc_characterdatasubstringexceedsvalue() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatasubstringexceedsvalue") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var substring;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
substring = child.substringData(9,10);
|
||||
assertEquals("characterdataSubStringExceedsValueAssert","Martin",substring);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatasubstringexceedsvalue();
|
||||
}
|
||||
Generated
Vendored
+119
@@ -0,0 +1,119 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringvalue";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "substringData(offset,count)" method returns the
|
||||
specified string.
|
||||
|
||||
Retrieve the character data from the second child
|
||||
of the first employee and access part of the data
|
||||
by using the substringData(offset,count) method. The
|
||||
method should return the specified substring starting
|
||||
at position "offset" and extract "count" characters.
|
||||
The method should return the string "Margaret".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
|
||||
*/
|
||||
function hc_characterdatasubstringvalue() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatasubstringvalue") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var substring;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
substring = child.substringData(0,8);
|
||||
assertEquals("characterdataSubStringValueAssert","Margaret",substring);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatasubstringvalue();
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_commentgetcomment";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
A comment is all the characters between the starting
|
||||
'<!--' and ending '-->'
|
||||
Retrieve the nodes of the DOM document. Search for a
|
||||
comment node and the content is its value.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=509
|
||||
*/
|
||||
function hc_commentgetcomment() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_commentgetcomment") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var child;
|
||||
var childName;
|
||||
var childValue;
|
||||
var commentCount = 0;
|
||||
var childType;
|
||||
var attributes;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.childNodes;
|
||||
|
||||
for(var indexN1005E = 0;indexN1005E < elementList.length; indexN1005E++) {
|
||||
child = elementList.item(indexN1005E);
|
||||
childType = child.nodeType;
|
||||
|
||||
|
||||
if(
|
||||
(8 == childType)
|
||||
) {
|
||||
childName = child.nodeName;
|
||||
|
||||
assertEquals("nodeName","#comment",childName);
|
||||
childValue = child.nodeValue;
|
||||
|
||||
assertEquals("nodeValue"," This is comment number 1.",childValue);
|
||||
attributes = child.attributes;
|
||||
|
||||
assertNull("attributes",attributes);
|
||||
commentCount += 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
assertTrue("atMostOneComment",
|
||||
|
||||
(commentCount < 2)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_commentgetcomment();
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatecomment";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "createComment(data)" method creates a new Comment
|
||||
node given the specified string.
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"createComment(data)" method. It should create a new
|
||||
Comment node whose "data" is the specified string.
|
||||
The content, name and type are retrieved and output.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328
|
||||
*/
|
||||
function hc_documentcreatecomment() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentcreatecomment") != null) return;
|
||||
var doc;
|
||||
var newCommentNode;
|
||||
var newCommentValue;
|
||||
var newCommentName;
|
||||
var newCommentType;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
newCommentNode = doc.createComment("This is a new Comment node");
|
||||
newCommentValue = newCommentNode.nodeValue;
|
||||
|
||||
assertEquals("value","This is a new Comment node",newCommentValue);
|
||||
newCommentName = newCommentNode.nodeName;
|
||||
|
||||
assertEquals("strong","#comment",newCommentName);
|
||||
newCommentType = newCommentNode.nodeType;
|
||||
|
||||
assertEquals("type",8,newCommentType);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentcreatecomment();
|
||||
}
|
||||
Generated
Vendored
+126
@@ -0,0 +1,126 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatedocumentfragment";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "createDocumentFragment()" method creates an empty
|
||||
DocumentFragment object.
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"createDocumentFragment()" method. The content, name,
|
||||
type and value of the newly created object are output.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5
|
||||
*/
|
||||
function hc_documentcreatedocumentfragment() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentcreatedocumentfragment") != null) return;
|
||||
var doc;
|
||||
var newDocFragment;
|
||||
var children;
|
||||
var length;
|
||||
var newDocFragmentName;
|
||||
var newDocFragmentType;
|
||||
var newDocFragmentValue;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
newDocFragment = doc.createDocumentFragment();
|
||||
children = newDocFragment.childNodes;
|
||||
|
||||
length = children.length;
|
||||
|
||||
assertEquals("length",0,length);
|
||||
newDocFragmentName = newDocFragment.nodeName;
|
||||
|
||||
assertEquals("strong","#document-fragment",newDocFragmentName);
|
||||
newDocFragmentType = newDocFragment.nodeType;
|
||||
|
||||
assertEquals("type",11,newDocFragmentType);
|
||||
newDocFragmentValue = newDocFragment.nodeValue;
|
||||
|
||||
assertNull("value",newDocFragmentValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentcreatedocumentfragment();
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelement";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "createElement(tagName)" method creates an Element
|
||||
of the type specified.
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"createElement(tagName)" method with tagName="acronym".
|
||||
The method should create an instance of an Element node
|
||||
whose tagName is "acronym". The NodeName, NodeType
|
||||
and NodeValue are returned.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
|
||||
*/
|
||||
function hc_documentcreateelement() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentcreateelement") != null) return;
|
||||
var doc;
|
||||
var newElement;
|
||||
var newElementName;
|
||||
var newElementType;
|
||||
var newElementValue;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
newElement = doc.createElement("acronym");
|
||||
newElementName = newElement.nodeName;
|
||||
|
||||
assertEqualsAutoCase("element", "strong","acronym",newElementName);
|
||||
newElementType = newElement.nodeType;
|
||||
|
||||
assertEquals("type",1,newElementType);
|
||||
newElementValue = newElement.nodeValue;
|
||||
|
||||
assertNull("valueInitiallyNull",newElementValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentcreateelement();
|
||||
}
|
||||
Generated
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelementcasesensitive";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The tagName parameter in the "createElement(tagName)"
|
||||
method is case-sensitive for XML documents.
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"createElement(tagName)" method twice. Once for tagName
|
||||
equal to "acronym" and once for tagName equal to "ACRONYM"
|
||||
Each call should create a distinct Element node. The
|
||||
newly created Elements are then assigned attributes
|
||||
that are retrieved.
|
||||
|
||||
Modified on 27 June 2003 to avoid setting an invalid style
|
||||
values and checked the node names to see if they matched expectations.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
|
||||
*/
|
||||
function hc_documentcreateelementcasesensitive() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentcreateelementcasesensitive") != null) return;
|
||||
var doc;
|
||||
var newElement1;
|
||||
var newElement2;
|
||||
var attribute1;
|
||||
var attribute2;
|
||||
var nodeName1;
|
||||
var nodeName2;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
newElement1 = doc.createElement("ACRONYM");
|
||||
newElement2 = doc.createElement("acronym");
|
||||
newElement1.setAttribute("lang","EN");
|
||||
newElement2.setAttribute("title","Dallas");
|
||||
attribute1 = newElement1.getAttribute("lang");
|
||||
attribute2 = newElement2.getAttribute("title");
|
||||
assertEquals("attrib1","EN",attribute1);
|
||||
assertEquals("attrib2","Dallas",attribute2);
|
||||
nodeName1 = newElement1.nodeName;
|
||||
|
||||
nodeName2 = newElement2.nodeName;
|
||||
|
||||
assertEqualsAutoCase("element", "nodeName1","ACRONYM",nodeName1);
|
||||
assertEqualsAutoCase("element", "nodeName2","acronym",nodeName2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentcreateelementcasesensitive();
|
||||
}
|
||||
Generated
Vendored
+120
@@ -0,0 +1,120 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatetextnode";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "createTextNode(data)" method creates a Text node
|
||||
given the specfied string.
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"createTextNode(data)" method. It should create a
|
||||
new Text node whose "data" is the specified string.
|
||||
The NodeName and NodeType are also checked.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127
|
||||
*/
|
||||
function hc_documentcreatetextnode() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentcreatetextnode") != null) return;
|
||||
var doc;
|
||||
var newTextNode;
|
||||
var newTextName;
|
||||
var newTextValue;
|
||||
var newTextType;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
newTextNode = doc.createTextNode("This is a new Text node");
|
||||
newTextValue = newTextNode.nodeValue;
|
||||
|
||||
assertEquals("value","This is a new Text node",newTextValue);
|
||||
newTextName = newTextNode.nodeName;
|
||||
|
||||
assertEquals("strong","#text",newTextName);
|
||||
newTextType = newTextNode.nodeType;
|
||||
|
||||
assertEquals("type",3,newTextType);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentcreatetextnode();
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetdoctype";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Access Document.doctype for hc_staff, if not text/html should return DocumentType node.
|
||||
HTML implementations may return null.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31
|
||||
*/
|
||||
function hc_documentgetdoctype() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentgetdoctype") != null) return;
|
||||
var doc;
|
||||
var docType;
|
||||
var docTypeName;
|
||||
var nodeValue;
|
||||
var attributes;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
docType = doc.doctype;
|
||||
|
||||
|
||||
if(
|
||||
|
||||
!(
|
||||
(builder.contentType == "text/html")
|
||||
)
|
||||
|
||||
) {
|
||||
assertNotNull("docTypeNotNull",docType);
|
||||
|
||||
}
|
||||
|
||||
if(
|
||||
|
||||
(docType != null)
|
||||
|
||||
) {
|
||||
docTypeName = docType.name;
|
||||
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "image/svg+xml")
|
||||
|
||||
) {
|
||||
assertEquals("nodeNameSVG","svg",docTypeName);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEquals("nodeName","html",docTypeName);
|
||||
|
||||
}
|
||||
nodeValue = docType.nodeValue;
|
||||
|
||||
assertNull("nodeValue",nodeValue);
|
||||
attributes = docType.attributes;
|
||||
|
||||
assertNull("attributes",attributes);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentgetdoctype();
|
||||
}
|
||||
Generated
Vendored
+110
@@ -0,0 +1,110 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamelength";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getElementsByTagName(tagName)" method returns a
|
||||
NodeList of all the Elements with a given tagName.
|
||||
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"getElementsByTagName(tagName)" method with tagName
|
||||
equal to "strong". The method should return a NodeList
|
||||
that contains 5 elements.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094
|
||||
*/
|
||||
function hc_documentgetelementsbytagnamelength() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentgetelementsbytagnamelength") != null) return;
|
||||
var doc;
|
||||
var nameList;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
nameList = doc.getElementsByTagName("strong");
|
||||
assertSize("documentGetElementsByTagNameLengthAssert",5,nameList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentgetelementsbytagnamelength();
|
||||
}
|
||||
Generated
Vendored
+221
@@ -0,0 +1,221 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnametotallength";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"getElementsByTagName(tagName)" method with tagName
|
||||
equal to "*". The method should return a NodeList
|
||||
that contains all the elements of the document.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
|
||||
*/
|
||||
function hc_documentgetelementsbytagnametotallength() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentgetelementsbytagnametotallength") != null) return;
|
||||
var doc;
|
||||
var nameList;
|
||||
expectedNames = new Array();
|
||||
expectedNames[0] = "html";
|
||||
expectedNames[1] = "head";
|
||||
expectedNames[2] = "meta";
|
||||
expectedNames[3] = "title";
|
||||
expectedNames[4] = "script";
|
||||
expectedNames[5] = "script";
|
||||
expectedNames[6] = "script";
|
||||
expectedNames[7] = "body";
|
||||
expectedNames[8] = "p";
|
||||
expectedNames[9] = "em";
|
||||
expectedNames[10] = "strong";
|
||||
expectedNames[11] = "code";
|
||||
expectedNames[12] = "sup";
|
||||
expectedNames[13] = "var";
|
||||
expectedNames[14] = "acronym";
|
||||
expectedNames[15] = "p";
|
||||
expectedNames[16] = "em";
|
||||
expectedNames[17] = "strong";
|
||||
expectedNames[18] = "code";
|
||||
expectedNames[19] = "sup";
|
||||
expectedNames[20] = "var";
|
||||
expectedNames[21] = "acronym";
|
||||
expectedNames[22] = "p";
|
||||
expectedNames[23] = "em";
|
||||
expectedNames[24] = "strong";
|
||||
expectedNames[25] = "code";
|
||||
expectedNames[26] = "sup";
|
||||
expectedNames[27] = "var";
|
||||
expectedNames[28] = "acronym";
|
||||
expectedNames[29] = "p";
|
||||
expectedNames[30] = "em";
|
||||
expectedNames[31] = "strong";
|
||||
expectedNames[32] = "code";
|
||||
expectedNames[33] = "sup";
|
||||
expectedNames[34] = "var";
|
||||
expectedNames[35] = "acronym";
|
||||
expectedNames[36] = "p";
|
||||
expectedNames[37] = "em";
|
||||
expectedNames[38] = "strong";
|
||||
expectedNames[39] = "code";
|
||||
expectedNames[40] = "sup";
|
||||
expectedNames[41] = "var";
|
||||
expectedNames[42] = "acronym";
|
||||
|
||||
svgExpectedNames = new Array();
|
||||
svgExpectedNames[0] = "svg";
|
||||
svgExpectedNames[1] = "rect";
|
||||
svgExpectedNames[2] = "script";
|
||||
svgExpectedNames[3] = "head";
|
||||
svgExpectedNames[4] = "meta";
|
||||
svgExpectedNames[5] = "title";
|
||||
svgExpectedNames[6] = "body";
|
||||
svgExpectedNames[7] = "p";
|
||||
svgExpectedNames[8] = "em";
|
||||
svgExpectedNames[9] = "strong";
|
||||
svgExpectedNames[10] = "code";
|
||||
svgExpectedNames[11] = "sup";
|
||||
svgExpectedNames[12] = "var";
|
||||
svgExpectedNames[13] = "acronym";
|
||||
svgExpectedNames[14] = "p";
|
||||
svgExpectedNames[15] = "em";
|
||||
svgExpectedNames[16] = "strong";
|
||||
svgExpectedNames[17] = "code";
|
||||
svgExpectedNames[18] = "sup";
|
||||
svgExpectedNames[19] = "var";
|
||||
svgExpectedNames[20] = "acronym";
|
||||
svgExpectedNames[21] = "p";
|
||||
svgExpectedNames[22] = "em";
|
||||
svgExpectedNames[23] = "strong";
|
||||
svgExpectedNames[24] = "code";
|
||||
svgExpectedNames[25] = "sup";
|
||||
svgExpectedNames[26] = "var";
|
||||
svgExpectedNames[27] = "acronym";
|
||||
svgExpectedNames[28] = "p";
|
||||
svgExpectedNames[29] = "em";
|
||||
svgExpectedNames[30] = "strong";
|
||||
svgExpectedNames[31] = "code";
|
||||
svgExpectedNames[32] = "sup";
|
||||
svgExpectedNames[33] = "var";
|
||||
svgExpectedNames[34] = "acronym";
|
||||
svgExpectedNames[35] = "p";
|
||||
svgExpectedNames[36] = "em";
|
||||
svgExpectedNames[37] = "strong";
|
||||
svgExpectedNames[38] = "code";
|
||||
svgExpectedNames[39] = "sup";
|
||||
svgExpectedNames[40] = "var";
|
||||
svgExpectedNames[41] = "acronym";
|
||||
|
||||
var actualNames = new Array();
|
||||
|
||||
var thisElement;
|
||||
var thisTag;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
nameList = doc.getElementsByTagName("*");
|
||||
for(var indexN10148 = 0;indexN10148 < nameList.length; indexN10148++) {
|
||||
thisElement = nameList.item(indexN10148);
|
||||
thisTag = thisElement.tagName;
|
||||
|
||||
actualNames[actualNames.length] = thisTag;
|
||||
|
||||
}
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "image/svg+xml")
|
||||
|
||||
) {
|
||||
assertEqualsListAutoCase("element", "svgTagNames",svgExpectedNames,actualNames);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEqualsListAutoCase("element", "tagNames",expectedNames,actualNames);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentgetelementsbytagnametotallength();
|
||||
}
|
||||
Generated
Vendored
+120
@@ -0,0 +1,120 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamevalue";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getElementsByTagName(tagName)" method returns a
|
||||
NodeList of all the Elements with a given tagName
|
||||
in a pre-order traversal of the tree.
|
||||
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"getElementsByTagName(tagName)" method with tagName
|
||||
equal to "strong". The method should return a NodeList
|
||||
that contains 5 elements. The FOURTH item in the
|
||||
list is retrieved and output.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094
|
||||
*/
|
||||
function hc_documentgetelementsbytagnamevalue() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentgetelementsbytagnamevalue") != null) return;
|
||||
var doc;
|
||||
var nameList;
|
||||
var nameNode;
|
||||
var firstChild;
|
||||
var childValue;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
nameList = doc.getElementsByTagName("strong");
|
||||
nameNode = nameList.item(3);
|
||||
firstChild = nameNode.firstChild;
|
||||
|
||||
childValue = firstChild.nodeValue;
|
||||
|
||||
assertEquals("documentGetElementsByTagNameValueAssert","Jeny Oconnor",childValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentgetelementsbytagnamevalue();
|
||||
}
|
||||
Generated
Vendored
+126
@@ -0,0 +1,126 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetimplementation";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"getImplementation()" method. If contentType="text/html",
|
||||
DOMImplementation.hasFeature("HTML","1.0") should be true.
|
||||
Otherwise, DOMImplementation.hasFeature("XML", "1.0")
|
||||
should be true.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245
|
||||
*/
|
||||
function hc_documentgetimplementation() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentgetimplementation") != null) return;
|
||||
var doc;
|
||||
var docImpl;
|
||||
var xmlstate;
|
||||
var htmlstate;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
docImpl = doc.implementation;
|
||||
xmlstate = docImpl.hasFeature("XML","1.0");
|
||||
htmlstate = docImpl.hasFeature("HTML","1.0");
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html")
|
||||
|
||||
) {
|
||||
assertTrue("supports_HTML_1.0",htmlstate);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertTrue("supports_XML_1.0",xmlstate);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentgetimplementation();
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetrootnode";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Load a document and invoke its
|
||||
"getDocumentElement()" method.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
|
||||
*/
|
||||
function hc_documentgetrootnode() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentgetrootnode") != null) return;
|
||||
var doc;
|
||||
var root;
|
||||
var rootName;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
root = doc.documentElement;
|
||||
|
||||
rootName = root.nodeName;
|
||||
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "image/svg+xml")
|
||||
|
||||
) {
|
||||
assertEquals("svgTagName","svg",rootName);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEqualsAutoCase("element", "docElemName","html",rootName);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentgetrootnode();
|
||||
}
|
||||
Generated
Vendored
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "createElement(tagName)" method raises an
|
||||
INVALID_CHARACTER_ERR DOMException if the specified
|
||||
tagName contains an invalid character.
|
||||
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"createElement(tagName)" method with the tagName equal
|
||||
to the string "invalid^Name". Due to the invalid
|
||||
character the desired EXCEPTION should be raised.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
|
||||
*/
|
||||
function hc_documentinvalidcharacterexceptioncreateelement() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateelement") != null) return;
|
||||
var doc;
|
||||
var badElement;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badElement = doc.createElement("invalid^Name");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 5);
|
||||
}
|
||||
assertTrue("throw_INVALID_CHARACTER_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentinvalidcharacterexceptioncreateelement();
|
||||
}
|
||||
Generated
Vendored
+117
@@ -0,0 +1,117 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement1";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Creating an element with an empty name should cause an INVALID_CHARACTER_ERR.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
|
||||
*/
|
||||
function hc_documentinvalidcharacterexceptioncreateelement1() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateelement1") != null) return;
|
||||
var doc;
|
||||
var badElement;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badElement = doc.createElement("");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 5);
|
||||
}
|
||||
assertTrue("throw_INVALID_CHARACTER_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_documentinvalidcharacterexceptioncreateelement1();
|
||||
}
|
||||
Generated
Vendored
+126
@@ -0,0 +1,126 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenoversion";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Load a document and invoke its
|
||||
"getImplementation()" method. This should create a
|
||||
DOMImplementation object whose "hasFeature(feature,
|
||||
version)" method is invoked with version equal to "".
|
||||
If the version is not specified, supporting any version
|
||||
feature will cause the method to return "true".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
|
||||
* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245
|
||||
*/
|
||||
function hc_domimplementationfeaturenoversion() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_domimplementationfeaturenoversion") != null) return;
|
||||
var doc;
|
||||
var domImpl;
|
||||
var state;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
domImpl = doc.implementation;
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html")
|
||||
|
||||
) {
|
||||
state = domImpl.hasFeature("HTML","");
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
state = domImpl.hasFeature("XML","");
|
||||
|
||||
}
|
||||
assertTrue("hasFeatureBlank",state);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_domimplementationfeaturenoversion();
|
||||
}
|
||||
Generated
Vendored
+129
@@ -0,0 +1,129 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenull";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("hasNullString", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Load a document and invoke its
|
||||
"getImplementation()" method. This should create a
|
||||
DOMImplementation object whose "hasFeature(feature,
|
||||
version)" method is invoked with version equal to null.
|
||||
If the version is not specified, supporting any version
|
||||
feature will cause the method to return "true".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
|
||||
* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245
|
||||
*/
|
||||
function hc_domimplementationfeaturenull() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_domimplementationfeaturenull") != null) return;
|
||||
var doc;
|
||||
var domImpl;
|
||||
var state;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
domImpl = doc.implementation;
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html")
|
||||
|
||||
) {
|
||||
state = domImpl.hasFeature("HTML",null);
|
||||
assertTrue("supports_HTML_null",state);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
state = domImpl.hasFeature("XML",null);
|
||||
assertTrue("supports_XML_null",state);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_domimplementationfeaturenull();
|
||||
}
|
||||
Generated
Vendored
+125
@@ -0,0 +1,125 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturexml";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Retrieve the entire DOM document and invoke its
|
||||
"getImplementation()" method. This should create a
|
||||
DOMImplementation object whose "hasFeature(feature,
|
||||
version)" method is invoked with "feature" equal to "html" or "xml".
|
||||
The method should return a boolean "true".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245
|
||||
*/
|
||||
function hc_domimplementationfeaturexml() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_domimplementationfeaturexml") != null) return;
|
||||
var doc;
|
||||
var domImpl;
|
||||
var state;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
domImpl = doc.implementation;
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html")
|
||||
|
||||
) {
|
||||
state = domImpl.hasFeature("html","1.0");
|
||||
assertTrue("supports_html_1.0",state);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
state = domImpl.hasFeature("xml","1.0");
|
||||
assertTrue("supports_xml_1.0",state);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_domimplementationfeaturexml();
|
||||
}
|
||||
Generated
Vendored
+117
@@ -0,0 +1,117 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementaddnewattribute";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "setAttribute(name,value)" method adds a new attribute
|
||||
to the Element
|
||||
|
||||
Retrieve the last child of the last employee, then
|
||||
add an attribute to it by invoking the
|
||||
"setAttribute(name,value)" method. It should create
|
||||
a "strong" attribute with an assigned value equal to
|
||||
"value".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243
|
||||
*/
|
||||
function hc_elementaddnewattribute() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementaddnewattribute") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testEmployee;
|
||||
var attrValue;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
testEmployee = elementList.item(4);
|
||||
testEmployee.setAttribute("lang","EN-us");
|
||||
attrValue = testEmployee.getAttribute("lang");
|
||||
assertEquals("attrValue","EN-us",attrValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementaddnewattribute();
|
||||
}
|
||||
Generated
Vendored
+119
@@ -0,0 +1,119 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementchangeattributevalue";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "setAttribute(name,value)" method adds a new attribute
|
||||
to the Element. If the "strong" is already present, then
|
||||
its value should be changed to the new one that is in
|
||||
the "value" parameter.
|
||||
|
||||
Retrieve the last child of the fourth employee, then add
|
||||
an attribute to it by invoking the
|
||||
"setAttribute(name,value)" method. Since the name of the
|
||||
used attribute("class") is already present in this
|
||||
element, then its value should be changed to the new one
|
||||
of the "value" parameter.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
|
||||
*/
|
||||
function hc_elementchangeattributevalue() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementchangeattributevalue") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testEmployee;
|
||||
var attrValue;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
testEmployee = elementList.item(3);
|
||||
testEmployee.setAttribute("class","Neither");
|
||||
attrValue = testEmployee.getAttribute("class");
|
||||
assertEquals("elementChangeAttributeValueAssert","Neither",attrValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementchangeattributevalue();
|
||||
}
|
||||
Generated
Vendored
+112
@@ -0,0 +1,112 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagname";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getElementsByTagName(name)" method returns a list
|
||||
of all descendant Elements with the given tag name.
|
||||
Test for an empty list.
|
||||
|
||||
Create a NodeList of all the descendant elements
|
||||
using the string "noMatch" as the tagName.
|
||||
The method should return a NodeList whose length is
|
||||
"0" since there are not any descendant elements
|
||||
that match the given tag name.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
|
||||
*/
|
||||
function hc_elementgetelementsbytagname() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementgetelementsbytagname") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
assertSize("elementGetElementsByTagNameAssert",5,elementList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementgetelementsbytagname();
|
||||
}
|
||||
node_modules/@mixmark-io/domino/test/w3c/level1/core/hc_elementgetelementsbytagnameaccessnodelist.js
Generated
Vendored
+144
@@ -0,0 +1,144 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnameaccessnodelist";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getElementsByTagName(name)" method returns a list
|
||||
of all descendant Elements in the order the children
|
||||
were encountered in a pre order traversal of the element
|
||||
tree.
|
||||
|
||||
Create a NodeList of all the descendant elements
|
||||
using the string "p" as the tagName.
|
||||
The method should return a NodeList whose length is
|
||||
"5" in the order the children were encountered.
|
||||
Access the FOURTH element in the NodeList. The FOURTH
|
||||
element, the first or second should be an "em" node with
|
||||
the content "EMP0004".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
|
||||
*/
|
||||
function hc_elementgetelementsbytagnameaccessnodelist() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementgetelementsbytagnameaccessnodelist") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testEmployee;
|
||||
var firstC;
|
||||
var childName;
|
||||
var nodeType;
|
||||
var employeeIDNode;
|
||||
var employeeID;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
testEmployee = elementList.item(3);
|
||||
firstC = testEmployee.firstChild;
|
||||
|
||||
nodeType = firstC.nodeType;
|
||||
|
||||
|
||||
while(
|
||||
(3 == nodeType)
|
||||
) {
|
||||
firstC = firstC.nextSibling;
|
||||
|
||||
nodeType = firstC.nodeType;
|
||||
|
||||
|
||||
}
|
||||
childName = firstC.nodeName;
|
||||
|
||||
assertEqualsAutoCase("element", "childName","em",childName);
|
||||
employeeIDNode = firstC.firstChild;
|
||||
|
||||
employeeID = employeeIDNode.nodeValue;
|
||||
|
||||
assertEquals("employeeID","EMP0004",employeeID);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementgetelementsbytagnameaccessnodelist();
|
||||
}
|
||||
Generated
Vendored
+110
@@ -0,0 +1,110 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamenomatch";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getElementsByTagName(name)" method returns a list
|
||||
of all descendant Elements with the given tag name.
|
||||
|
||||
Create a NodeList of all the descendant elements
|
||||
using the string "employee" as the tagName.
|
||||
The method should return a NodeList whose length is
|
||||
"5".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
|
||||
*/
|
||||
function hc_elementgetelementsbytagnamenomatch() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementgetelementsbytagnamenomatch") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("noMatch");
|
||||
assertSize("elementGetElementsByTagNameNoMatchNoMatchAssert",0,elementList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementgetelementsbytagnamenomatch();
|
||||
}
|
||||
Generated
Vendored
+134
@@ -0,0 +1,134 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamespecialvalue";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getElementsByTagName(name)" method may use the
|
||||
special value "*" to match all tags in the element
|
||||
tree.
|
||||
|
||||
Create a NodeList of all the descendant elements
|
||||
of the last employee by using the special value "*".
|
||||
The method should return all the descendant children(6)
|
||||
in the order the children were encountered.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D
|
||||
*/
|
||||
function hc_elementgetelementsbytagnamespecialvalue() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementgetelementsbytagnamespecialvalue") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var lastEmployee;
|
||||
var lastempList;
|
||||
var child;
|
||||
var childName;
|
||||
var result = new Array();
|
||||
|
||||
expectedResult = new Array();
|
||||
expectedResult[0] = "em";
|
||||
expectedResult[1] = "strong";
|
||||
expectedResult[2] = "code";
|
||||
expectedResult[3] = "sup";
|
||||
expectedResult[4] = "var";
|
||||
expectedResult[5] = "acronym";
|
||||
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
lastEmployee = elementList.item(4);
|
||||
lastempList = lastEmployee.getElementsByTagName("*");
|
||||
for(var indexN10067 = 0;indexN10067 < lastempList.length; indexN10067++) {
|
||||
child = lastempList.item(indexN10067);
|
||||
childName = child.nodeName;
|
||||
|
||||
result[result.length] = childName;
|
||||
|
||||
}
|
||||
assertEqualsListAutoCase("element", "tagNames",expectedResult,result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementgetelementsbytagnamespecialvalue();
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgettagname";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Invoke the "getTagName()" method one the
|
||||
root node. The value returned should be "html" or "svg".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251
|
||||
*/
|
||||
function hc_elementgettagname() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementgettagname") != null) return;
|
||||
var doc;
|
||||
var root;
|
||||
var tagname;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
root = doc.documentElement;
|
||||
|
||||
tagname = root.tagName;
|
||||
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "image/svg+xml")
|
||||
|
||||
) {
|
||||
assertEquals("svgTagname","svg",tagname);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEqualsAutoCase("element", "tagname","html",tagname);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementgettagname();
|
||||
}
|
||||
Generated
Vendored
+125
@@ -0,0 +1,125 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "setAttribute(name,value)" method raises an
|
||||
"INVALID_CHARACTER_ERR DOMException if the specified
|
||||
name contains an invalid character.
|
||||
|
||||
Retrieve the last child of the first employee and
|
||||
call its "setAttribute(name,value)" method with
|
||||
"strong" containing an invalid character.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
|
||||
*/
|
||||
function hc_elementinvalidcharacterexception() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementinvalidcharacterexception") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testAddress;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
testAddress = elementList.item(0);
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
testAddress.setAttribute("invalid^Name","value");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 5);
|
||||
}
|
||||
assertTrue("throw_INVALID_CHARACTER_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementinvalidcharacterexception();
|
||||
}
|
||||
Generated
Vendored
+119
@@ -0,0 +1,119 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception1";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Calling Element.setAttribute with an empty name will cause an INVALID_CHARACTER_ERR.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
|
||||
*/
|
||||
function hc_elementinvalidcharacterexception1() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementinvalidcharacterexception1") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testAddress;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
testAddress = elementList.item(0);
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
testAddress.setAttribute("","value");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 5);
|
||||
}
|
||||
assertTrue("throw_INVALID_CHARACTER_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementinvalidcharacterexception1();
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Append a couple of text nodes to the first sup element, normalize the
|
||||
document element and check that the element has been normalized.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=546
|
||||
*/
|
||||
function hc_elementnormalize() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementnormalize") != null) return;
|
||||
var doc;
|
||||
var root;
|
||||
var elementList;
|
||||
var testName;
|
||||
var firstChild;
|
||||
var childValue;
|
||||
var textNode;
|
||||
var retNode;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("sup");
|
||||
testName = elementList.item(0);
|
||||
textNode = doc.createTextNode("");
|
||||
retNode = testName.appendChild(textNode);
|
||||
textNode = doc.createTextNode(",000");
|
||||
retNode = testName.appendChild(textNode);
|
||||
root = doc.documentElement;
|
||||
|
||||
root.normalize();
|
||||
elementList = doc.getElementsByTagName("sup");
|
||||
testName = elementList.item(0);
|
||||
firstChild = testName.firstChild;
|
||||
|
||||
childValue = firstChild.nodeValue;
|
||||
|
||||
assertEquals("elementNormalizeAssert","56,000,000",childValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementnormalize();
|
||||
}
|
||||
Generated
Vendored
+113
@@ -0,0 +1,113 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattribute";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "removeAttribute(name)" removes an attribute by name.
|
||||
If the attribute has a default value, it is immediately
|
||||
replaced. However, there is no default values in the HTML
|
||||
compatible tests, so its value is "".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9
|
||||
* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
|
||||
*/
|
||||
function hc_elementremoveattribute() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementremoveattribute") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testEmployee;
|
||||
var attrValue;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
testEmployee = elementList.item(3);
|
||||
testEmployee.removeAttribute("class");
|
||||
attrValue = testEmployee.getAttribute("class");
|
||||
assertEquals("attrValue",null,attrValue); //XXX Domino returns null as WebKit and FF do
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementremoveattribute();
|
||||
}
|
||||
Generated
Vendored
+144
@@ -0,0 +1,144 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveallattributes";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Create a list of all the attributes of the last child
|
||||
of the first "p" element by using the "getAttributes()"
|
||||
method.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
|
||||
* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184
|
||||
*/
|
||||
function hc_elementretrieveallattributes() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementretrieveallattributes") != null) return;
|
||||
var doc;
|
||||
var addressList;
|
||||
var testAddress;
|
||||
var attributes;
|
||||
var attribute;
|
||||
var attributeName;
|
||||
var actual = new Array();
|
||||
|
||||
htmlExpected = new Array();
|
||||
htmlExpected[0] = "title";
|
||||
|
||||
expected = new Array();
|
||||
expected[0] = "title";
|
||||
expected[1] = "dir";
|
||||
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
addressList = doc.getElementsByTagName("acronym");
|
||||
testAddress = addressList.item(0);
|
||||
attributes = testAddress.attributes;
|
||||
|
||||
for(var indexN1006B = 0;indexN1006B < attributes.length; indexN1006B++) {
|
||||
attribute = attributes.item(indexN1006B);
|
||||
attributeName = attribute.name;
|
||||
|
||||
actual[actual.length] = attributeName;
|
||||
|
||||
}
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html")
|
||||
|
||||
) {
|
||||
assertEqualsCollection("htmlAttributeNames",toLowerArray(htmlExpected),toLowerArray(actual));
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEqualsCollection("attributeNames",toLowerArray(expected),toLowerArray(actual));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementretrieveallattributes();
|
||||
}
|
||||
Generated
Vendored
+113
@@ -0,0 +1,113 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveattrvalue";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getAttribute(name)" method returns an attribute
|
||||
value by name.
|
||||
|
||||
Retrieve the second address element, then
|
||||
invoke the 'getAttribute("class")' method. This should
|
||||
return the value of the attribute("No").
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9
|
||||
*/
|
||||
function hc_elementretrieveattrvalue() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementretrieveattrvalue") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testAddress;
|
||||
var attrValue;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
testAddress = elementList.item(2);
|
||||
attrValue = testAddress.getAttribute("class");
|
||||
assertEquals("attrValue","No",attrValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementretrieveattrvalue();
|
||||
}
|
||||
Generated
Vendored
+118
@@ -0,0 +1,118 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrievetagname";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getElementsByTagName()" method returns a NodeList
|
||||
of all descendant elements with a given tagName.
|
||||
|
||||
Invoke the "getElementsByTagName()" method and create
|
||||
a NodeList of "code" elements. Retrieve the second
|
||||
"code" element in the list and return the NodeName.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815
|
||||
*/
|
||||
function hc_elementretrievetagname() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_elementretrievetagname") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testEmployee;
|
||||
var strong;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("code");
|
||||
testEmployee = elementList.item(1);
|
||||
strong = testEmployee.nodeName;
|
||||
|
||||
assertEqualsAutoCase("element", "nodename","code",strong);
|
||||
strong = testEmployee.tagName;
|
||||
|
||||
assertEqualsAutoCase("element", "tagname","code",strong);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_elementretrievetagname();
|
||||
}
|
||||
Generated
Vendored
+133
@@ -0,0 +1,133 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiesremovenameditem1";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
checkFeature("XML", null);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
An attempt to add remove an entity should result in a NO_MODIFICATION_ERR.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193
|
||||
*/
|
||||
function hc_entitiesremovenameditem1() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_entitiesremovenameditem1") != null) return;
|
||||
var doc;
|
||||
var entities;
|
||||
var docType;
|
||||
var retval;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
docType = doc.doctype;
|
||||
|
||||
|
||||
if(
|
||||
|
||||
!(
|
||||
(builder.contentType == "text/html")
|
||||
)
|
||||
|
||||
) {
|
||||
assertNotNull("docTypeNotNull",docType);
|
||||
entities = docType.entities;
|
||||
|
||||
assertNotNull("entitiesNotNull",entities);
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
retval = entities.removeNamedItem("alpha");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 7);
|
||||
}
|
||||
assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_entitiesremovenameditem1();
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiessetnameditem1";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
checkFeature("XML", null);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
An attempt to add an element to the named node map returned by entities should
|
||||
result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788
|
||||
*/
|
||||
function hc_entitiessetnameditem1() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_entitiessetnameditem1") != null) return;
|
||||
var doc;
|
||||
var entities;
|
||||
var docType;
|
||||
var retval;
|
||||
var elem;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
docType = doc.doctype;
|
||||
|
||||
|
||||
if(
|
||||
|
||||
!(
|
||||
(builder.contentType == "text/html")
|
||||
)
|
||||
|
||||
) {
|
||||
assertNotNull("docTypeNotNull",docType);
|
||||
entities = docType.entities;
|
||||
|
||||
assertNotNull("entitiesNotNull",entities);
|
||||
elem = doc.createElement("br");
|
||||
|
||||
try {
|
||||
retval = entities.setNamedItem(elem);
|
||||
fail("throw_HIER_OR_NO_MOD_ERR");
|
||||
|
||||
} catch (ex) {
|
||||
if (typeof(ex.code) != 'undefined') {
|
||||
switch(ex.code) {
|
||||
case /* HIERARCHY_REQUEST_ERR */ 3 :
|
||||
break;
|
||||
case /* NO_MODIFICATION_ALLOWED_ERR */ 7 :
|
||||
break;
|
||||
default:
|
||||
throw ex;
|
||||
}
|
||||
} else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_entitiessetnameditem1();
|
||||
}
|
||||
Generated
Vendored
+141
@@ -0,0 +1,141 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapchildnoderange";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Create a NamedNodeMap object from the attributes of the
|
||||
last child of the third "p" element and traverse the
|
||||
list from index 0 thru length -1. All indices should
|
||||
be valid.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=250
|
||||
*/
|
||||
function hc_namednodemapchildnoderange() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_namednodemapchildnoderange") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testEmployee;
|
||||
var attributes;
|
||||
var child;
|
||||
var strong;
|
||||
var length;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
testEmployee = elementList.item(2);
|
||||
attributes = testEmployee.attributes;
|
||||
|
||||
length = attributes.length;
|
||||
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html")
|
||||
|
||||
) {
|
||||
assertEquals("htmlLength",2,length);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEquals("length",3,length);
|
||||
child = attributes.item(2);
|
||||
assertNotNull("attr2",child);
|
||||
|
||||
}
|
||||
child = attributes.item(0);
|
||||
assertNotNull("attr0",child);
|
||||
child = attributes.item(1);
|
||||
assertNotNull("attr1",child);
|
||||
child = attributes.item(3);
|
||||
assertNull("attr3",child);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_namednodemapchildnoderange();
|
||||
}
|
||||
Generated
Vendored
+127
@@ -0,0 +1,127 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapnumberofnodes";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Retrieve the second "p" element and evaluate Node.attributes.length.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=250
|
||||
*/
|
||||
function hc_namednodemapnumberofnodes() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_namednodemapnumberofnodes") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testEmployee;
|
||||
var attributes;
|
||||
var length;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
testEmployee = elementList.item(2);
|
||||
attributes = testEmployee.attributes;
|
||||
|
||||
length = attributes.length;
|
||||
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html")
|
||||
|
||||
) {
|
||||
assertEquals("htmlLength",2,length);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEquals("length",3,length);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_namednodemapnumberofnodes();
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchild";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Retrieve the second "p" and append a "br" Element
|
||||
node to the list of children. The last node in the list
|
||||
is then retrieved and its NodeName examined. The
|
||||
"getNodeName()" method should return "br".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
|
||||
*/
|
||||
function hc_nodeappendchild() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeappendchild") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var employeeNode;
|
||||
var childList;
|
||||
var createdNode;
|
||||
var lchild;
|
||||
var childName;
|
||||
var appendedChild;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
employeeNode = elementList.item(1);
|
||||
childList = employeeNode.childNodes;
|
||||
|
||||
createdNode = doc.createElement("br");
|
||||
appendedChild = employeeNode.appendChild(createdNode);
|
||||
lchild = employeeNode.lastChild;
|
||||
|
||||
childName = lchild.nodeName;
|
||||
|
||||
assertEqualsAutoCase("element", "nodeName","br",childName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodeappendchild();
|
||||
}
|
||||
Generated
Vendored
+160
@@ -0,0 +1,160 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildchildexists";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
If the "newChild" is already in the tree, it is first
|
||||
removed before the new one is appended.
|
||||
|
||||
Retrieve the "em" second employee and
|
||||
append the first child to the end of the list. After
|
||||
the "appendChild(newChild)" method is invoked the first
|
||||
child should be the one that was second and the last
|
||||
child should be the one that was first.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
|
||||
*/
|
||||
function hc_nodeappendchildchildexists() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeappendchildchildexists") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var childList;
|
||||
var childNode;
|
||||
var newChild;
|
||||
var memberNode;
|
||||
var memberName;
|
||||
var refreshedActual = new Array();
|
||||
|
||||
var actual = new Array();
|
||||
|
||||
var nodeType;
|
||||
expected = new Array();
|
||||
expected[0] = "strong";
|
||||
expected[1] = "code";
|
||||
expected[2] = "sup";
|
||||
expected[3] = "var";
|
||||
expected[4] = "acronym";
|
||||
expected[5] = "em";
|
||||
|
||||
var appendedChild;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
childNode = elementList.item(1);
|
||||
childList = childNode.getElementsByTagName("*");
|
||||
newChild = childList.item(0);
|
||||
appendedChild = childNode.appendChild(newChild);
|
||||
for(var indexN10085 = 0;indexN10085 < childList.length; indexN10085++) {
|
||||
memberNode = childList.item(indexN10085);
|
||||
memberName = memberNode.nodeName;
|
||||
|
||||
actual[actual.length] = memberName;
|
||||
|
||||
}
|
||||
assertEqualsListAutoCase("element", "liveByTagName",expected,actual);
|
||||
childList = childNode.childNodes;
|
||||
|
||||
for(var indexN1009C = 0;indexN1009C < childList.length; indexN1009C++) {
|
||||
memberNode = childList.item(indexN1009C);
|
||||
nodeType = memberNode.nodeType;
|
||||
|
||||
|
||||
if(
|
||||
(1 == nodeType)
|
||||
) {
|
||||
memberName = memberNode.nodeName;
|
||||
|
||||
refreshedActual[refreshedActual.length] = memberName;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
assertEqualsListAutoCase("element", "refreshedChildNodes",expected,refreshedActual);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodeappendchildchildexists();
|
||||
}
|
||||
Generated
Vendored
+158
@@ -0,0 +1,158 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchilddocfragment";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
If the "newChild" is a DocumentFragment object then
|
||||
all its content is added to the child list of this node.
|
||||
|
||||
Create and populate a new DocumentFragment object and
|
||||
append it to the second employee. After the
|
||||
"appendChild(newChild)" method is invoked retrieve the
|
||||
new nodes at the end of the list, they should be the
|
||||
two Element nodes from the DocumentFragment.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
|
||||
*/
|
||||
function hc_nodeappendchilddocfragment() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeappendchilddocfragment") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var employeeNode;
|
||||
var childList;
|
||||
var newdocFragment;
|
||||
var newChild1;
|
||||
var newChild2;
|
||||
var child;
|
||||
var childName;
|
||||
var result = new Array();
|
||||
|
||||
var appendedChild;
|
||||
var nodeType;
|
||||
expected = new Array();
|
||||
expected[0] = "em";
|
||||
expected[1] = "strong";
|
||||
expected[2] = "code";
|
||||
expected[3] = "sup";
|
||||
expected[4] = "var";
|
||||
expected[5] = "acronym";
|
||||
expected[6] = "br";
|
||||
expected[7] = "b";
|
||||
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
employeeNode = elementList.item(1);
|
||||
childList = employeeNode.childNodes;
|
||||
|
||||
newdocFragment = doc.createDocumentFragment();
|
||||
newChild1 = doc.createElement("br");
|
||||
newChild2 = doc.createElement("b");
|
||||
appendedChild = newdocFragment.appendChild(newChild1);
|
||||
appendedChild = newdocFragment.appendChild(newChild2);
|
||||
appendedChild = employeeNode.appendChild(newdocFragment);
|
||||
for(var indexN100A2 = 0;indexN100A2 < childList.length; indexN100A2++) {
|
||||
child = childList.item(indexN100A2);
|
||||
nodeType = child.nodeType;
|
||||
|
||||
|
||||
if(
|
||||
(1 == nodeType)
|
||||
) {
|
||||
childName = child.nodeName;
|
||||
|
||||
result[result.length] = childName;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
assertEqualsListAutoCase("element", "nodeNames",expected,result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodeappendchilddocfragment();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildgetnodename";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "appendChild(newChild)" method returns the node
|
||||
added.
|
||||
|
||||
Append a newly created node to the child list of the
|
||||
second employee and check the NodeName returned. The
|
||||
"getNodeName()" method should return "br".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
|
||||
*/
|
||||
function hc_nodeappendchildgetnodename() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeappendchildgetnodename") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var employeeNode;
|
||||
var childList;
|
||||
var newChild;
|
||||
var appendNode;
|
||||
var childName;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
employeeNode = elementList.item(1);
|
||||
childList = employeeNode.childNodes;
|
||||
|
||||
newChild = doc.createElement("br");
|
||||
appendNode = employeeNode.appendChild(newChild);
|
||||
childName = appendNode.nodeName;
|
||||
|
||||
assertEqualsAutoCase("element", "nodeName","br",childName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodeappendchildgetnodename();
|
||||
}
|
||||
Generated
Vendored
+145
@@ -0,0 +1,145 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnewchilddiffdocument";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var doc1Ref = null;
|
||||
if (typeof(this.doc1) != 'undefined') {
|
||||
doc1Ref = this.doc1;
|
||||
}
|
||||
docsLoaded += preload(doc1Ref, "doc1", "hc_staff");
|
||||
|
||||
var doc2Ref = null;
|
||||
if (typeof(this.doc2) != 'undefined') {
|
||||
doc2Ref = this.doc2;
|
||||
}
|
||||
docsLoaded += preload(doc2Ref, "doc2", "hc_staff");
|
||||
|
||||
if (docsLoaded == 2) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 2) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "appendChild(newChild)" method raises a
|
||||
WRONG_DOCUMENT_ERR DOMException if the "newChild" was
|
||||
created from a different document than the one that
|
||||
created this node.
|
||||
|
||||
Retrieve the second employee and attempt to append
|
||||
a node created from a different document. An attempt
|
||||
to make such a replacement should raise the desired
|
||||
exception.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
|
||||
*/
|
||||
function hc_nodeappendchildnewchilddiffdocument() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeappendchildnewchilddiffdocument") != null) return;
|
||||
var doc1;
|
||||
var doc2;
|
||||
var newChild;
|
||||
var elementList;
|
||||
var elementNode;
|
||||
var appendedChild;
|
||||
|
||||
var doc1Ref = null;
|
||||
if (typeof(this.doc1) != 'undefined') {
|
||||
doc1Ref = this.doc1;
|
||||
}
|
||||
doc1 = load(doc1Ref, "doc1", "hc_staff");
|
||||
|
||||
var doc2Ref = null;
|
||||
if (typeof(this.doc2) != 'undefined') {
|
||||
doc2Ref = this.doc2;
|
||||
}
|
||||
doc2 = load(doc2Ref, "doc2", "hc_staff");
|
||||
newChild = doc1.createElement("br");
|
||||
elementList = doc2.getElementsByTagName("p");
|
||||
elementNode = elementList.item(1);
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
appendedChild = elementNode.appendChild(newChild);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 4);
|
||||
}
|
||||
assertTrue("throw_WRONG_DOCUMENT_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
return; // CSA: disabled; latest DOM spec adopts rather than throws.
|
||||
hc_nodeappendchildnewchilddiffdocument();
|
||||
}
|
||||
Generated
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnodeancestor";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "appendChild(newChild)" method raises a
|
||||
HIERARCHY_REQUEST_ERR DOMException if the node to
|
||||
append is one of this node's ancestors.
|
||||
|
||||
Retrieve the second employee and attempt to append
|
||||
an ancestor node(root node) to it.
|
||||
An attempt to make such an addition should raise the
|
||||
desired exception.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
|
||||
*/
|
||||
function hc_nodeappendchildnodeancestor() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeappendchildnodeancestor") != null) return;
|
||||
var doc;
|
||||
var newChild;
|
||||
var elementList;
|
||||
var employeeNode;
|
||||
var childList;
|
||||
var oldChild;
|
||||
var appendedChild;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
newChild = doc.documentElement;
|
||||
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
employeeNode = elementList.item(1);
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
appendedChild = employeeNode.appendChild(newChild);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 3);
|
||||
}
|
||||
assertTrue("throw_HIERARCHY_REQUEST_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodeappendchildnodeancestor();
|
||||
}
|
||||
Generated
Vendored
+120
@@ -0,0 +1,120 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodeattribute";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getAttributes()" method invoked on an Attribute
|
||||
Node returns null.
|
||||
|
||||
Retrieve the first attribute from the last child of the
|
||||
first employee and invoke the "getAttributes()" method
|
||||
on the Attribute Node. It should return null.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024
|
||||
*/
|
||||
function hc_nodeattributenodeattribute() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeattributenodeattribute") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var testAddr;
|
||||
var addrAttr;
|
||||
var attrNode;
|
||||
var attrList;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
testAddr = elementList.item(0);
|
||||
addrAttr = testAddr.attributes;
|
||||
|
||||
attrNode = addrAttr.item(0);
|
||||
attrList = attrNode.attributes;
|
||||
|
||||
assertNull("nodeAttributeNodeAttributeAssert1",attrList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodeattributenodeattribute();
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodes";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
The "getChildNodes()" method returns a NodeList
|
||||
that contains all children of this node.
|
||||
|
||||
Retrieve the second employee and check the NodeList
|
||||
returned by the "getChildNodes()" method. The
|
||||
length of the list should be 13.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
|
||||
*/
|
||||
function hc_nodechildnodes() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodechildnodes") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var employeeNode;
|
||||
var childNode;
|
||||
var childNodes;
|
||||
var nodeType;
|
||||
var childName;
|
||||
var actual = new Array();
|
||||
|
||||
expected = new Array();
|
||||
expected[0] = "em";
|
||||
expected[1] = "strong";
|
||||
expected[2] = "code";
|
||||
expected[3] = "sup";
|
||||
expected[4] = "var";
|
||||
expected[5] = "acronym";
|
||||
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
employeeNode = elementList.item(1);
|
||||
childNodes = employeeNode.childNodes;
|
||||
|
||||
for(var indexN1006C = 0;indexN1006C < childNodes.length; indexN1006C++) {
|
||||
childNode = childNodes.item(indexN1006C);
|
||||
nodeType = childNode.nodeType;
|
||||
|
||||
childName = childNode.nodeName;
|
||||
|
||||
|
||||
if(
|
||||
(1 == nodeType)
|
||||
) {
|
||||
actual[actual.length] = childName;
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEquals("textNodeType",3,nodeType);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
assertEqualsListAutoCase("element", "elementNames",expected,actual);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodechildnodes();
|
||||
}
|
||||
Generated
Vendored
+159
@@ -0,0 +1,159 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesappendchild";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The NodeList returned by the "getChildNodes()" method
|
||||
is live. Changes on the node's children are immediately
|
||||
reflected on the nodes returned in the NodeList.
|
||||
|
||||
Create a NodeList of the children of the second employee
|
||||
and then add a newly created element that was created
|
||||
by the "createElement()" method(Document Interface) to
|
||||
the second employee by using the "appendChild()" method.
|
||||
The length of the NodeList should reflect this new
|
||||
addition to the child list. It should return the value 14.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247
|
||||
*/
|
||||
function hc_nodechildnodesappendchild() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodechildnodesappendchild") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var employeeNode;
|
||||
var childList;
|
||||
var createdNode;
|
||||
var childNode;
|
||||
var childName;
|
||||
var childType;
|
||||
var textNode;
|
||||
var actual = new Array();
|
||||
|
||||
expected = new Array();
|
||||
expected[0] = "em";
|
||||
expected[1] = "strong";
|
||||
expected[2] = "code";
|
||||
expected[3] = "sup";
|
||||
expected[4] = "var";
|
||||
expected[5] = "acronym";
|
||||
expected[6] = "br";
|
||||
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
employeeNode = elementList.item(1);
|
||||
childList = employeeNode.childNodes;
|
||||
|
||||
createdNode = doc.createElement("br");
|
||||
employeeNode = employeeNode.appendChild(createdNode);
|
||||
for(var indexN10087 = 0;indexN10087 < childList.length; indexN10087++) {
|
||||
childNode = childList.item(indexN10087);
|
||||
childName = childNode.nodeName;
|
||||
|
||||
childType = childNode.nodeType;
|
||||
|
||||
|
||||
if(
|
||||
(1 == childType)
|
||||
) {
|
||||
actual[actual.length] = childName;
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEquals("textNodeType",3,childType);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
assertEqualsListAutoCase("element", "childElements",expected,actual);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodechildnodesappendchild();
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesempty";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getChildNodes()" method returns a NodeList
|
||||
that contains all children of this node. If there
|
||||
are not any children, this is a NodeList that does not
|
||||
contain any nodes.
|
||||
|
||||
Retrieve the character data of the second "em" node and
|
||||
invoke the "getChildNodes()" method. The
|
||||
NodeList returned should not have any nodes.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246
|
||||
*/
|
||||
function hc_nodechildnodesempty() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodechildnodesempty") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var childList;
|
||||
var employeeNode;
|
||||
var textNode;
|
||||
var length;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("em");
|
||||
employeeNode = elementList.item(1);
|
||||
textNode = employeeNode.firstChild;
|
||||
|
||||
childList = textNode.childNodes;
|
||||
|
||||
length = childList.length;
|
||||
|
||||
assertEquals("length_zero",0,length);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodechildnodesempty();
|
||||
}
|
||||
Generated
Vendored
+149
@@ -0,0 +1,149 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecloneattributescopied";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Retrieve the second acronym element and invoke
|
||||
the cloneNode method. The
|
||||
duplicate node returned by the method should copy the
|
||||
attributes associated with this node.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184
|
||||
*/
|
||||
function hc_nodecloneattributescopied() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodecloneattributescopied") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var addressNode;
|
||||
var clonedNode;
|
||||
var attributes;
|
||||
var attributeNode;
|
||||
var attributeName;
|
||||
var result = new Array();
|
||||
|
||||
htmlExpected = new Array();
|
||||
htmlExpected[0] = "class";
|
||||
htmlExpected[1] = "title";
|
||||
|
||||
expected = new Array();
|
||||
expected[0] = "class";
|
||||
expected[1] = "title";
|
||||
expected[2] = "dir";
|
||||
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
addressNode = elementList.item(1);
|
||||
clonedNode = addressNode.cloneNode(false);
|
||||
attributes = clonedNode.attributes;
|
||||
|
||||
for(var indexN10076 = 0;indexN10076 < attributes.length; indexN10076++) {
|
||||
attributeNode = attributes.item(indexN10076);
|
||||
attributeName = attributeNode.name;
|
||||
|
||||
result[result.length] = attributeName;
|
||||
|
||||
}
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html")
|
||||
|
||||
) {
|
||||
assertEqualsCollection("nodeNames_html",toLowerArray(htmlExpected),toLowerArray(result));
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
assertEqualsCollection("nodeNames",expected,result);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodecloneattributescopied();
|
||||
}
|
||||
Generated
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonefalsenocopytext";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "cloneNode(deep)" method does not copy text unless it
|
||||
is deep cloned.(Test for deep=false)
|
||||
|
||||
Retrieve the fourth child of the second employee and
|
||||
the "cloneNode(deep)" method with deep=false. The
|
||||
duplicate node returned by the method should not copy
|
||||
any text data contained in this node.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
|
||||
*/
|
||||
function hc_nodeclonefalsenocopytext() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeclonefalsenocopytext") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var employeeNode;
|
||||
var childList;
|
||||
var childNode;
|
||||
var clonedNode;
|
||||
var lastChildNode;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
employeeNode = elementList.item(1);
|
||||
childList = employeeNode.childNodes;
|
||||
|
||||
childNode = childList.item(3);
|
||||
clonedNode = childNode.cloneNode(false);
|
||||
lastChildNode = clonedNode.lastChild;
|
||||
|
||||
assertNull("nodeCloneFalseNoCopyTextAssert1",lastChildNode);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodeclonefalsenocopytext();
|
||||
}
|
||||
Generated
Vendored
+117
@@ -0,0 +1,117 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonegetparentnull";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The duplicate node returned by the "cloneNode(deep)"
|
||||
method does not have a ParentNode.
|
||||
|
||||
Retrieve the second employee and invoke the
|
||||
"cloneNode(deep)" method with deep=false. The
|
||||
duplicate node returned should return null when the
|
||||
"getParentNode()" is invoked.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
|
||||
*/
|
||||
function hc_nodeclonegetparentnull() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeclonegetparentnull") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var employeeNode;
|
||||
var clonedNode;
|
||||
var parentNode;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
employeeNode = elementList.item(1);
|
||||
clonedNode = employeeNode.cloneNode(false);
|
||||
parentNode = clonedNode.parentNode;
|
||||
|
||||
assertNull("nodeCloneGetParentNullAssert1",parentNode);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodeclonegetparentnull();
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonenodefalse";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "cloneNode(deep)" method returns a copy of the node
|
||||
only if deep=false.
|
||||
|
||||
Retrieve the second employee and invoke the
|
||||
"cloneNode(deep)" method with deep=false. The
|
||||
method should only clone this node. The NodeName and
|
||||
length of the NodeList are checked. The "getNodeName()"
|
||||
method should return "employee" and the "getLength()"
|
||||
method should return 0.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4
|
||||
*/
|
||||
function hc_nodeclonenodefalse() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_nodeclonenodefalse") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var employeeNode;
|
||||
var clonedNode;
|
||||
var cloneName;
|
||||
var cloneChildren;
|
||||
var length;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("p");
|
||||
employeeNode = elementList.item(1);
|
||||
clonedNode = employeeNode.cloneNode(false);
|
||||
cloneName = clonedNode.nodeName;
|
||||
|
||||
assertEqualsAutoCase("element", "strong","p",cloneName);
|
||||
cloneChildren = clonedNode.childNodes;
|
||||
|
||||
length = cloneChildren.length;
|
||||
|
||||
assertEquals("length",0,length);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_nodeclonenodefalse();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user