Bug 866424 - Part d: Update our copy of the HTML test suite and its expected failures; r=jhammel

--HG--
rename : dom/imptests/failures/html/html/dom/documents/dom-tree-accessors/test_document.body-getter-frameset-and-body.html.json => dom/imptests/failures/html/html/dom/documents/dom-tree-accessors/test_document.body-getter.html.json
This commit is contained in:
Ms2ger 2013-05-10 09:11:39 +02:00
parent e17fd884f7
commit db76f8d334
31 changed files with 781 additions and 72 deletions

View File

@ -0,0 +1,16 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DEPTH := @DEPTH@
topsrcdir := @top_srcdir@
srcdir := @srcdir@
VPATH := @srcdir@
relativesrcdir := @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES := \
test_window-null-names.html.json \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [
]

View File

@ -0,0 +1,3 @@
{
"Named access with null characters": true
}

View File

@ -10,11 +10,16 @@ relativesrcdir := @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES := \
test_document.body-getter-frameset-and-body.html.json \
test_document.body-getter.html.json \
test_document.title-03.html.json \
test_document.title-04.xhtml.json \
test_document.title-06.html.json \
test_document.title-07.html.json \
test_nameditem-02.html.json \
test_nameditem-03.html.json \
test_nameditem-04.html.json \
test_nameditem-05.html.json \
test_nameditem-06.html.json \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,8 @@
{
"Frameset followed by body inside the html element": true,
"Body followed by frameset inside a non-HTML html element": true,
"Frameset inside an x element followed by a frameset": true,
"Frameset as the root node": true,
"Body as the root node with a frameset child": true,
"Frameset as the root node with a body child": true
}

View File

@ -0,0 +1,8 @@
{
"If the only named item is an iframe, the contentWindow should be returned.": true,
"If there are two iframes, a collection should be returned.": true,
"If there are an iframe and another element (iframe first), a collection should be returned.": true,
"If there are an iframe and another element (iframe last), a collection should be returned.": true,
"If an iframe has a name and a different id, it should be returned by its name.": true,
"An iframe whose name looks like an array index should work.": true
}

View File

@ -0,0 +1,6 @@
{
"If there are two applets, a collection should be returned. (name)": true,
"If there are two applets, a collection should be returned. (id)": true,
"If there are two applets, a collection should be returned. (name and id)": true,
"If there are two applets, a collection should be returned. (id and name)": true
}

View File

@ -0,0 +1,3 @@
{
"If there are two forms, a collection should be returned. (name)": true
}

View File

@ -0,0 +1,6 @@
{
"If there are two embeds, a collection should be returned. (name)": true,
"If there is one embed, it should not be returned (id)": true,
"If there are two embeds, nothing should be returned. (id)": true,
"A name shouldn't affect getting an embed by id": true
}

View File

@ -0,0 +1,5 @@
{
"If there are two imgs, a collection should be returned. (name)": true,
"If there is one img, it should not be returned (id)": true,
"If there are two imgs, nothing should be returned. (id)": true
}

View File

@ -1,4 +1,3 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [

View File

@ -1,4 +1,3 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
DIRS += [

View File

@ -1,4 +1,5 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
DIRS += [
'named-access-on-the-window-object',
]

View File

@ -0,0 +1,16 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
DEPTH := @DEPTH@
topsrcdir := @top_srcdir@
srcdir := @srcdir@
VPATH := @srcdir@
relativesrcdir := @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES := \
test_window-null-names.html \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,4 @@
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
DIRS += [
]

View File

@ -0,0 +1,20 @@
<!doctype html>
<meta charset=utf-8>
<title>Named access with null characters</title>
<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#window">
<link rel="help" href="http://www.whatwg.org/html/#dom-window-nameditem">
<link rel="help" href="http://dev.w3.org/2006/webapi/WebIDL/#named-properties-object">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
test(function() {
var iframe = document.createElement("iframe")
iframe.name = "a\0b"
document.body.appendChild(iframe)
assert_equals(window["a\0b"], iframe.contentWindow)
assert_equals(window["ab"], undefined)
assert_equals(window["a"], undefined)
});
</script>

View File

@ -51,7 +51,7 @@ test(function() {
}, "constructor");
var t = async_test("Dynamic name")
var t2 = async_test("Ghost name")
window.onload = t.step_func(function() {
t.step(function() {
var iframe = document.getElementsByTagName("iframe")[0];
iframe.setAttribute("src", "data:text/html,<script>window.name='foo'<\/script>");
iframe.onload = function() {

View File

@ -10,9 +10,7 @@ relativesrcdir := @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES := \
test_document.body-getter-body-and-frameset.html \
test_document.body-getter-foreign-frameset.html \
test_document.body-getter-frameset-and-body.html \
test_document.body-getter.html \
test_document.body-setter-01.html \
test_document.embeds-document.plugins-01.html \
test_Document.getElementsByClassName-null-undef.html \
@ -28,6 +26,11 @@ MOCHITEST_FILES := \
test_document.title-07.html \
test_Element.getElementsByClassName-null-undef.html \
test_nameditem-01.html \
test_nameditem-02.html \
test_nameditem-03.html \
test_nameditem-04.html \
test_nameditem-05.html \
test_nameditem-06.html \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<title>document.body and framesets</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html5/#dom-document-body">
<link rel="stylesheet" href="/resources/testharness.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var b =
document.documentElement.appendChild(document.createElement("body"));
document.documentElement.appendChild(document.createElement("frameset"));
</script>
<div id="log"></div>
<script>
test(function() {
assert_equals(document.body, b);
});
</script>

View File

@ -1,17 +0,0 @@
<!DOCTYPE html>
<title>document.body and a frameset in a foreign namespace</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html5/#dom-document-body">
<link rel="stylesheet" href="/resources/testharness.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
document.documentElement.appendChild(
document.createElementNS("http://example.org/test", "frameset"));
</script>
<div id="log"></div>
<script>
test(function() {
assert_equals(document.body, document.getElementsByTagName("body")[0]);
});
</script>

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<title>document.body and framesets</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html5/#dom-document-body">
<link rel="stylesheet" href="/resources/testharness.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var f =
document.documentElement.appendChild(document.createElement("frameset"));
document.documentElement.appendChild(document.createElement("body"));
</script>
<div id="log"></div>
<script>
test(function() {
assert_equals(document.body, f);
});
</script>

View File

@ -0,0 +1,125 @@
<!DOCTYPE html>
<title>Document.body</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#dom-document-body">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
</script>
<div id="log"></div>
<script>
function createDocument() {
var doc = document.implementation.createHTMLDocument("");
doc.removeChild(doc.documentElement);
return doc;
}
test(function() {
var doc = createDocument();
assert_equals(doc.body, null);
}, "Childless document");
test(function() {
var doc = createDocument();
doc.appendChild(doc.createElement("html"));
assert_equals(doc.body, null);
}, "Childless html element");
test(function() {
var doc = createDocument();
var html = doc.appendChild(doc.createElement("html"));
var b =
html.appendChild(doc.createElement("body"));
html.appendChild(doc.createElement("frameset"));
assert_equals(doc.body, b);
}, "Body followed by frameset inside the html element");
test(function() {
var doc = createDocument();
var html = doc.appendChild(doc.createElement("html"));
var f =
html.appendChild(doc.createElement("frameset"));
html.appendChild(doc.createElement("body"));
assert_equals(doc.body, f);
}, "Frameset followed by body inside the html element");
test(function() {
var doc = createDocument();
var html =
doc.appendChild(doc.createElementNS("http://example.org/test", "html"));
var b =
html.appendChild(doc.createElement("body"));
html.appendChild(doc.createElement("frameset"));
assert_equals(doc.body, b);
}, "Body followed by frameset inside a non-HTML html element");
test(function() {
var doc = createDocument();
var html =
doc.appendChild(doc.createElementNS("http://example.org/test", "html"));
var f =
html.appendChild(doc.createElement("frameset"));
html.appendChild(doc.createElement("body"));
assert_equals(doc.body, f);
}, "Frameset followed by body inside a non-HTML html element");
test(function() {
var doc = createDocument();
var html = doc.appendChild(doc.createElement("html"));
html.appendChild(
doc.createElementNS("http://example.org/test", "body"));
var b = html.appendChild(doc.createElement("body"));
assert_equals(doc.body, b);
}, "Non-HTML body followed by body inside the html element");
test(function() {
var doc = createDocument();
var html = doc.appendChild(doc.createElement("html"));
html.appendChild(
doc.createElementNS("http://example.org/test", "frameset"));
var b = html.appendChild(doc.createElement("body"));
assert_equals(doc.body, b);
}, "Non-HTML frameset followed by body inside the html element");
test(function() {
var doc = createDocument();
var html = doc.appendChild(doc.createElement("html"));
var x = html.appendChild(doc.createElement("x"));
x.appendChild(doc.createElement("body"));
var body = html.appendChild(doc.createElement("body"));
assert_equals(doc.body, body);
}, "Body inside an x element followed by a body");
test(function() {
var doc = createDocument();
var html = doc.appendChild(doc.createElement("html"));
var x = html.appendChild(doc.createElement("x"));
x.appendChild(doc.createElement("frameset"));
var frameset = html.appendChild(doc.createElement("frameset"));
assert_equals(doc.body, frameset);
}, "Frameset inside an x element followed by a frameset");
// Root node is not a html element.
test(function() {
var doc = createDocument();
doc.appendChild(doc.createElement("body"));
assert_equals(doc.body, null);
}, "Body as the root node");
test(function() {
var doc = createDocument();
doc.appendChild(doc.createElement("frameset"));
assert_equals(doc.body, null);
}, "Frameset as the root node");
test(function() {
var doc = createDocument();
var body = doc.appendChild(doc.createElement("body"));
body.appendChild(doc.createElement("frameset"));
assert_equals(doc.body, null);
}, "Body as the root node with a frameset child");
test(function() {
var doc = createDocument();
var frameset = doc.appendChild(doc.createElement("frameset"));
frameset.appendChild(doc.createElement("body"));
assert_equals(doc.body, null);
}, "Frameset as the root node with a body child");
test(function() {
var doc = createDocument();
doc.appendChild(doc.createElementNS("http://example.org/test", "body"));
assert_equals(doc.body, null);
}, "Non-HTML body as the root node");
test(function() {
var doc = createDocument();
doc.appendChild(doc.createElementNS("http://example.org/test", "frameset"));
assert_equals(doc.body, null);
}, "Non-HTML frameset as the root node");
</script>

View File

@ -1,17 +1,27 @@
<!DOCTYPE html>
<title>Setting document.body to incorrect values</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html5/#dom-document-body">
<link rel="help" href="http://www.whatwg.org/html/#dom-document-body">
<link rel="help" href="http://dev.w3.org/2006/webapi/WebIDL/#es-interface">
<link rel="stylesheet" href="/resources/testharness.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
assert_throws(new TypeError(), function() { document.body = "text" })
}, "Should throw a TypeError.");
assert_throws(new TypeError(), function() {
document.body = "text"
})
}, "Should throw a TypeError when trying to set document.body to a string.")
test(function() {
assert_throws("HIERARCHY_REQUEST_ERR", function() { document.body = document.createElement("div") })
}, "Should throw a HIERARCHY_REQUEST_ERR.");
assert_throws("HierarchyRequestError", function() {
document.body = document.createElement("div")
})
}, "Should throw a HierarchyRequestError when trying to set document.body to a div element.")
test(function() {
var doc = document.implementation.createHTMLDocument("")
doc.removeChild(doc.documentElement)
assert_throws("HierarchyRequestError", function() {
doc.body = document.createElement("body")
})
}, "Should throw a HierarchyRequestError when trying to set document.body when there's no root element.")
</script>

View File

@ -1,8 +1,8 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Named items: img id &amp; name</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html5/#dom-document-nameditem">
<link rel="stylesheet" href="/resources/testharness.css">
<link rel="help" href="http://www.whatwg.org/html/#dom-document-nameditem">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
@ -15,5 +15,5 @@ test(function() {
assert_equals(document['a'], document.getElementsByTagName("img")[0]);
assert_equals(document.b, document.getElementsByTagName("img")[0]);
assert_equals(document['b'], document.getElementsByTagName("img")[0]);
});
}, "img elements that have a name and id attribute, should be accessible by both values.");
</script>

View File

@ -0,0 +1,99 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Named items: iframes</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#dom-document-nameditem">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<iframe name="test1"></iframe>
<iframe name="test2"></iframe>
<iframe name="test2"></iframe>
<iframe name="test3"></iframe>
<img name="test3">
<img name="test4">
<iframe name="test4"></iframe>
<iframe id="test5"></iframe>
<iframe name="test6" id="fail"></iframe>
<iframe name="fail" id="test7"></iframe>
<iframe name="42"></iframe>
</div>
<script>
test(function() {
var iframe = document.getElementsByTagName("iframe")[0];
assert_equals(iframe.name, "test1");
assert_true("test1" in document, '"test1" in document should be true');
assert_equals(document.test1, iframe.contentWindow);
}, "If the only named item is an iframe, the contentWindow should be returned.");
test(function() {
var iframe1 = document.getElementsByTagName("iframe")[1];
assert_equals(iframe1.name, "test2");
var iframe2 = document.getElementsByTagName("iframe")[2];
assert_equals(iframe2.name, "test2");
assert_true("test2" in document, '"test2" in document should be true');
var collection = document.test2;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [iframe1, iframe2]);
}, "If there are two iframes, a collection should be returned.");
test(function() {
var iframe = document.getElementsByTagName("iframe")[3];
assert_equals(iframe.name, "test3");
var img = document.getElementsByTagName("img")[0];
assert_equals(img.name, "test3");
assert_true("test3" in document, '"test3" in document should be true');
var collection = document.test3;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [iframe, img]);
}, "If there are an iframe and another element (iframe first), a collection should be returned.");
test(function() {
var iframe = document.getElementsByTagName("iframe")[4];
assert_equals(iframe.name, "test4");
var img = document.getElementsByTagName("img")[1];
assert_equals(img.name, "test4");
assert_true("test4" in document, '"test4" in document should be true');
var collection = document.test4;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [img, iframe]);
}, "If there are an iframe and another element (iframe last), a collection should be returned.");
test(function() {
assert_false("test5" in document, '"test5" in document should be false');
assert_equals(document.test5, undefined);
}, "If an iframe has an id and no name, it should not be returned.");
test(function() {
var iframe = document.getElementsByTagName("iframe")[6];
assert_equals(iframe.name, "test6");
assert_true("test6" in document, '"test6" in document should be true');
assert_equals(document.test6, iframe.contentWindow);
}, "If an iframe has a name and a different id, it should be returned by its name.");
test(function() {
assert_false("test7" in document, '"test7" in document should be false');
assert_equals(document.test7, undefined);
}, "If an iframe has an id and a different name, it should not be returned by its id.");
test(function() {
var iframe = document.getElementsByTagName("iframe")[8];
assert_equals(iframe.name, "42");
assert_true(42 in document, '42 in document should be true');
assert_equals(document[42], iframe.contentWindow);
}, "An iframe whose name looks like an array index should work.");
</script>

View File

@ -0,0 +1,110 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Named items: applets</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#dom-document-nameditem">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<applet name=test1></applet>
<applet name=test2></applet>
<applet name=test2></applet>
<applet id=test3></applet>
<applet id=test4></applet>
<applet id=test4></applet>
<applet name=test5></applet>
<applet id=test5></applet>
<applet id=test6></applet>
<applet name=test6></applet>
<applet id=test7 name=fail></applet>
<applet name=test8 id=fail></applet>
</div>
<script>
test(function() {
var applet = document.getElementsByTagName("applet")[0];
assert_equals(applet.name, "test1");
assert_true("test1" in document, '"test1" in document should be true');
assert_equals(document.test1, applet);
}, "If there is one applet, it should be returned (name)");
test(function() {
var applet1 = document.getElementsByTagName("applet")[1];
assert_equals(applet1.name, "test2");
var applet2 = document.getElementsByTagName("applet")[2];
assert_equals(applet2.name, "test2");
assert_true("test2" in document, '"test2" in document should be true');
var collection = document.test2;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If there are two applets, a collection should be returned. (name)");
test(function() {
var applet = document.getElementsByTagName("applet")[3];
assert_equals(applet.id, "test3");
assert_true("test3" in document, '"test3" in document should be true');
assert_equals(document.test3, applet);
}, "If there is one applet, it should be returned (id)");
test(function() {
var applet1 = document.getElementsByTagName("applet")[4];
assert_equals(applet1.id, "test4");
var applet2 = document.getElementsByTagName("applet")[5];
assert_equals(applet2.id, "test4");
assert_true("test4" in document, '"test4" in document should be true');
var collection = document.test4;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If there are two applets, a collection should be returned. (id)");
test(function() {
var applet1 = document.getElementsByTagName("applet")[6];
assert_equals(applet1.name, "test5");
var applet2 = document.getElementsByTagName("applet")[7];
assert_equals(applet2.id, "test5");
assert_true("test5" in document, '"test5" in document should be true');
var collection = document.test5;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If there are two applets, a collection should be returned. (name and id)");
test(function() {
var applet1 = document.getElementsByTagName("applet")[8];
assert_equals(applet1.id, "test6");
var applet2 = document.getElementsByTagName("applet")[9];
assert_equals(applet2.name, "test6");
assert_true("test6" in document, '"test6" in document should be true');
var collection = document.test6;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If there are two applets, a collection should be returned. (id and name)");
test(function() {
var applet = document.getElementsByTagName("applet")[10];
assert_equals(applet.id, "test7");
assert_true("test7" in document, '"test7" in document should be true');
assert_equals(document.test7, applet);
}, "A name shouldn't affect getting an applet by id");
test(function() {
var applet = document.getElementsByTagName("applet")[11];
assert_equals(applet.name, "test8");
assert_true("test8" in document, '"test8" in document should be true');
assert_equals(document.test8, applet);
}, "An id shouldn't affect getting an applet by name");
</script>

View File

@ -0,0 +1,104 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Named items: forms</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#dom-document-nameditem">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<form name=test1></form>
<form name=test2></form>
<form name=test2></form>
<form id=test3></form>
<form id=test4></form>
<form id=test4></form>
<form name=test5></form>
<form id=test5></form>
<form id=test6></form>
<form name=test6></form>
<form id=test7 name=fail></form>
<form name=test8 id=fail></form>
</div>
<script>
test(function() {
var form = document.getElementsByTagName("form")[0];
assert_equals(form.name, "test1");
assert_true("test1" in document, '"test1" in document should be true');
assert_equals(document.test1, form);
}, "If there is one form, it should be returned (name)");
test(function() {
var form1 = document.getElementsByTagName("form")[1];
assert_equals(form1.name, "test2");
var form2 = document.getElementsByTagName("form")[2];
assert_equals(form2.name, "test2");
assert_true("test2" in document, '"test2" in document should be true');
var collection = document.test2;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [form1, form2]);
}, "If there are two forms, a collection should be returned. (name)");
test(function() {
var form = document.getElementsByTagName("form")[3];
assert_equals(form.id, "test3");
assert_false("test3" in document, '"test3" in document should be false');
assert_equals(document.test3, undefined);
}, "If there is one form, it should not be returned (id)");
test(function() {
var form1 = document.getElementsByTagName("form")[4];
assert_equals(form1.id, "test4");
var form2 = document.getElementsByTagName("form")[5];
assert_equals(form2.id, "test4");
assert_false("test4" in document, '"test4" in document should be false');
assert_equals(document.test4, undefined);
}, "If there are two forms, nothing should be returned. (id)");
test(function() {
var form1 = document.getElementsByTagName("form")[6];
assert_equals(form1.name, "test5");
var form2 = document.getElementsByTagName("form")[7];
assert_equals(form2.id, "test5");
assert_true("test5" in document, '"test5" in document should be true');
assert_equals(document.test5, form1);
}, "If there are two forms, a collection should be returned. (name and id)");
test(function() {
var form1 = document.getElementsByTagName("form")[8];
assert_equals(form1.id, "test6");
var form2 = document.getElementsByTagName("form")[9];
assert_equals(form2.name, "test6");
assert_true("test6" in document, '"test6" in document should be true');
assert_equals(document.test6, form2);
}, "If there are two forms, a collection should be returned. (id and name)");
test(function() {
var form = document.getElementsByTagName("form")[10];
assert_equals(form.id, "test7");
assert_false("test7" in document, '"test7" in document should be false');
assert_equals(document.test7, undefined);
}, "A name shouldn't affect getting an form by id");
test(function() {
var form = document.getElementsByTagName("form")[11];
assert_equals(form.name, "test8");
assert_true("test8" in document, '"test8" in document should be true');
assert_equals(document.test8, form);
}, "An id shouldn't affect getting an form by name");
</script>

View File

@ -0,0 +1,104 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Named items: embeds</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#dom-document-nameditem">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<embed name=test1></embed>
<embed name=test2></embed>
<embed name=test2></embed>
<embed id=test3></embed>
<embed id=test4></embed>
<embed id=test4></embed>
<embed name=test5></embed>
<embed id=test5></embed>
<embed id=test6></embed>
<embed name=test6></embed>
<embed id=test7 name=fail></embed>
<embed name=test8 id=fail></embed>
</div>
<script>
test(function() {
var embed = document.getElementsByTagName("embed")[0];
assert_equals(embed.name, "test1");
assert_true("test1" in document, '"test1" in document should be true');
assert_equals(document.test1, embed);
}, "If there is one embed, it should be returned (name)");
test(function() {
var embed1 = document.getElementsByTagName("embed")[1];
assert_equals(embed1.name, "test2");
var embed2 = document.getElementsByTagName("embed")[2];
assert_equals(embed2.name, "test2");
assert_true("test2" in document, '"test2" in document should be true');
var collection = document.test2;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [embed1, embed2]);
}, "If there are two embeds, a collection should be returned. (name)");
test(function() {
var embed = document.getElementsByTagName("embed")[3];
assert_equals(embed.id, "test3");
assert_false("test3" in document, '"test3" in document should be false');
assert_equals(document.test3, undefined);
}, "If there is one embed, it should not be returned (id)");
test(function() {
var embed1 = document.getElementsByTagName("embed")[4];
assert_equals(embed1.id, "test4");
var embed2 = document.getElementsByTagName("embed")[5];
assert_equals(embed2.id, "test4");
assert_false("test4" in document, '"test4" in document should be false');
assert_equals(document.test4, undefined);
}, "If there are two embeds, nothing should be returned. (id)");
test(function() {
var embed1 = document.getElementsByTagName("embed")[6];
assert_equals(embed1.name, "test5");
var embed2 = document.getElementsByTagName("embed")[7];
assert_equals(embed2.id, "test5");
assert_true("test5" in document, '"test5" in document should be true');
assert_equals(document.test5, embed1);
}, "If there are two embeds, a collection should be returned. (name and id)");
test(function() {
var embed1 = document.getElementsByTagName("embed")[8];
assert_equals(embed1.id, "test6");
var embed2 = document.getElementsByTagName("embed")[9];
assert_equals(embed2.name, "test6");
assert_true("test6" in document, '"test6" in document should be true');
assert_equals(document.test6, embed2);
}, "If there are two embeds, a collection should be returned. (id and name)");
test(function() {
var embed = document.getElementsByTagName("embed")[10];
assert_equals(embed.id, "test7");
assert_false("test7" in document, '"test7" in document should be false');
assert_equals(document.test7, undefined);
}, "A name shouldn't affect getting an embed by id");
test(function() {
var embed = document.getElementsByTagName("embed")[11];
assert_equals(embed.name, "test8");
assert_true("test8" in document, '"test8" in document should be true');
assert_equals(document.test8, embed);
}, "An id shouldn't affect getting an embed by name");
</script>

View File

@ -0,0 +1,106 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Named items: imgs</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="http://www.whatwg.org/html/#dom-document-nameditem">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<img name=test1>
<img name=test2>
<img name=test2>
<img id=test3>
<img id=test4>
<img id=test4>
<img name=test5>
<img id=test5>
<img id=test6>
<img name=test6>
<img id=test7 name=fail>
<img name=test8 id=fail>
</div>
<script>
test(function() {
var img = document.getElementsByTagName("img")[0];
assert_equals(img.name, "test1");
assert_true("test1" in document, '"test1" in document should be true');
assert_equals(document.test1, img);
}, "If there is one img, it should be returned (name)");
test(function() {
var img1 = document.getElementsByTagName("img")[1];
assert_equals(img1.name, "test2");
var img2 = document.getElementsByTagName("img")[2];
assert_equals(img2.name, "test2");
assert_true("test2" in document, '"test2" in document should be true');
var collection = document.test2;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [img1, img2]);
}, "If there are two imgs, a collection should be returned. (name)");
test(function() {
var img = document.getElementsByTagName("img")[3];
assert_equals(img.id, "test3");
assert_false("test3" in document, '"test3" in document should be false');
assert_equals(document.test3, undefined);
}, "If there is one img, it should not be returned (id)");
test(function() {
var img1 = document.getElementsByTagName("img")[4];
assert_equals(img1.id, "test4");
var img2 = document.getElementsByTagName("img")[5];
assert_equals(img2.id, "test4");
assert_false("test4" in document, '"test4" in document should be false');
var collection = document.test4;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [img1, img2]);
}, "If there are two imgs, nothing should be returned. (id)");
test(function() {
var img1 = document.getElementsByTagName("img")[6];
assert_equals(img1.name, "test5");
var img2 = document.getElementsByTagName("img")[7];
assert_equals(img2.id, "test5");
assert_true("test5" in document, '"test5" in document should be true');
assert_equals(document.test5, img1);
}, "If there are two imgs, the one with a name should be returned. (name and id)");
test(function() {
var img1 = document.getElementsByTagName("img")[8];
assert_equals(img1.id, "test6");
var img2 = document.getElementsByTagName("img")[9];
assert_equals(img2.name, "test6");
assert_true("test6" in document, '"test6" in document should be true');
assert_equals(document.test6, img2);
}, "If there are two imgs, the one with a name should be returned. (id and name)");
test(function() {
var img = document.getElementsByTagName("img")[10];
assert_equals(img.id, "test7");
assert_true("test7" in document, '"test7" in document should be true');
assert_equals(document.test7, img);
}, "A name should affect getting an img by id");
test(function() {
var img = document.getElementsByTagName("img")[11];
assert_equals(img.name, "test8");
assert_true("test8" in document, '"test8" in document should be true');
assert_equals(document.test8, img);
}, "An id shouldn't affect getting an img by name");
</script>

View File

@ -8,6 +8,7 @@ DIRS += [
'failures/editing/conformancetest',
'failures/editing/selecttest',
'failures/html/html/browsers/the-window-object',
'failures/html/html/browsers/the-window-object/named-access-on-the-window-object',
'failures/html/html/dom/documents/dom-tree-accessors',
'failures/html/html/dom/documents/dom-tree-accessors/document.getElementsByName',
'failures/html/html/dom/elements/global-attributes',