Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Third and final batch: semantics #16

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/css-red.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
html { color: red; }
16 changes: 16 additions & 0 deletions common/propdesc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function assert_data_propdesc(pd, Writable, Enumerable, Configurable) {
assert_equals(typeof pd, "object");
assert_equals(pd.writable, Writable);
assert_equals(pd.enumerable, Enumerable);
assert_equals(pd.configurable, Configurable);
}

function assert_accessor_propdesc(pd, hasSetter, Enumerable, Configurable) {
assert_equals(typeof pd, "object");
assert_equals(typeof pd.get, "function");
assert_equals("set" in pd, hasSetter,
"Should have a setter for writable and replaceable attributes");
assert_equals(typeof pd.set, hasSetter ? "function" : "undefined");
assert_equals(pd.enumerable, Enumerable);
assert_equals(pd.configurable, Configurable);
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link rel="help" href="http://dev.w3.org/2006/webapi/WebIDL/#es-stringifier">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../support/stringifiers.js></script>
<script src=../../../../common/stringifiers.js></script>
<div id=log></div>
<script>
test_stringifier_attribute(location, "href");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!doctype html>
<meta charset=utf-8>
<title>window.constructor</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">
<link rel="help" href="http://dev.w3.org/2006/webapi/WebIDL/#interface-prototype-object">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../common/propdesc.js"></script>
<div id=log></div>
<iframe name="constructor"></iframe>
<script>
test(function() {
assert_equals(window.constructor, Window);
assert_false(window.hasOwnProperty("constructor"), "window.constructor should not be an own property.");

var proto = Object.getPrototypeOf(window);
assert_equals(proto.constructor, Window);
assert_true("constructor" in proto, "constructor in proto");
assert_data_propdesc(Object.getOwnPropertyDescriptor(proto, "constructor"),
true, false, true);

var gsp = Object.getPrototypeOf(proto);
assert_true("constructor" in gsp, "constructor in gsp");
assert_true(gsp.hasOwnProperty("constructor"), "gsp.hasOwnProperty(\"constructor\")");
assert_data_propdesc(Object.getOwnPropertyDescriptor(gsp, "constructor"),
false, true, true);
}, "constructor should be an own property of the interface prototype object");
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@
<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>
<script src="../../../../common/propdesc.js"></script>
<div id=log></div>
<iframe name="bar"></iframe>
<iframe name="constructor"></iframe>
<script>
function assert_data_propdesc(pd, Writable, Enumerable, Configurable) {
assert_equals(typeof pd, "object");
assert_equals(pd.writable, Writable);
assert_equals(pd.enumerable, Enumerable);
assert_equals(pd.configurable, Configurable);
}
test(function() {
assert_true("bar" in window, "bar not in window");
assert_equals(window["bar"],
Expand All @@ -33,22 +28,6 @@
assert_data_propdesc(Object.getOwnPropertyDescriptor(gsp, "bar"),
false, true, true);
}, "Static name on the prototype");
test(function() {
assert_equals(window.constructor, Window);
assert_false(window.hasOwnProperty("constructor"), "window.constructor should not be an own property.");

var proto = Object.getPrototypeOf(window);
assert_equals(proto.constructor, Window);
assert_true("constructor" in proto, "constructor in proto");
assert_data_propdesc(Object.getOwnPropertyDescriptor(proto, "constructor"),
true, false, true);

var gsp = Object.getPrototypeOf(proto);
assert_true("constructor" in gsp, "constructor in gsp");
assert_true(gsp.hasOwnProperty("constructor"), "gsp.hasOwnProperty(\"constructor\")");
assert_data_propdesc(Object.getOwnPropertyDescriptor(gsp, "constructor"),
false, true, true);
}, "constructor");
var t = async_test("Dynamic name")
var t2 = async_test("Ghost name")
t.step(function() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<meta charset=utf-8>
<title>Setting properties of the named properties object</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>
<script src="../../../../common/propdesc.js"></script>
<div id=log></div>
<script>
test(function() {
var proto = Object.getPrototypeOf(window);
var gsp = Object.getPrototypeOf(proto);
gsp.foo = "bar";

assert_equals(window.foo, "bar", "Property should be visible on the window.");
assert_equals(proto.foo, "bar", "Property should be visible on the interface prototype object.");
assert_equals(gsp.foo, "bar", "Property should be visible on the named properties object.");
}, "constructor should be an own property of the interface prototype object");
</script>
17 changes: 1 addition & 16 deletions html/browsers/the-window-object/window-properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,9 @@
<link rel="help" href="http://dev.w3.org/csswg/cssom-view/#widl-def-Window">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../common/propdesc.js"></script>
<div id=log></div>
<script>
function assert_data_propdesc(pd, Writable, Enumerable, Configurable) {
assert_equals(typeof pd, "object");
assert_equals(pd.writable, Writable);
assert_equals(pd.enumerable, Enumerable);
assert_equals(pd.configurable, Configurable);
}
function assert_accessor_propdesc(pd, hasSetter, Enumerable, Configurable) {
assert_equals(typeof pd, "object");
assert_equals(typeof pd.get, "function");
assert_equals("set" in pd, hasSetter,
"Should have a setter for writable and replaceable attributes");
assert_equals(typeof pd.set, hasSetter ? "function" : "undefined");
assert_equals(pd.enumerable, Enumerable);
assert_equals(pd.configurable, Configurable);
}

var unforgeableAttributes = [
"window",
"document",
Expand Down
2 changes: 2 additions & 0 deletions html/dom/documents/dom-tree-accessors/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ document.title-06.html
document.title-07.html
Element.getElementsByClassName-null-undef.html
nameditem-01.html
nameditem-02.html
nameditem-03.html
6 changes: 3 additions & 3 deletions html/dom/documents/dom-tree-accessors/nameditem-01.html
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -15,5 +15,5 @@
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>
92 changes: 92 additions & 0 deletions html/dom/documents/dom-tree-accessors/nameditem-02.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<!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_true(collection instanceof HTMLCollection, "collection should be an HTMLCollection");
assert_array_equals(collection, [iframe1, iframe2]);
}, "If the 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_true(collection instanceof HTMLCollection, "collection should be an HTMLCollection");
assert_array_equals(collection, [iframe, img]);
}, "If the 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_true(collection instanceof HTMLCollection, "collection should be an HTMLCollection");
assert_array_equals(collection, [img, iframe]);
}, "If the 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>
103 changes: 103 additions & 0 deletions html/dom/documents/dom-tree-accessors/nameditem-03.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<!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_true(collection instanceof HTMLCollection, "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If the 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_true(collection instanceof HTMLCollection, "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If the 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_true(collection instanceof HTMLCollection, "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If the 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_true(collection instanceof HTMLCollection, "collection should be an HTMLCollection");
assert_array_equals(collection, [applet1, applet2]);
}, "If the 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 effect 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 effect getting an applet by name");
</script>
2 changes: 2 additions & 0 deletions html/rendering/non-replaced-elements/tables/MANIFEST
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
ref table-width-150percent.html == table-width-150percent-ref.html
ref table-border-1.html == table-border-1-ref.html
ref table-border-2.html != table-border-2-notref.html == table-border-2-ref.html
Loading