Update web-platform-tests to revision e8bfc205e36ad699601212cd50083870bad9a75d

This commit is contained in:
Ms2ger 2016-11-14 11:07:09 +01:00
parent 65dd6d4340
commit ccdb0a3458
1428 changed files with 118036 additions and 9786 deletions

View file

@ -4,7 +4,7 @@
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<form action="javascript:parent.events.push('submit')"></form>
<form target="test" action="javascript:parent.events.push('submit');"></form>
<a target="test" onclick="document.forms[0].submit()">Test</a>
<script>
var t = async_test(undefined, {timeout:4000});

View file

@ -16,6 +16,9 @@
onload = t.step_func_done(function() {
assert_equals(frames[0].document.documentElement.textContent,
"1", "string return should cause navigation");
// The rest of the test is disabled for now, until
// https://github.com/whatwg/html/issues/1895 gets sorted out
/*
assert_equals(frames[1].document.documentElement.textContent,
"", "number return should not cause navigation");
assert_equals(frames[2].document.documentElement.textContent,
@ -28,5 +31,6 @@
"", "null return should not cause navigation");
assert_equals(frames[6].document.documentElement.textContent,
"", "String object return should not cause navigation");
*/
});
</script>

View file

@ -0,0 +1,23 @@
<!doctype html>
<script src="history.js"></script>
<script>
onunload = function() {}
onload = function() {
if (!opener.started) {
queue_next();
} else {
opener.pages.push(id);
opener.start_test_wait();
if (!opener.gone) {
// This is meant to test that passing a string is not supported.
// According to the spec, the value passed to 'go' must be an int.
// Internet Explorer supports passing a string and will navigate
// to that Url. This test will protect against regressing in
// this area and reverting back to IE's incorrect behavior.
history.go("history_entry.html");
opener.gone = true;
}
}
};
</script>

View file

@ -0,0 +1,32 @@
<!doctype html>
<title>history.go() negative tests</title>
<link rel="author" title="John Jansen" href="mailto:johnjan@microsoft.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go">
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test(undefined, {timeout:5000});
started = false;
gone = false;
pages = []
timer = null;
start_test_wait = t.step_func(
function() {
clearTimeout(timer);
timer = setTimeout(t.step_func(
function() {
try {
assert_array_equals(pages, [3, 2, 2], "Pages opened during history navigation");
t.done();
} finally {
win.close();
}
}
), 500);
}
);
t.step(function() {win = window.open("history_entry.html?urls=history_go_to_uri-1.html,history_forward-2.html");
});
</script>

View file

@ -0,0 +1,18 @@
<!doctype html>
<meta charset=utf-8>
<title>[[SetPrototypeOf]] on a location object should return false</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
test(function() {
var origProto = Object.getPrototypeOf(location);
assert_throws(new TypeError, function() {
Object.setPrototypeOf(location, {});
});
assert_throws(new TypeError, function() {
location.__proto__ = {};
});
assert_false(Reflect.setPrototypeOf(location, {}));
assert_equals(Object.getPrototypeOf(location), origProto);
});
</script>

View file

@ -7,6 +7,8 @@
</head>
<body>
<div id="log"></div>
<iframe id="srcdoc-iframe"
srcdoc="<div style='height: 200vh'></div><div id='test'></div>"></iframe>
<script>
test(function () {
window.history.pushState(1, document.title, '#x=1');
@ -15,6 +17,17 @@
assert_equals(hash, "#x=1", "hash");
}, "location hash");
var t = async_test("Setting location.hash on srcdoc iframe");
addEventListener("load", t.step_func_done(function() {
var frameWin = document.getElementById("srcdoc-iframe").contentWindow;
assert_equals(frameWin.location.href, "about:srcdoc");
assert_equals(frameWin.scrollY, 0, "Should not have scrolled yet");
frameWin.location.hash = "test";
assert_equals(frameWin.location.href, "about:srcdoc#test");
assert_true(frameWin.scrollY > frameWin.innerHeight,
"Should have scrolled by more than one viewport height");
}));
</script>
</body>
</html>

View file

@ -55,7 +55,7 @@ function addTest(fun, desc) { testList.push([fun, desc]); }
addTest(function() {
// Note: we do not check location.host as its default port semantics are hard to reflect statically
assert_equals(location.hostname, host_info.ORIGINAL_HOST, 'Need to run the top-level test from domain ' + host_info.ORIGINAL_HOST);
assert_equals(location.port, host_info.HTTP_PORT, 'Need to run the top-level test from port ' + host_info.HTTP_PORT);
assert_equals(get_port(location), host_info.HTTP_PORT, 'Need to run the top-level test from port ' + host_info.HTTP_PORT);
assert_equals(B.parent, window, "window.parent works same-origin");
assert_equals(C.parent, window, "window.parent works cross-origin");
assert_equals(B.location.pathname, path, "location.href works same-origin");

View file

@ -10,9 +10,9 @@
var path = location.pathname.substring(0, location.pathname.lastIndexOf('/')) + '/frame.html';
A.location = 'frame.html';
B.location = '//{{domains[www2]}}:' + location.port + path;
C.location = '//{{domains[www2]}}:' + location.port + path;
D.location = '//{{domains[www1]}}:' + location.port + path;
B.location = '//{{domains[www2]}}:' + get_port(location) + path;
C.location = '//{{domains[www2]}}:' + get_port(location) + path;
D.location = '//{{domains[www1]}}:' + get_port(location) + path;
var loadCount = 0;
function frameLoaded() {

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<script>
window.onload = function() {
top.calledFromIframe();
}
</script>
</head>
<body>
<div id="inner">foo</div>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>DOM access in sandbox="allow-same-origin" iframe</title>
<link rel="author" title="Kinuko Yasuda" href="mailto:kinuko@chromium.org">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/master/browsers.html#sandboxing">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>DOM access in sandbox="allow-same-origin" iframe</h1>
<script type="text/javascript">
var t = async_test("DOM access in sandbox='allow-same-origin' iframe is allowed")
var called = 0;
function calledFromIframe() {
called++;
}
function loaded() {
assert_equals(document.getElementById('sandboxedframe').contentWindow.document.getElementById('inner').innerHTML, 'foo');
assert_equals(called, 0);
t.done();
}
</script>
<iframe src="/html/browsers/sandboxing/inner-iframe.html" style="visibility:hidden;display:none" sandbox="allow-same-origin" id="sandboxedframe" onload="loaded();"></iframe>
<div id="log"></div>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>Script execution in sandbox="allow-scripts" iframe</title>
<link rel="author" title="Kinuko Yasuda" href="mailto:kinuko@chromium.org">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/master/browsers.html#sandboxing">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>Script execution in sandbox="allow-scripts" iframe</h1>
<script type="text/javascript">
var t = async_test("Running script from sandbox='allow-scripts' iframe is allowed")
var called = 0;
function calledFromIframe() {
called++;
}
function loaded() {
assert_equals(called, 1);
t.done();
}
</script>
<iframe src="/html/browsers/sandboxing/inner-iframe.html" style="visibility:hidden;display:none" sandbox="allow-scripts allow-same-origin" id="sandboxedframe" onload="loaded();"></iframe>
<div id="log"></div>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Access to sandbox iframe</title>
<link rel="author" title="Kinuko Yasuda" href="mailto:kinuko@chromium.org">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/master/browsers.html#sandboxing">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>Access to sandbox iframe</h1>
<script type="text/javascript">
var t = async_test("Access to sandbox iframe is disallowed")
var called = 0;
function calledFromIframe() {
called++;
}
function loaded() {
assert_equals(document.getElementById('sandboxedframe').contentWindow.document, undefined);
assert_equals(called, 0);
t.done();
}
</script>
<iframe src="/html/browsers/sandboxing/inner-iframe.html" style="visibility:hidden;display:none" sandbox id="sandboxedframe" onload="loaded();"></iframe>
</body>
<div id="log"></div>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>Script execution in sandbox iframe</title>
<link rel="author" title="Kinuko Yasuda" href="mailto:kinuko@chromium.org">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/master/browsers.html#sandboxing">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>Script execution in sandbox iframe</h1>
<script type="text/javascript">
var t = async_test("Running script from sandbox iframe is disallowed")
var called = 0;
function calledFromIframe() {
called++;
}
function loaded() {
assert_equals(called, 0);
t.done();
}
</script>
<iframe src="/html/browsers/sandboxing/inner-iframe.html" style="visibility:hidden;display:none" sandbox id="sandboxedframe" onload="loaded();"></iframe>
<div id="log"></div>
</body>
</html>

View file

@ -33,30 +33,28 @@ test(function() {
}, "Check if the first nested browsing context is returned by window['c']");
test(function() {
assert_equals(window['a'].length, 7, "The length should be 7.");
assert_equals(window['a'].length, 5, "The length should be 5.");
assert_true(window['a'] instanceof HTMLCollection);
assert_array_equals(window['a'],
[ document.getElementById('a1'), document.getElementById('app1'),
document.getElementById('area1'), document.getElementById('embed1'),
document.getElementById('form1'), document.getElementById('img1'),
document.getElementById('obj1') ],
"The elements are not in tree order.");
document.getElementById('a1').setAttribute("name", "");
document.getElementById('area1').setAttribute("name", "");
assert_array_equals(window['a'],
[ document.getElementById('app1'), document.getElementById('embed1'),
document.getElementById('form1'), document.getElementById('img1'),
document.getElementById('obj1') ],
"Window['a'] should not contain the elements with empty name attribute.");
}, "Check if window['a'] contains all a, applet, area, embed, form, img, and object elements, and their order");
"The elements are not in tree order.");
var t = async_test("Check if window['fs'] return the frameset element with name='fs'");
document.getElementById('form1').setAttribute("name", "");
document.getElementById('embed1').setAttribute("name", "");
assert_array_equals(window['a'],
[ document.getElementById('app1'), document.getElementById('img1'),
document.getElementById('obj1') ],
"Window['a'] should not contain the elements with empty name attribute.");
}, "Check if window['a'] contains all applet, embed, form, img, and object elements, and their order");
var t = async_test("Check that window['fs'] does not return the frameset element with name='fs' (historical)");
function on_load () {
t.step(function () {
assert_equals(document.getElementById('fm2').contentWindow['fs'],
document.getElementById('fm2').contentDocument.getElementById('fs1'),
"The frameset element should be returned.");
undefined,
"The frameset element should not be returned.");
});
t.done();
}

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<script>
var channelName = location.search.substr(1);
var channel = new BroadcastChannel(channelName);
channel.postMessage({ name: window.name,
haveOpener: window.opener !== null });
window.close();
</script>

View file

@ -0,0 +1,105 @@
<!doctype html>
<meta charset=utf-8>
<title>window.open() with "noopener" tests</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var testData = [
{ testDescription: "window.open() with 'noopener' should not reuse existing target",
secondWindowFeatureString: "noopener",
shouldReuse: false },
{ testDescription: "noopener needs to be present as a token on its own",
secondWindowFeatureString: "noopener=1",
shouldReuse: true },
{ testDescription: "noopener needs to be present as a token on its own again",
secondWindowFeatureString: "noopener=0",
shouldReuse: true },
{ testDescription: "noopener needs to be present as a token on its own yet again",
secondWindowFeatureString: "make me noopener",
shouldReuse: true },
{ testDescription: "Trailing noopener should work",
secondWindowFeatureString: "abc def, \n\r noopener",
shouldReuse: false },
{ testDescription: "Leading noopener should work",
secondWindowFeatureString: "noopener \f\t , hey, there",
shouldReuse: false },
{ testDescription: "Interior noopener should work",
secondWindowFeatureString: "and now, noopener , hey, there",
shouldReuse: false },
];
var tests = [];
/**
* Loop over our testData array and kick off an async test for each entry. Each
* async test opens a window using window.open() with some per-test unique name,
* then tries to do a second window.open() call with the same name and the
* test-specific feature string. It then checks whether that second
* window.open() call reuses the existing window, whether the return value of
* the second window.open() call is correct (it should be null in the noopener
* cases and non-null in the cases when the existing window gets reused) and so
* forth.
*/
for (var i = 0; i < testData.length; ++i) {
var test = testData[i];
var t = async_test(test.testDescription);
tests.push(t);
t.secondWindowFeatureString = test.secondWindowFeatureString;
t.windowName = "someuniquename" + i;
if (test.shouldReuse) {
t.step(function() {
var windowName = this.windowName;
var w1 = window.open("", windowName);
this.add_cleanup(function() { w1.close(); });
assert_equals(w1.opener, window);
var w2 = window.open("", windowName, this.secondWindowFeatureString);
assert_equals(w2, w1);
assert_equals(w2.opener, w1.opener);
assert_equals(w2.opener, window);
this.done();
});
} else {
t.step(function() {
var w1;
this.add_cleanup(function() { w1.close(); });
var windowName = this.windowName;
var channel = new BroadcastChannel(windowName);
channel.onmessage = this.step_func_done(function(e) {
var data = e.data;
assert_equals(data.name, windowName, "Should have the right name");
assert_equals(data.haveOpener, false, "Should not have opener");
assert_equals(w1.opener, window);
assert_equals(w1.location.href, "about:blank");
});
w1 = window.open("", windowName);
assert_equals(w1.opener, window);
var w2 = window.open("support/noopener-target.html?" + windowName,
windowName, this.secondWindowFeatureString);
assert_equals(w2, null);
assert_equals(w1.opener, window);
});
}
}
/**
* Loop over the special targets that ignore noopener and check that doing a
* window.open() with those targets correctly reuses the existing window.
*/
for (var target of ["_self", "_parent", "_top"]) {
var t = async_test("noopener window.open targeting " + target);
tests.push(t);
t.openedWindow = window.open(`javascript:var w2 = window.open("", "${target}", "noopener"); this.checkValues(w2); this.close(); void(0);`);
assert_equals(t.openedWindow.opener, window);
t.openedWindow.checkValues = t.step_func_done(function(win) {
assert_equals(win, this.openedWindow);
});
}
</script>

View file

@ -0,0 +1,3 @@
<meta charset=utf-8>
<p>Follow this link to open a new browsing context in a separate origin.
<a target=second href="{{location[scheme]}}://{{domains[www2]}}:{{location[port]}}/html/browsers/windows/support-open-cross-origin.sub.html">link</a>.

View file

@ -0,0 +1,9 @@
<meta charset=utf-8>
<p>Follow this link to open a new browsing context in a separate origin. Follow the instructions
in that new window, and then come back to this window.
<a target=first href="{{location[scheme]}}://{{domains[天気の良い日]}}:{{location[port]}}/html/browsers/windows/support-open-cross-origin.sub.html">link</a>.
<p>Once you come back to this page, follow this link.
<a target=second href="support-window-name-echo.html">link</a>.
<p>After clicking that link, you should have three additional windows open.

View file

@ -56,11 +56,11 @@ test(function() {
// http://heycam.github.io/webidl/#property-enumeration
// If the object supports indexed properties, then the objects supported
// property indices are enumerated first, in numerical order.
assert_array_equals(result.splice(0, 2), ["0", "1", "2"]);
assert_array_equals(result.splice(0, 3), ["0", "1", "2"]);
// [...]
// Finally, any enumerable own properties or properties from the objects
// prototype chain are then enumerated, in no defined order.
assert_array_equals(result.sort(), ["0", "1", "2", "item", "namedItem", "length"].sort())
assert_array_equals(result.sort(), ["item", "namedItem", "length"].sort())
}, "document.forms iteration")
test(function() {

View file

@ -726,7 +726,6 @@ interface CSSStyleDeclaration {
attribute DOMString marginRight;
attribute DOMString marginBottom;
attribute DOMString marginLeft;
attribute DOMString markerOffset;
attribute DOMString marks;
attribute DOMString maxHeight;
attribute DOMString maxWidth;
@ -883,7 +882,7 @@ interface HTMLAllCollection {
interface HTMLFormControlsCollection : HTMLCollection {
// inherits length and item()
legacycaller getter (RadioNodeList or Element)? namedItem(DOMString name); // shadows inherited namedItem()
getter (RadioNodeList or Element)? namedItem(DOMString name); // shadows inherited namedItem()
};
interface RadioNodeList : NodeList {
@ -891,13 +890,12 @@ interface RadioNodeList : NodeList {
};
interface HTMLOptionsCollection : HTMLCollection {
// inherits item()
attribute unsigned long length; // shadows inherited length
legacycaller HTMLOptionElement? (DOMString name);
setter creator void (unsigned long index, HTMLOptionElement? option);
void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
void remove(long index);
attribute long selectedIndex;
// inherits item(), namedItem()
attribute unsigned long length; // shadows inherited length
[CEReactions] setter void (unsigned long index, HTMLOptionElement? option);
[CEReactions] void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
[CEReactions] void remove(long index);
attribute long selectedIndex;
};
typedef sequence<any> PropertyValueArray;
@ -1179,7 +1177,6 @@ interface HTMLEmbedElement : HTMLElement {
attribute DOMString width;
attribute DOMString height;
Document getSVGDocument();
legacycaller any (any... arguments);
// also has obsolete members
};
@ -1203,8 +1200,6 @@ interface HTMLObjectElement : HTMLElement {
boolean reportValidity();
void setCustomValidity(DOMString error);
legacycaller any (any... arguments);
// also has obsolete members
};
@ -2628,9 +2623,9 @@ interface MessageEvent : Event {
readonly attribute DOMString origin;
readonly attribute DOMString lastEventId;
readonly attribute (WindowProxy or MessagePort)? source;
readonly attribute MessagePort[]? ports;
readonly attribute FrozenArray<MessagePort> ports;
void initMessageEvent(DOMString typeArg, boolean canBubbleArg, boolean cancelableArg, any dataArg, DOMString originArg, DOMString lastEventIdArg, (WindowProxy or MessagePort) sourceArg, MessagePort[]? portsArg);
void initMessageEvent(DOMString type, boolean bubbles, boolean cancelable, any data, DOMString origin, DOMString lastEventId, (WindowProxy or MessagePort) source, sequence<MessagePort> ports);
};
dictionary MessageEventInit : EventInit {

View file

@ -1,22 +1,11 @@
// We override only the things we need to -- the rest we'll just inherit from
// original-harness.js. Polymorphism, kind of.
ReflectionHarness.catchUnexpectedExceptions = false;
ReflectionHarness.conformanceTesting = true;
ReflectionHarness.test = function(expected, actual, description) {
test(function() {
assert_equals(expected, actual);
}, this.getTypeDescription() + ": " + description);
// This is the test suite that will rate conformance, so we don't want to
// bail out early if a test fails -- we want all tests to always run.
return true;
}
ReflectionHarness.run = function(fun, description) {
ReflectionHarness.test = function(fun, description) {
test(fun, this.getTypeDescription() + ": " + description);
}
ReflectionHarness.testException = function(exceptionName, fn, description) {
test(function() {
assert_throws(exceptionName, fn);
}, this.getTypeDescription() + ": " + description);
}
ReflectionHarness.assertEquals = assert_equals;
ReflectionHarness.assertThrows = assert_throws;

View file

@ -5,13 +5,10 @@ ReflectionHarness.passed = document.getElementById("passed");
ReflectionHarness.failed = document.getElementById("failed");
/**
* Should we report a failure for unexpected exceptions, or just rethrow them?
* The original test framework reports an exception, but testharness.js doesn't
* want that.
*
* @public
* In conformance testing mode, all tests will be run. Otherwise, we'll skip
* tests for attributes that have an entirely incorrect type.
*/
ReflectionHarness.catchUnexpectedExceptions = true;
ReflectionHarness.conformanceTesting = false;
/**
* Returns a string representing val. Basically just adds quotes for strings,
@ -86,12 +83,28 @@ ReflectionHarness.stringRep = function(val) {
ReflectionHarness.currentTestInfo = {};
/**
* This is called when we want to test a single element/attribute combination.
* For the original harness, it does nothing special (just calls the function),
* but for testharness.js, it can wrap everything in a test() call.
* .test() sets this, and it's used by .assertEquals()/.assertThrows().
* Calling .test() recursively is an error.
*/
ReflectionHarness.testWrapper = function(fn) {
fn();
ReflectionHarness.currentTestDescription = null;
/**
* Run a group of one or more assertions. If any exceptions are thrown, catch
* them and report a failure.
*/
ReflectionHarness.test = function(fn, description) {
if (this.currentTestDescription) {
throw "TEST BUG: test() may not be called recursively!";
}
this.currentTestDescription = description;
try {
fn();
// Not throwing is a success
this.success();
} catch(err) {
this.failure("Exception thrown during tests with " + description);
}
this.currentTestDescription = null;
}
/**
@ -102,37 +115,29 @@ ReflectionHarness.testWrapper = function(fn) {
*
* @public
*/
ReflectionHarness.test = function(expected, actual, description) {
ReflectionHarness.assertEquals = function(expected, actual, description) {
// Special-case -0 yay!
if (expected === 0 && actual === 0 && 1/expected === 1/actual) {
this.increment(this.passed);
return true;
} else if (expected === actual) {
this.increment(this.passed);
return true;
} else {
this.increment(this.failed);
this.reportFailure(description + ' (expected ' + this.stringRep(actual) + ', got ' + this.stringRep(expected) + ')');
return false;
}
}
ReflectionHarness.run = function(fun, description) {
try {
fun();
} catch (err) {
ReflectionHarness.failure(description);
this.reportFailure(this.currentTestDescription +
(description ? " followed by " + description : "") +
' (expected ' + this.stringRep(actual) + ', got ' +
this.stringRep(expected) + ')');
}
}
/**
* If calling fn causes a DOMException of the type given by the string
* exceptionName (e.g., "INDEX_SIZE_ERR"), output a success. Otherwise, report
* a failure with the given description.
* exceptionName (e.g., "IndexSizeError"), output a success. Otherwise, report
* a failure.
*
* @public
*/
ReflectionHarness.testException = function(exceptionName, fn, description) {
ReflectionHarness.assertThrows = function(exceptionName, fn) {
try {
fn();
} catch (e) {
@ -142,7 +147,8 @@ ReflectionHarness.testException = function(exceptionName, fn, description) {
}
}
this.increment(this.failed);
this.reportFailure(description);
this.reportFailure(this.currentTestDescription + " must throw " +
exceptionName);
return false;
}
@ -248,9 +254,9 @@ ReflectionHarness.reportFailure = function(description) {
}
/**
* Shorthand function for when we have a failure outside of test(). Generally
* used when the failure is an exception thrown unexpectedly or such, something
* not equality-based.
* Shorthand function for when we have a failure outside of
* assertEquals()/assertThrows(). Generally used when the failure is an
* exception thrown unexpectedly or such, something not equality-based.
*
* @public
*/
@ -260,8 +266,8 @@ ReflectionHarness.failure = function(message) {
}
/**
* Shorthand function for when we have a success outside of test(). Only
* called if catchUnexpectedExceptions is true.
* Shorthand function for when we have a success outside of
* assertEquals()/assertThrows().
*
* @public
*/

View file

@ -567,15 +567,6 @@ ReflectionTests.reflects = function(data, idlName, idlObj, domName, domObj) {
// probably safe enough. Just don't read stuff that will change.
ReflectionHarness.currentTestInfo = {data: data, idlName: idlName, idlObj: idlObj, domName: domName, domObj: domObj};
ReflectionHarness.testWrapper(function() {
ReflectionTests.doReflects(data, idlName, idlObj, domName, domObj);
});
};
/**
* Actual implementation of the above.
*/
ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
// If we don't recognize the type, testing is impossible.
if (this.typeMap[data.type] === undefined) {
if (unimplemented.indexOf(data.type) == -1) {
@ -591,9 +582,15 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
}
// Test that typeof idlObj[idlName] is correct. If not, further tests are
// probably pointless, so bail out.
var isDefaultValueNull = data.isNullable && data.defaultVal === null;
if (!ReflectionHarness.test(typeof idlObj[idlName], isDefaultValueNull ? "object" : typeInfo.jsType, "typeof IDL attribute")) {
// probably pointless, so bail out if we're not running conformance tests.
var expectedType = data.isNullable && data.defaultVal === null ? "object"
: typeInfo.jsType;
ReflectionHarness.test(function() {
ReflectionHarness.assertEquals(typeof idlObj[idlName], expectedType);
}, "typeof IDL attribute");
if (!ReflectionHarness.conformanceTesting &&
typeof idlObj[idlName] !== expectedType) {
return;
}
@ -603,7 +600,9 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
defaultVal = typeInfo.defaultVal;
}
if (defaultVal !== null || data.isNullable) {
ReflectionHarness.test(idlObj[idlName], defaultVal, "IDL get with DOM attribute unset");
ReflectionHarness.test(function() {
ReflectionHarness.assertEquals(idlObj[idlName], defaultVal);
}, "IDL get with DOM attribute unset");
}
var domTests = typeInfo.domTests.slice(0);
@ -704,50 +703,42 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
// the test.
continue;
}
try {
ReflectionHarness.test(function() {
domObj.setAttribute(domName, domTests[i]);
ReflectionHarness.test(domObj.getAttribute(domName), String(domTests[i]), "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by getAttribute()");
ReflectionHarness.test(idlObj[idlName], domExpected[i], "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by IDL get");
if (ReflectionHarness.catchUnexpectedExceptions) {
ReflectionHarness.success();
}
} catch (err) {
if (ReflectionHarness.catchUnexpectedExceptions) {
ReflectionHarness.failure("Exception thrown during tests with setAttribute() to " + ReflectionHarness.stringRep(domTests[i]));
} else {
throw err;
}
}
ReflectionHarness.assertEquals(domObj.getAttribute(domName),
String(domTests[i]), "getAttribute()");
ReflectionHarness.assertEquals(idlObj[idlName], domExpected[i],
"IDL get");
}, "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]));
}
}
for (var i = 0; i < idlTests.length; i++) {
if ((data.type == "limited long" && idlTests[i] < 0) ||
(data.type == "limited unsigned long" && idlTests[i] == 0)) {
ReflectionHarness.testException("INDEX_SIZE_ERR", function() {
idlObj[idlName] = idlTests[i];
}, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " must throw INDEX_SIZE_ERR");
} else {
ReflectionHarness.run(function() {
ReflectionHarness.test(function() {
if ((data.type == "limited long" && idlTests[i] < 0) ||
(data.type == "limited unsigned long" && idlTests[i] == 0)) {
ReflectionHarness.assertThrows("IndexSizeError", function() {
idlObj[idlName] = idlTests[i];
});
} else {
idlObj[idlName] = idlTests[i];
if (data.type == "boolean") {
// Special case yay
ReflectionHarness.test(domObj.hasAttribute(domName), Boolean(idlTests[i]), "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by hasAttribute()");
ReflectionHarness.assertEquals(domObj.hasAttribute(domName),
Boolean(idlTests[i]), "hasAttribute()");
} else if (idlDomExpected[i] !== null || data.isNullable) {
var expected = idlDomExpected[i] + "";
if (data.isNullable && idlDomExpected[i] === null) {
expected = null;
}
ReflectionHarness.test(domObj.getAttribute(domName), expected, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by getAttribute()");
ReflectionHarness.assertEquals(domObj.getAttribute(domName), expected,
"getAttribute()");
}
if (idlIdlExpected[i] !== null || data.isNullable) {
ReflectionHarness.test(idlObj[idlName], idlIdlExpected[i], "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by IDL get");
ReflectionHarness.assertEquals(idlObj[idlName], idlIdlExpected[i], "IDL get");
}
if (ReflectionHarness.catchUnexpectedExceptions) {
ReflectionHarness.success();
}
}, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " should not throw");
}
}
}, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]));
}
};

View file

@ -0,0 +1,5 @@
<!doctype html>
<title>Interaction of UI input and the click in progress flag</title>
<p>When you mouse click the checkbox below it should not be checked:</p>
<p><input type=checkbox onclick=this.click()></p>
<p>Now keyboard "click" the checkbox and confirm it's still not checked.</p>

View file

@ -4,7 +4,8 @@
<meta charset='utf-8'>
<title>HTML Test: dropzone_attribute_data_item_kind_string</title>
<link rel='author' title='Intel' href='http://www.intel.com'>
<link rel='help' href='http://www.w3.org/html/editing/dnd/the-datatransfer-interface/'>
<link rel='author' title='Domenic Denicola' href='mailto:d@domenic.com'>
<link rel='help' href='https://html.spec.whatwg.org/multipage/#the-datatransfer-interface'>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<style>
@ -37,6 +38,27 @@
test(function() {
assert_equals(event.dataTransfer.effectAllowed, 'uninitialized');
}, 'effectAllowed should be "uninitialized"');
test(function() {
assert_equals(event.dataTransfer.types.constructor, Array, 'should be an array');
assert_true(Object.isFrozen(event.dataTransfer.types), 'should be frozen');
}, 'types should be a frozen array');
test(function() {
assert_false('contains' in event.dataTransfer.types);
assert_false('item' in event.dataTransfer.types);
}, 'types should not have any of the historical methods');
test(function() {
assert_equals(event.dataTransfer.types, event.dataTransfer.types);
}, 'types should return the same object from multiple reads (assuming no changes)');
test(function() {
var before = event.dataTransfer.types;
event.dataTransfer.clearData();
assert_not_equals(event.dataTransfer.types, before);
}, 'types should return a different object after changes');
done();
});
</script>

View file

@ -0,0 +1,71 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Focus fixup rule one (no &lt;dialog>s involved)</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule-one">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div>
<button id="button1">Button 1</button>
<button id="button2">Button 2</button>
<button id="button3">Button 3</button>
<div id="div" tabindex="0">Div</div>
</div>
<script>
"use strict";
async_test(t => {
const button = document.querySelector("#button1");
button.focus();
assert_equals(document.activeElement, button, "Sanity check: the button must start focused");
button.disabled = true;
assert_not_equals(document.activeElement, button, "After disabling, the button must no longer be focused");
assert_equals(document.activeElement, document.body, "After disabling, the body must be focused");
}, "Disabling the active element (making it expressly inert)");
test(() => {
const button = document.querySelector("#button2");
button.focus();
assert_equals(document.activeElement, button, "Sanity check: the button must start focused");
button.hidden = true;
assert_not_equals(document.activeElement, button, "After hiding, the button must no longer be focused");
assert_equals(document.activeElement, document.body, "After hiding, the body must be focused");
}, "Hiding the active element");
test(() => {
const button = document.querySelector("#button3");
button.focus();
assert_equals(document.activeElement, button, "Sanity check: the button must start focused");
button.remove();
assert_not_equals(document.activeElement, button, "After removing, the button must no longer be focused");
assert_equals(document.activeElement, document.body, "After removing, the body must be focused");
}, "Removing the active element from the DOM");
test(() => {
const div = document.querySelector("#div");
div.focus();
assert_equals(document.activeElement, div, "Sanity check: the div must start focused");
div.removeAttribute("tabindex");
assert_not_equals(document.activeElement, div, "After removing tabindex, the div must no longer be focused");
assert_equals(document.activeElement, document.body, "After removing tabindex, the body must be focused");
}, "Removing the tabindex attribute from a div");
</script>

View file

@ -0,0 +1,25 @@
<!doctype html>
<title>Historical HTML*Collection features should not be supported</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<form id=form><input name=foo></form>
<select id=select><option name=bar></select>
<script>
test(function() {
var collection = document.getElementById('form').elements;
assert_equals(typeof collection, 'object', 'typeof');
assert_throws(new TypeError(), function() {
collection('foo');
});
}, 'HTMLFormControlsCollection legacycaller should not be supported');
test(function() {
var collection = document.getElementById('select').options;
assert_equals(typeof collection, 'object', 'typeof');
assert_throws(new TypeError(), function() {
collection('bar');
});
}, 'HTMLOptionsCollection legacycaller should not be supported');
</script>

View file

@ -3,7 +3,8 @@
<head>
<title>HTMLAllCollection Tests</title>
<link rel="author" title="Dan Druta" href="mailto:dan.druta@att.com"/>
<link rel="help" href="2.7.2.1 - Common Infrastructure/Common DOM Interfaces/Collections/HTMLAllCollection"/>
<link rel="author" title="Philip Jägenstedt" href="mailto:philip@foolip.org"/>
<link rel="help" href="https://html.spec.whatwg.org/multipage/infrastructure.html#the-htmlallcollection-interface"/>
<meta name="flags" content="TOKENS" />
<meta name="assert" content="TEST ASSERTION"/>
<script src="/resources/testharness.js"></script>
@ -13,34 +14,249 @@
<img src="../../../../images/green.png" name="picture">
<a name="foo"></a>
<a name="foo"></a>
<span id="42"></span>
<span id="043"></span>
<div id="4294967294"></div>
<div id="4294967295"></div>
<div id="4294967296"></div>
<script>
test(function(){ assert_equals(document.all.length,14)}, "Test for HTMLAllCollection size");
var anchors = document.querySelectorAll("a");
var divs = document.querySelectorAll("div");
var scripts = document.querySelectorAll("script");
var spans = document.querySelectorAll("span");
test(function(){ assert_equals(document.all.item(0).tagName,"HTML")}, "Test lookup by index using ()");
test(function() {
assert_true(document.all instanceof HTMLAllCollection);
}, "document.all is an HTMLAllCollection");
test(function(){ assert_equals(document.all[0].tagName,"HTML")}, "Test lookup by index using []");
test(function() {
assert_equals(document.all.length, 20);
}, "length attribute");
test(function(){ assert_equals(document.all.item("picture").nodeName,"IMG")}, "Test lookup IMG by name");
// indexed property getter
test(function(){ assert_equals(document.all.namedItem("picture").nodeName,"IMG")}, "Test lookup IMG by namedItem ");
test(function() {
assert_equals(document.all[0], document.documentElement);
assert_equals(document.all[19], scripts[2]);
}, "indexed property getter");
test(function(){ assert_equals(document.all("picture").nodeName,"IMG")}, "Test lookup IMG in collection using ()");
test(function() {
assert_equals(document.all[-1], undefined);
assert_equals(document.all[20], undefined);
assert_equals(document.all[42], undefined);
assert_equals(document.all[43], undefined);
assert_equals(document.all[4294967294], undefined);
assert_equals(document.all[4294967295], divs[1]);
assert_equals(document.all[4294967296], divs[2]);
}, "indexed property getter out of range");
test(function(){ assert_equals(document.all["picture"].nodeName,"IMG")}, "Test lookup IMG in collection using []");
test(function(){ assert_equals(document.all.picture.nodeName,"IMG")}, "Test lookup IMG in collection using .");
test(function(){ assert_equals(document.all.tags.id,"tags")}, "Test lookup tags in collection using .");
// named property getter
test(function() {
assert_equals(document.all["root"], document.documentElement);
}, "Should find root element too");
assert_equals(document.all["flags"].content, "TOKENS");
assert_equals(document.all["picture"].tagName, "IMG");
}, "named property getter");
test(function() {
assert_equals(document.all["foo"].length, 2);
}, "Should find both anchors and produce a list");
assert_equals(document.all.root, document.documentElement);
assert_equals(document.all.flags.content, "TOKENS");
assert_equals(document.all.picture.tagName, "IMG");
}, "named property getter with dot syntax");
test
test(function() {
assert_equals(document.all["noname"], undefined);
assert_equals(document.all.noname, undefined);
}, "named property getter with invalid name");
test(function() {
var collection = document.all["foo"];
assert_equals(collection.length, 2);
assert_equals(collection[0], anchors[0]);
assert_equals(collection[1], anchors[1]);
}, "named property getter returning collection");
test(function() {
assert_equals(document.all["0"], document.documentElement);
assert_equals(document.all["19"], document.scripts[2]);
assert_equals(document.all["20"], undefined);
assert_equals(document.all["42"], undefined);
assert_equals(document.all["43"], undefined);
}, "named property getter with \"array index property name\"");
test(function() {
assert_equals(document.all["00"], undefined);
assert_equals(document.all["042"], undefined);
assert_equals(document.all["043"], spans[1]);
assert_equals(document.all["4294967294"], undefined);
assert_equals(document.all["4294967295"], divs[1]);
assert_equals(document.all["4294967296"], divs[2]);
}, "named property getter with invalid \"array index property name\"");
// namedItem method
test(function() {
assert_equals(document.all.namedItem("root"), document.documentElement);
assert_equals(document.all.namedItem("flags").content, "TOKENS");
assert_equals(document.all.namedItem("picture").tagName, "IMG");
}, "namedItem method");
test(function() {
assert_equals(document.all.namedItem("noname"), null);
}, "namedItem method with invalid name");
test(function() {
var collection = document.all.namedItem("foo");
assert_equals(collection.length, 2);
assert_equals(collection[0], anchors[0]);
assert_equals(collection[1], anchors[1]);
}, "namedItem method returning collection");
test(function() {
assert_equals(document.all.namedItem("0"), null);
assert_equals(document.all.namedItem("19"), null);
assert_equals(document.all.namedItem("20"), null);
assert_equals(document.all.namedItem("42"), spans[0]);
assert_equals(document.all.namedItem("43"), null);
}, "namedItem method with \"array index property name\"");
test(function() {
assert_equals(document.all.namedItem("00"), null);
assert_equals(document.all.namedItem("042"), null);
assert_equals(document.all.namedItem("043"), spans[1]);
assert_equals(document.all.namedItem("4294967294"), divs[0]);
assert_equals(document.all.namedItem("4294967295"), divs[1]);
assert_equals(document.all.namedItem("4294967296"), divs[2]);
}, "namedItem method with invalid \"array index property name\"");
test(function() {
assert_equals(document.all.namedItem.length, 1);
assert_throws(new TypeError, function() {
document.all.namedItem();
});
}, "namedItem method with no argument");
// legacy caller
test(function() {
assert_equals(document.all("root"), document.documentElement);
assert_equals(document.all("flags").content, "TOKENS");
assert_equals(document.all("picture").tagName, "IMG");
}, "legacy caller");
test(function() {
assert_equals(document.all("noname"), null);
}, "legacy caller with invalid name");
test(function() {
var collection = document.all("foo");
assert_equals(collection.length, 2);
assert_equals(collection[0], anchors[0]);
assert_equals(collection[1], anchors[1]);
}, "legacy caller returning collection");
test(function() {
assert_equals(document.all("0"), document.documentElement);
assert_equals(document.all("19"), document.scripts[2]);
assert_equals(document.all("20"), null);
assert_equals(document.all("42"), null);
assert_equals(document.all("43"), null);
}, "legacy caller with \"array index property name\"");
test(function() {
assert_equals(document.all(0), document.documentElement);
assert_equals(document.all(19), document.scripts[2]);
assert_equals(document.all(20), null);
assert_equals(document.all(42), null);
assert_equals(document.all(43), null);
}, "legacy caller with \"array index property name\" as number");
test(function() {
assert_equals(document.all("00"), null);
assert_equals(document.all("042"), null);
assert_equals(document.all("043"), spans[1]);
assert_equals(document.all("4294967294"), null);
assert_equals(document.all("4294967295"), divs[1]);
assert_equals(document.all("4294967296"), divs[2]);
}, "legacy caller with invalid \"array index property name\"");
test(function() {
assert_equals(document.all(), null);
}, "legacy caller with no argument");
// item method
test(function() {
assert_equals(document.all.item("root"), document.documentElement);
assert_equals(document.all.item("flags").content, "TOKENS");
assert_equals(document.all.item("picture").tagName, "IMG");
}, "item method");
test(function() {
assert_equals(document.all.item("noname"), null);
}, "item method with invalid name");
test(function() {
var collection = document.all.item("foo");
assert_equals(collection.length, 2);
assert_equals(collection[0], anchors[0]);
assert_equals(collection[1], anchors[1]);
}, "item method returning collection");
test(function() {
assert_equals(document.all.item("0"), document.documentElement);
assert_equals(document.all.item("19"), document.scripts[2]);
assert_equals(document.all.item("20"), null);
assert_equals(document.all.item("42"), null);
assert_equals(document.all.item("43"), null);
}, "item method with \"array index property name\"");
test(function() {
assert_equals(document.all.item(0), document.documentElement);
assert_equals(document.all.item(19), document.scripts[2]);
assert_equals(document.all.item(20), null);
assert_equals(document.all.item(42), null);
assert_equals(document.all.item(43), null);
}, "item method with \"array index property name\" as number");
test(function() {
assert_equals(document.all.item("00"), null);
assert_equals(document.all.item("042"), null);
assert_equals(document.all.item("043"), spans[1]);
assert_equals(document.all.item("4294967294"), null);
assert_equals(document.all.item("4294967295"), divs[1]);
assert_equals(document.all.item("4294967296"), divs[2]);
}, "item method with invalid \"array index property name\"");
test(function() {
assert_equals(document.all.item.length, 0);
assert_equals(document.all.item(), null);
}, "item method with no argument");
// live HTMLCollection
test(function() {
var collections = [
document.all["foo"],
document.all.namedItem("foo"),
document.all("foo"),
document.all.item("foo"),
];
// a new HTMLCollection is created for each call
for (var i = 0; i < collections.length; i++) {
assert_true(collections[i] instanceof HTMLCollection);
for (var j = i + 1; j < collections.length; j++) {
assert_not_equals(collections[i], collections[j]);
}
}
for (var c of collections) {
assert_equals(c.length, 2);
}
anchors[0].name = "bar";
for (var c of collections) {
assert_equals(c.length, 1);
}
}, "collections are new live HTMLCollection instances");
</script>
<div id="log"></div>
</body>

View file

@ -13,12 +13,13 @@ test(function(){
assert_equals(ev.track, null, 'ev.track after assignment');
}, document.title+', one arg');
test(function(){
var obj = {};
var ev = new TrackEvent('foo', {track:obj});
var video = document.createElement('video');
var testTrack = video.addTextTrack('subtitles', 'foo', 'foo');
var ev = new TrackEvent('foo', {track: testTrack});
assert_true(ev instanceof TrackEvent, 'ev instanceof TrackEvent');
assert_true(ev instanceof Event, 'ev instanceof Event');
assert_equals(ev.track, obj, 'ev.track');
assert_equals(ev.track, testTrack, 'ev.track');
ev.track = {};
assert_equals(ev.track, obj, 'ev.track after assignment');
assert_equals(ev.track, testTrack, 'ev.track after assignment');
}, document.title+', two args');
</script>

View file

@ -0,0 +1,15 @@
<!doctype html>
<title>Historical embed element features should not be supported</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<embed id=embed>
<script>
test(function() {
var elm = document.getElementById('embed');
assert_equals(typeof elm, 'object', 'typeof');
assert_throws(new TypeError(), function() {
elm();
});
}, 'embed legacycaller should not be supported');
</script>

View file

@ -0,0 +1,17 @@
<!doctype html>
<meta charset=utf-8>
<title>Append iframe element to its own child document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id=x></iframe>
<script>
test(function() {
var iframe = document.getElementById('x');
var childWindow = iframe.contentWindow;
assert_equals(childWindow.parent, window);
childWindow.document.body.appendChild(iframe);
assert_equals(childWindow.parent, null);
assert_equals(iframe.contentWindow, null);
assert_equals(childWindow.document.body.firstChild, iframe);
});
</script>

View file

@ -7,9 +7,10 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe id="testIframe" src="support/sandbox_allow_script.html" sandbox="allow-same-origin" style="display:none"></iframe>
<div id="log"></div>
<script>
// Set up all our script stuff before the iframe starts loading, so we don't
// miss any messages from it.
var step1 = false;
var t = async_test("iframe_sandbox_allow_scripts");
@ -35,5 +36,11 @@
t.done();
}
setTimeout(run, 500);
// Make sure the iframe loads before we mess with it.
window.addEventListener("load", function() {
// The load event might fire before a message from the child comes in...
// Wait a bit to see if that message does come in.
setTimeout(run, 500);
});
</script>
<iframe id="testIframe" src="support/sandbox_allow_script.html" sandbox="allow-same-origin" style="display:none"></iframe>

View file

@ -19,7 +19,7 @@
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
});
document.querySelector("iframe").src = "iframe_sandbox_popups_helper.html";
document.querySelector("iframe").src = "iframe_sandbox_popups_helper-1.html";
});
postMessage("hello", "*");
</script>

View file

@ -0,0 +1,31 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe escape the sandbox if
allow-popups-to-escape-sandbox is used</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox">
</iframe>
<script>
var t = async_test();
var ourOrigin;
onmessage = t.step_func(function(e) {
assert_equals(e.data, "hello", "This is our origin getter message");
ourOrigin = e.origin;
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
});
var iframe = document.querySelector("iframe");
iframe.onload = function() {
frames[0].postMessage("start", "*");
}
iframe.src = "iframe_sandbox_popups_helper-2.html";
});
addEventListener("load", function() {
postMessage("hello", "*");
});
</script>

View file

@ -0,0 +1,25 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe escape the sandbox if
allow-popups-to-escape-sandbox is used</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox">
</iframe>
<script>
var t = async_test();
var ourOrigin;
onmessage = t.step_func(function(e) {
assert_equals(e.data, "hello", "This is our origin getter message");
ourOrigin = e.origin;
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
});
document.querySelector("iframe").src = "iframe_sandbox_popups_helper-3.html";
});
postMessage("hello", "*");
</script>

View file

@ -1,6 +1,5 @@
<!DOCTYPE html>
<script>
var popupWin;
if (opener) {
// We're the popup. Send back our state. What we really want to send is
// our origin, but that will come automatically.

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<body>
<script>
if (opener) {
// We're the popup. Send back our state. What we really want to send is
// our origin, but that will come automatically.
opener.postMessage(undefined, "*");
self.close();
} else {
// We're the child. Start listening for messages from our parent and open
// ourselves as the popup when we get the "start" message.
onmessage = function (e) {
if (e.data == "start") {
// Now listen for messages from the thing we plan to open.
onmessage = function(e) {
parent.postMessage({ data: e.data, origin: e.origin }, "*");
}
var a = document.createElement("a");
a.href = location.href;
a.target = "_blank";
document.body.appendChild(a);
a.click();
}
};
}
</script>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<script>
if (opener) {
// We're the popup. Send back our state. What we really want to send is
// our origin, but that will come automatically.
opener.postMessage(undefined, "*");
self.close();
} else {
// We're the child. Start listening for messages and open ourselves as the
// popup.
onmessage = function (e) {
parent.postMessage({ data: e.data, origin: e.origin }, "*");
};
var popupWin = window.open();
popupWin.location.href = location.href;
}
</script>

View file

@ -12,4 +12,4 @@
});
</script>
<iframe sandbox="allow-scripts allow-popups"
src="iframe_sandbox_popups_helper.html"></iframe>
src="iframe_sandbox_popups_helper-1.html"></iframe>

View file

@ -0,0 +1,18 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe do not escape the sandbox</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var t = async_test();
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, "null", "Should not have escaped the sandbox");
});
addEventListener("load", function() {
frames[0].postMessage("start", "*");
});
</script>
<iframe sandbox="allow-scripts allow-popups"
src="iframe_sandbox_popups_helper-2.html"></iframe>

View file

@ -0,0 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that popups from a sandboxed iframe do not escape the sandbox</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var t = async_test();
onmessage = t.step_func_done(function(e) {
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
assert_equals(e.data.data, undefined, "Should have the right message");
assert_equals(e.data.origin, "null", "Should not have escaped the sandbox");
});
</script>
<iframe sandbox="allow-scripts allow-popups"
src="iframe_sandbox_popups_helper-3.html"></iframe>

View file

@ -0,0 +1,22 @@
<!doctype html>
<meta charset="utf-8">
<title>data URL image</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
var c = document.createElement("canvas"),
con = c.getContext("2d"),
img = document.createElement("img")
img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAA+UlEQVR4nO3RoRHAQBDEsOu/6YR+B2sgIO4Z3919pMwDMCRtHoAhafMADEmbB2BI2jwAQ9LmARiSNg/AkLR5AIakzQMwJG0egCFp8wAMSZsHYEjaPABD0uYBGJI2D8CQtHkAhqTNAzAkbR6AIWnzAAxJmwdgSNo8AEPS5gEYkjYPwJC0eQCGpM0DMCRtHoAhafMADEmbB2BI2jwAQ9LmARiSNg/AkLR5AIakzQMwJG0egCFp8wAMSZsHYEjaPABD0uYBGJI2D8CQtHkAhqTNAzAkbR6AIWnzAAxJmwdgSNo8AEPS5gEYkjYPwJC0eQCGpM0DMCRtHsDjB5K06yueJFXJAAAAAElFTkSuQmCC"
img.onload = () => {
con.drawImage(img, 0, 0)
var data = con.getImageData(0, 0, 10, 10) // should not throw as data URLs are same-origin
for(var i = 0; i < data.data.length; i++) {
var expected = ((i+1) % 4 == 0) ? 255 : 0
assert_equals(data.data[i], expected)
}
c.toDataURL() // shouldn't throw either
done()
}
</script>

View file

@ -3,10 +3,11 @@
<title>Loading a non-parsing URL as an image should silently fail; triggering appropriate events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<img id=myimg />
<img id=brokenurl />
<img id=emptysrc />
<script>
async_test(function(t) {
var img = document.getElementById("myimg");
var img = document.getElementById("brokenurl");
img.src = "http://also a broken url";
var errorevent = false;
@ -16,6 +17,26 @@ async_test(function(t) {
img.addEventListener('loadend', t.step_func_done(function() {
assert_true(errorevent, "error event fired");
}));
});
}, 'src="http://also a broken url"');
async_test(function(t) {
var img = document.getElementById("emptysrc");
img.src = "";
var loadendevent = false;
// Setting src to empty string triggers only error event.
// The errors should be queued in the event loop, so they should only trigger
// after this block of code finishes, not during the img.src setter itself
img.addEventListener('error', t.step_func(function() {
// Queue this check in the event loop to check there is no loadend event
// fired.
t.step_timeout(t.step_func_done(function() {
assert_false(loadendevent, "loadend event should not fired");
}), 0)
}));
img.addEventListener('loadend', t.step_func(function() {
loadendevent = true;
}));
}, 'src=""');
</script>

View file

@ -0,0 +1,93 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>img usemap case-sensitive</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-a-hash-name-reference">
<!-- See also: https://github.com/whatwg/html/issues/1666 -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<img src="/images/threecolors.png" usemap="#sanityCheck" width="300" height="300">
<map name="sanityCheck"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#sImPlE" width="300" height="300">
<map name="simple"><area shape="rect" coords="0,0,300,300"></map>
<map name="SIMPLE"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#paSSfield-killroyß" width="300" height="300">
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-&#x212a;illroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paßfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#глупый" width="300" height="300">
<map name="глупы&#x438;&#x306;"><area shape="rect" coords="0,0,300,300"></map>
<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map>
<map name="ГЛУПЫ&#x418;&#x306;"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#åωk" width="300" height="300">
<map name="ÅΩK"><area shape="rect" coords="0,0,300,300"></map>
<map name="&#x212b;ωk"><area shape="rect" coords="0,0,300,300"></map>
<map name="å&#x2126;k"><area shape="rect" coords="0,0,300,300"></map>
<map name="åω&#x212a;"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#blah1" width="300" height="300">
<map name="blah&#x2460;"><area shape="rect" coords="0,0,300,300"></map>
<map name="bl&#x24b6;h1"><area shape="rect" coords="0,0,300,300"></map>
<map name="bl&#x24d0;h1"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#t&Eacute;dz5アパートFi" width="300" height="300">
<map name="T&Eacute;DZ5アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&eacute;&#x01F1;&#x2075;アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="t&Eacute;dz5&#x3300;Fi"><area shape="rect" coords="0,0,300,300"></map>
<map name="t&Eacute;dz5&#x30A2;&#x30CF;&#x309A;&#x30FC;&#x30C8;Fi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&Eacute;DZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&Eacute;DZ5アパートfi"><area shape="rect" coords="0,0,300,300"></map>
<img src="/images/threecolors.png" usemap="#ΣΣ" width="300" height="300">
<map name="σς"><area shape="rect" coords="0,0,300,300"></map>
<script>
"use strict";
setup({ explicit_done: true });
onload = () => {
test(() => {
const image = document.querySelector(`img[usemap="#sanityCheck"]`);
const imageRect = image.getBoundingClientRect();
const x = imageRect.left + imageRect.width / 2;
const y = imageRect.top + imageRect.height / 2;
const element = document.elementFromPoint(x, y);
const area = document.querySelector(`map[name="sanityCheck"] > area`);
assert_equals(element, area);
}, `Image with usemap of #sanityCheck should match the area with map named sanityCheck`);
const images = Array.from(document.querySelectorAll(`img:not([usemap="#sanityCheck"])`));
for (let image of images) {
test(() => {
const imageRect = image.getBoundingClientRect();
const x = imageRect.left + imageRect.width / 2;
const y = imageRect.top + imageRect.height / 2;
const element = document.elementFromPoint(x, y);
const name = element.parentElement.getAttribute("name");
const messageSuffix = name ? `; used <map> with name "${name}"` : "";
assert_equals(element, image, "The element retrieved must be the image, not an area" + messageSuffix);
}, `Image with usemap of ${image.useMap} should not match any of the areas`);
}
done();
};
</script>

View file

@ -0,0 +1,15 @@
<!doctype html>
<title>Historical object element features should not be supported</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<object id=object></object>
<script>
test(function() {
var elm = document.getElementById('object');
assert_equals(typeof elm, 'object', 'typeof');
assert_throws(new TypeError(), function() {
elm();
});
}, 'object legacycaller should not be supported');
</script>

View file

@ -0,0 +1,93 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>object usemap case-sensitive</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-a-hash-name-reference">
<!-- See also: https://github.com/whatwg/html/issues/1666 -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<object data="/images/threecolors.png" usemap="#sanityCheck" width="300" height="300"></object>
<map name="sanityCheck"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#sImPlE" width="300" height="300"></object>
<map name="simple"><area shape="rect" coords="0,0,300,300"></map>
<map name="SIMPLE"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#paSSfield-killroyß" width="300" height="300"></object>
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-&#x212a;illroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paßfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#глупый" width="300" height="300"></object>
<map name="глупы&#x438;&#x306;"><area shape="rect" coords="0,0,300,300"></map>
<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map>
<map name="ГЛУПЫ&#x418;&#x306;"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#åωk" width="300" height="300"></object>
<map name="ÅΩK"><area shape="rect" coords="0,0,300,300"></map>
<map name="&#x212b;ωk"><area shape="rect" coords="0,0,300,300"></map>
<map name="å&#x2126;k"><area shape="rect" coords="0,0,300,300"></map>
<map name="åω&#x212a;"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#blah1" width="300" height="300"></object>
<map name="blah&#x2460;"><area shape="rect" coords="0,0,300,300"></map>
<map name="bl&#x24b6;h1"><area shape="rect" coords="0,0,300,300"></map>
<map name="bl&#x24d0;h1"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#t&Eacute;dz5アパートFi" width="300" height="300"></object>
<map name="T&Eacute;DZ5アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&eacute;&#x01F1;&#x2075;アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="t&Eacute;dz5&#x3300;Fi"><area shape="rect" coords="0,0,300,300"></map>
<map name="t&Eacute;dz5&#x30A2;&#x30CF;&#x309A;&#x30FC;&#x30C8;Fi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&Eacute;DZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map>
<map name="T&Eacute;DZ5アパートfi"><area shape="rect" coords="0,0,300,300"></map>
<object data="/images/threecolors.png" usemap="#ΣΣ" width="300" height="300"></object>
<map name="σς"><area shape="rect" coords="0,0,300,300"></map>
<script>
"use strict";
setup({ explicit_done: true });
onload = () => {
test(() => {
const object = document.querySelector(`object[usemap="#sanityCheck"]`);
const objectRect = object.getBoundingClientRect();
const x = objectRect.left + objectRect.width / 2;
const y = objectRect.top + objectRect.height / 2;
const element = document.elementFromPoint(x, y);
const area = document.querySelector(`map[name="sanityCheck"] > area`);
assert_equals(element, area);
}, `Object with usemap of #sanityCheck should match the area with map named sanityCheck`);
const objects = Array.from(document.querySelectorAll(`object:not([usemap="#sanityCheck"])`));
for (let object of objects) {
test(() => {
const objectRect = object.getBoundingClientRect();
const x = objectRect.left + objectRect.width / 2;
const y = objectRect.top + objectRect.height / 2;
const element = document.elementFromPoint(x, y);
const name = element.parentElement.getAttribute("name");
const messageSuffix = name ? `; used <map> with name "${name}"` : "";
assert_equals(element, object, "The element retrieved must be the object, not an area" + messageSuffix);
}, `Object with usemap of ${object.useMap} should not match any of the areas`);
}
done();
};
</script>

View file

@ -15,7 +15,7 @@
types: ["text", "search", "tel", "password"],
testData: [
{conditions: {}, expected: true, name: "[target] no constraint"},
{conditions: {maxLength: "4", value: "abcdef"}, expected: false, name: "[target] suffering from being too long", dirty: true},
{conditions: {maxLength: "4", value: "abcdef"}, expected: true, name: "[target] not suffering from being too long", dirty: true},
{conditions: {pattern: "[A-Z]", value: "abc"}, expected: false, name: "[target] suffering from a pattern mismatch"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] suffering from being missing"}
]
@ -25,7 +25,7 @@
types: ["url"],
testData: [
{conditions: {}, expected: true, name: "[target] no constraint"},
{conditions: {maxLength: "20", value: "http://www.example.com"}, expected: false, name: "[target] suffering from being too long", dirty: true},
{conditions: {maxLength: "20", value: "http://www.example.com"}, expected: true, name: "[target] suffering from being too long", dirty: true},
{conditions: {pattern: "http://www.example.com", value: "http://www.example.net"}, expected: false, name: "[target] suffering from a pattern mismatch"},
{conditions: {value: "abc"}, expected: false, name: "[target] suffering from a type mismatch"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] suffering from being missing"}
@ -36,7 +36,7 @@
types: ["email"],
testData: [
{conditions: {}, expected: true, name: "[target] no constraint"},
{conditions: {maxLength: "10", value: "test@example.com"}, expected: false, name: "[target] suffering from being too long", dirty: true},
{conditions: {maxLength: "10", value: "test@example.com"}, expected: true, name: "[target] not suffering from being too long", dirty: true},
{conditions: {pattern: "test@example.com", value: "test@example.net"}, expected: false, name: "[target] suffering from a pattern mismatch"},
{conditions: {value: "abc"}, expected: false, name: "[target] suffering from a type mismatch"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] suffering from being missing"}

View file

@ -15,7 +15,7 @@
types: ["text", "search", "tel", "password"],
testData: [
{conditions: {}, expected: true, name: "[target] no constraint"},
{conditions: {maxLength: "4", value: "abcdef"}, expected: false, name: "[target] suffering from being too long", dirty: true},
{conditions: {maxLength: "4", value: "abcdef"}, expected: true, name: "[target] not suffering from being too long", dirty: true},
{conditions: {pattern: "[A-Z]", value: "abc"}, expected: false, name: "[target] suffering from a pattern mismatch"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] suffering from being missing"}
]
@ -25,7 +25,7 @@
types: ["url"],
testData: [
{conditions: {}, expected: true, name: "[target] no constraint"},
{conditions: {maxLength: "20", value: "http://www.example.com"}, expected: false, name: "[target] suffering from being too long", dirty: true},
{conditions: {maxLength: "20", value: "http://www.example.com"}, expected: true, name: "[target] not suffering from being too long", dirty: true},
{conditions: {pattern: "http://www.example.com", value: "http://www.example.net"}, expected: false, name: "[target] suffering from a pattern mismatch"},
{conditions: {value: "abc"}, expected: false, name: "[target] suffering from a type mismatch"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] suffering from being missing"}
@ -36,7 +36,7 @@
types: ["email"],
testData: [
{conditions: {}, expected: true, name: "[target] no constraint"},
{conditions: {maxLength: "10", value: "test@example.com"}, expected: false, name: "[target] suffering from being too long", dirty: true},
{conditions: {maxLength: "10", value: "test@example.com"}, expected: true, name: "[target] not suffering from being too long", dirty: true},
{conditions: {pattern: "test@example.com", value: "test@example.net"}, expected: false, name: "[target] suffering from a pattern mismatch"},
{conditions: {value: "abc"}, expected: false, name: "[target] suffering from a type mismatch"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] suffering from being missing"}

View file

@ -16,9 +16,9 @@
types: ["date"],
testData: [
{conditions: {step: "", value: "2000-01-01"}, expected: false, name: "[target] The step attribute is not set"},
{conditions: {step: 2 * 1 * 86400000, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2 * 1 * 86400000, value: "1970-01-02"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2 * 1 * 86400000, value: "1970-01-03"}, expected: true, name: "[target] The value must mismatch the step"}
{conditions: {step: 2, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2, value: "1970-01-03"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2, value: "1970-01-02"}, expected: true, name: "[target] The value must mismatch the step"}
]
},
{
@ -26,9 +26,9 @@
types: ["month"],
testData: [
{conditions: {step: "", value: "2000-01"}, expected: false, name: "[target] The step attribute is not set"},
{conditions: {step: 2 * 1 * 1, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2 * 1 * 1, value: "1970-03"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2 * 1 * 1, value: "1970-04"}, expected: true, name: "[target] The value must mismatch the step"}
{conditions: {step: 2, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2, value: "1970-03"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2, value: "1970-04"}, expected: true, name: "[target] The value must mismatch the step"}
]
},
{
@ -36,9 +36,9 @@
types: ["week"],
testData: [
{conditions: {step: "", value: "1970-W01"}, expected: false, name: "[target] The step attribute is not set"},
{conditions: {step: 2 * 1 * 604800000, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2 * 1 * 604800000, value: "1970-W03"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2 * 1 * 604800000, value: "1970-W04"}, expected: true, name: "[target] The value must mismatch the step"}
{conditions: {step: 2, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2, value: "1970-W03"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2, value: "1970-W04"}, expected: true, name: "[target] The value must mismatch the step"}
]
},
{
@ -46,9 +46,9 @@
types: ["time"],
testData: [
{conditions: {step: "", value: "12:00:00"}, expected: false, name: "[target] The step attribute is not set"},
{conditions: {step: 2 * 60 * 1000, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2 * 60 * 1000, value: "12:02:00"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2 * 60 * 1000, value: "12:03:00"}, expected: true, name: "[target] The value must mismatch the step"}
{conditions: {step: 2 * 60, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2 * 60, value: "12:02:00"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2 * 60, value: "12:03:00"}, expected: true, name: "[target] The value must mismatch the step"}
]
},
{
@ -56,9 +56,9 @@
types: ["datetime-local"],
testData: [
{conditions: {step: "", value: "2000-01-01T12:00:00"}, expected: false, name: "[target] The step attribute is not set"},
{conditions: {step: 2 * 60 * 1000, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2 * 60 * 1000, value: "1970-01-01T12:02:00"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2 * 60 * 1000, value: "1970-01-01T12:03:00"}, expected: true, name: "[target] The value must mismatch the step"}
{conditions: {step: 2 * 60, value: ""}, expected: false, name: "[target] The value attibute is empty string"},
{conditions: {step: 2 * 60, value: "1970-01-01T12:02:00"}, expected: false, name: "[target] The value must match the step"},
{conditions: {step: 2 * 60, value: "1970-01-01T12:03:00"}, expected: true, name: "[target] The value must mismatch the step"}
]
},
{

View file

@ -14,7 +14,6 @@
tag: "input",
types: ["text", "search", "tel", "password"],
testData: [
{conditions: {maxLength: "4", value: "abcdef"}, expected: false, name: "[target] validity.valid must be false if validity.tooLong is true", dirty: true},
{conditions: {pattern: "[A-Z]", value: "abc"}, expected: false, name: "[target] validity.valid must be false if validity.patternMismatch is true"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] validity.valid must be false if validity.valueMissing is true"}
]
@ -23,7 +22,6 @@
tag: "input",
types: ["url"],
testData: [
{conditions: {maxLength: "20", value: "http://www.example.com"}, expected: false, name: "[target] validity.valid must be false if validity.tooLong is true", dirty: true},
{conditions: {pattern: "http://www.example.com", value: "http://www.example.net"}, expected: false, name: "[target] validity.valid must be false if validity.patternMismatch is true"},
{conditions: {value: "abc"}, expected: false, name: "[target] validity.valid must be false if validity.typeMismatch is true"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] validity.valid must be false if validity.valueMissing is true"}
@ -33,7 +31,6 @@
tag: "input",
types: ["email"],
testData: [
{conditions: {maxLength: "10", value: "test@example.com"}, expected: false, name: "[target] validity.valid must be false if validity.tooLong is true", dirty: true},
{conditions: {pattern: "test@example.com", value: "test@example.net"}, expected: false, name: "[target] validity.valid must be false if validity.patternMismatch is true"},
{conditions: {value: "abc"}, expected: false, name: "[target] validity.valid must be false if validity.typeMismatch is true"},
{conditions: {required: true, value: ""}, expected: false, name: "[target] validity.valid must be false if validity.valueMissing is true"}

View file

@ -18,5 +18,28 @@ test(function() {
assert_equals(form[1], document.getElementById("r2"));
assert_equals(form[2], undefined);
assert_equals(form[-1], undefined);
}, "form.elements should be accessed correctly by index")
}, "form.elements should be accessed correctly by index")
test(function(){
var form = document.getElementById("form");
var old_item = form[0];
var old_desc = Object.getOwnPropertyDescriptor(form, 0);
assert_equals(old_desc.value, old_item);
assert_true(old_desc.enumerable);
assert_true(old_desc.configurable);
assert_false(old_desc.writable);
Object.prototype[0] = 5;
this.add_cleanup(function () { delete Object.prototype[0]; });
assert_equals(form[0], old_item);
delete form[0];
assert_equals(form[0], old_item);
assert_throws(new TypeError(), function() {
"use strict";
delete form[0];
});
assert_equals(form[0], old_item);
}, 'Trying to delete an indexed property name should never work');
</script>

View file

@ -115,6 +115,11 @@ test(function() {
var button = document.getElementsByTagName("input")[0]
assert_equals(button.type, "button")
assert_equals(form.button, button)
var desc = Object.getOwnPropertyDescriptor(form, "button");
assert_equals(desc.value, button);
assert_false(desc.writable);
assert_true(desc.configurable);
assert_false(desc.enumerable);
assert_equals(form.button.length, undefined)
}, "Name for a single element should work")
@ -222,6 +227,12 @@ test(function() {
assert_equals(input2.localName, "input")
assert_equals(input2.getAttribute("form"), "c")
var desc = Object.getOwnPropertyDescriptor(form, "d");
assert_equals(desc.value, form.d);
assert_false(desc.writable);
assert_true(desc.configurable);
assert_false(desc.enumerable);
assert_true(form.d instanceof NodeList, "form.d should be a NodeList")
assert_array_equals(form.d, [input1, input2])
}, "The form attribute should be taken into account for named getters (multiple elements)")
@ -236,4 +247,84 @@ test(function() {
assert_equals(f.x, undefined)
assert_equals(g.x, input)
}, "Input should only be a named property on the innermost form that contains it")
test(function() {
var form = document.getElementsByTagName("form")[1];
var old_item = form["l1"];
var old_desc = Object.getOwnPropertyDescriptor(form, "l1");
assert_equals(old_desc.value, old_item);
assert_false(old_desc.enumerable);
assert_true(old_desc.configurable);
assert_false(old_desc.writable);
form["l1"] = 5;
assert_equals(form["l1"], old_item);
assert_throws(new TypeError(), function() {
"use strict";
form["l1"] = 5;
});
assert_throws(new TypeError(), function() {
Object.defineProperty(form, "l1", { value: 5 });
});
delete form["l1"];
assert_equals(form["l1"], old_item);
assert_throws(new TypeError(), function() {
"use strict";
delete form["l1"];
});
assert_equals(form["l1"], old_item);
}, 'Trying to set an expando that would shadow an already-existing named property');
test(function() {
var form = document.getElementsByTagName("form")[1];
var old_item = form["new-name"];
var old_desc = Object.getOwnPropertyDescriptor(form, "new-name");
assert_equals(old_item, undefined);
assert_equals(old_desc, undefined);
form["new-name"] = 5;
assert_equals(form["new-name"], 5);
var input = document.createElement("input");
this.add_cleanup(function () {input.remove();});
input.name = "new-name";
form.appendChild(input);
assert_equals(form["new-name"], 5);
delete form["new-name"];
assert_equals(form["new-name"], input);
}, 'Trying to set an expando that shadows a named property that gets added later');
test(function() {
var form = document.getElementsByTagName("form")[1];
var old_item = form["new-name2"];
var old_desc = Object.getOwnPropertyDescriptor(form, "new-name2");
assert_equals(old_item, undefined);
assert_equals(old_desc, undefined);
Object.defineProperty(form, "new-name2", { configurable: false, writable:
false, value: 5 });
assert_equals(form["new-name2"], 5);
var input = document.createElement("input");
this.add_cleanup(function () {input.remove();});
input.name = "new-name2";
form.appendChild(input);
assert_equals(form["new-name2"], 5);
delete form["new-name2"];
assert_equals(form["new-name2"], 5);
assert_throws(new TypeError(), function() {
"use strict";
delete form["new-name2"];
});
assert_equals(form["new-name2"], 5);
}, 'Trying to set a non-configurable expando that shadows a named property that gets added later');
</script>

View file

@ -1,11 +1,16 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>radio group name compatibility caseless</title>
<title>radio group name case-sensitive</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel="help" href="http://people.mozilla.org/~jdaggett/tests/radiobuttonnamecase.html">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#radio-button-group">
<!-- See also: https://github.com/whatwg/html/issues/1666 -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<input id=r1 type="radio" name="sImPlE">
<input id=r2 type="radio" name="simple">
<input id=r3 type="radio" name="SIMPLE">
@ -43,33 +48,36 @@
<input id=r30 type="radio" name="T&eacute;&#x01F1;&#x2075;アパートFi">
<input id=r31 type="radio" name="t&Eacute;dz5&#x3300;Fi">
<input id=r32 type="radio" name="t&Eacute;dz5&#x30A2;&#x30CF;&#x309A;&#x30FC;&#x30C8;Fi">
<input id=r33 type="radio" name="t&Eacute;dz5&#x30A2;&#x30D1;&#x30FC;&#x30C8;Fi">
<input id=r34 type="radio" name="T&Eacute;DZ⁵アパートFi">
<input id=r35 type="radio" name="T&Eacute;DZ5アパートfi">
<input id=r36 type="radio" name="ΣΣ">
<input id=r37 type="radio" name="σς">
<script>
var groups = [["r1" ,"r2", "r3"],
["r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14"],
["r15", "r16", "r17", "r18"],
["r19", "r20", "r21", "r22", "r23"],
["r24", "r25", "r26", "r27"],
["r28", "r29", "r30", "r31", "r32", "r33", "r34", "r35"],
["r36", "r37"]],
groupName = ["sImPlE", "paSSfield-killroyß", "глупый", "åωk", "blah1", "tÉdz5アパートFi", "ΣΣ"];
groups.forEach(function(group, index) {
test(function(){
group.forEach(function(radioId) {
assert_false(document.getElementById(radioId).checked);
});
for (var i = 0; i < group.length; i++) {
document.getElementById(group[i]).checked = true;
assert_true(document.getElementById(group[i]).checked);
for (var j = 0; j < group.length; j++) {
if (j != i) assert_false(document.getElementById(group[j]).checked);
}
}
}, "radio button group name = " + groupName[index]);
});
"use strict";
const notGroups = {
"sImPlE": ["r1" ,"r2", "r3"],
"paSSfield-killroyß": ["r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14"],
"глупый": ["r15", "r16", "r17", "r18"],
"åωk": ["r19", "r20", "r21", "r22", "r23"],
"blah1": ["r24", "r25", "r26", "r27"],
"tÉdz5アパートFi": ["r28", "r29", "r30", "r31", "r32", "r34", "r35"],
"ΣΣ": ["r36", "r37"]
};
for (let notGroupLabel of Object.keys(notGroups)) {
test(() => {
const ids = notGroups[notGroupLabel];
const radios = ids.map(id => document.getElementById(id));
for (let radio of radios) {
radio.checked = true;
}
for (let radio of radios) {
assert_true(radio.checked, `${radio.name} must be checked`);
}
}, `Among names like ${notGroupLabel}, everything must be checkable at the same time`);
}
</script>

View file

@ -42,7 +42,6 @@
var meters = [
{value: 0, expectedValue: 0, expectedMin: 0, expectedMax: 1.0, expectedLow: 0, expectedHigh: 1.0, expectedOptimum: 0.5, testname: "Default values"},
{value: 3, expectedValue: 3, min: -10.1, expectedMin: -10.1, max: 10.1, expectedMax: 10.1, low: -9.1, expectedLow: -9.1, high: 9.1, expectedHigh: 9.1, optimum: 3, expectedOptimum: 3, testname: "Setting values to min, max, low, high and optimum"},
{value: "foobar", expectedValue: 0, min: "foobar", expectedMin: 0, max: "foobar", expectedMax: 1.0, low: "foobar", expectedLow: 0, high: "foobar", expectedHigh: 1.0, optimum: "foobar", expectedOptimum: 0.5, testname: "Invalid floating-point number values"},
{value: 0, expectedValue: 0, min: 0, expectedMin: 0, max: -1.0, expectedMax: 0, expectedLow: 0, expectedHigh: 0, expectedOptimum: 0, testname: "max < min"},
{value: 0, expectedValue: 10, min: 10, expectedMin: 10, max: 20, expectedMax: 20, expectedLow: 10, expectedHigh: 20, expectedOptimum: 15, testname: "value < min"},
{value: 30, expectedValue: 20, min: 10, expectedMin: 10, max: 20, expectedMax: 20, expectedLow: 10, expectedHigh: 20, expectedOptimum: 15, testname: "value > max"},
@ -71,6 +70,15 @@
assert_equals(meter.optimum, m.expectedOptimum, "optimum value");
}, m.testname);
}
test(function() {
var meter = document.createElement("meter");
assert_throws(new TypeError(), function() { meter.value = "foobar"; }, "value attribute");
assert_throws(new TypeError(), function() { meter.min = "foobar"; }, "min attribute");
assert_throws(new TypeError(), function() { meter.max = "foobar"; }, "max attribute");
assert_throws(new TypeError(), function() { meter.low = "foobar"; }, "low attribute");
assert_throws(new TypeError(), function() { meter.high = "foobar"; }, "high attribute");
assert_throws(new TypeError(), function() { meter.optimum = "foobar"; }, "optimum attribute");
}, "Invalid floating-point number values");
</script>
<script type="text/javascript">

View file

@ -11,9 +11,7 @@
<h1>Description</h1>
<p>This test continues to validate the li element.</p>
<p>The spec states:</p>
<blockquote>"If the parent element is an ol element, then the li element has an ordinal value. The value attribute is processed relative to the element's parent ol element (q.v.), if there is one. If there is not, the attribute has no effect."</blockquote>
<p>This reftest verifies that the value attribute has no effect when applied to a list item NOT having an ol parent.</p>
<p>This reftest verifies that the value attribute has no effect when applied to a list item NOT having an ol parent and not marked as display: list-item.</p>
<p>A reftest is necessary because the values of li elements as calculated by the user agent are NOT available programatically. Only explicitly-set values are then available programatically.</p>
<p>This reftest passes if you see NO sequencing information on any of the items below.</p>

View file

@ -12,9 +12,7 @@
<h1>Description</h1>
<p>This test continues to validate the li element.</p>
<p>The spec states:</p>
<blockquote>"If the parent element is an ol element, then the li element has an ordinal value. The value attribute is processed relative to the element's parent ol element (q.v.), if there is one. If there is not, the attribute has no effect."</blockquote>
<p>This reftest verifies that the value attribute has no effect when applied to a list item NOT having an ol parent.</p>
<p>This reftest verifies that the value attribute has no effect when applied to a list item NOT having an ol parent and not marked as display: list-item.</p>
<p>A reftest is necessary because the values of li elements as calculated by the user agent are NOT available programatically. Only explicitly-set values are then available programatically.</p>
<p>This reftest passes if you see NO sequencing information on any of the items below.</p>

View file

@ -15,8 +15,6 @@
<h1>Description</h1>
<p>This test continues to validate the li element.</p>
<p>The spec states:</p>
<blockquote>"If the parent element is an ol element, then the li element has an ordinal value. The value attribute is processed relative to the element's parent ol element (q.v.), if there is one. If there is not, the attribute has no effect."</blockquote>
<p>This reftest verifies that the value attribute has an effect when applied to a list item with an ol parent.</p>
<p>A reftest is necessary because the values of li elements as calculated by the user agent are NOT available programatically. Only explicitly-set values are then available programatically.</p>
<p>This reftest passes if you see the numbers 1. 2. 3. below the words "Ordered List"</p>

View file

@ -18,8 +18,6 @@
<h1>Description</h1>
<p>This test continues to validate the li element.</p>
<p>The spec states:</p>
<blockquote>"If the parent element is an ol element, then the li element has an ordinal value. The value attribute is processed relative to the element's parent ol element (q.v.), if there is one. If there is not, the attribute has no effect."</blockquote>
<p>This reftest verifies that the value attribute has an effect when applied to a list item with an ol parent.</p>
<p>A reftest is necessary because the values of li elements as calculated by the user agent are NOT available programatically. Only explicitly-set values are then available programatically.</p>
<p>This reftest passes if you see the numbers 1. 2. 3. below the words "Ordered List"</p>

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>display: list-item on non-&lt;li> elements</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<style>
.list-item {
display: list-item;
list-style-type: decimal;
}
.list-item[hidden] {
display: none;
}
</style>
<p>This test matches if both lists display similar to the following:</p>
<pre>1. A
2. B
D
3. E</pre>
<hr>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<span>D</span>
<li value="3">E</li>
</ol>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<span>D</span>
<li value="3">E</li>
</ol>

View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>display: list-item on non-&lt;li> elements</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-display-list-item-ref.html">
<style>
.list-item {
display: list-item;
list-style-type: decimal;
}
.list-item[hidden] {
display: none;
}
</style>
<p>This test matches if both lists display similar to the following:</p>
<pre>1. A
2. B
D
3. E</pre>
<hr>
<ul>
<span class="list-item">A</span>
<span class="list-item">B</span>
<span class="list-item" hidden>C</span>
<span>D</span>
<span class="list-item">E</span>
</ul>
<ol>
<div class="list-item">A</div>
<div class="list-item">B</div>
<div class="list-item" hidden>C</div>
<div>D</div>
<div class="list-item">E</div>
</ol>

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be narest ancestor menu if it exists</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
1. F
2. G
6. H
1. I
2. J
1. K
2. L</pre>
<hr>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<li value="3">C</li>
<li value="4">D</li>
<li value="5">E</li>
<ol>
<li value="1">F</li>
<li value="2">G</li>
</ol>
<li value="6">H</li>
<ol>
<li value="1">I</li>
<li value="2">
J
<ol>
<li value="1">K</li>
<li value="2">L</li>
</ol>
</li>
</ol>
</ol>

View file

@ -0,0 +1,58 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be narest ancestor menu if it exists</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-list-owner-menu-ref.html">
<style>
li {
list-style-type: decimal;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
1. F
2. G
6. H
1. I
2. J
1. K
2. L</pre>
<hr>
<menu>
<li>A</li>
<li>B</li>
<div>
<li>C</li>
<span>
<li>D</li>
<li>E</li>
</span>
<menu>
<li>F</li>
<li>G</li>
</menu>
</div>
<li>H</li>
<menu>
<li>I</li>
<li>
J
<menu>
<li>K</li>
<li>L</li>
</menu>
</li>
</menu>
</menu>

View file

@ -0,0 +1,52 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be nearest ancestor ul or ul (but not dir) if it exists</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<style>
li {
list-style-type: decimal;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
1. F
2. G
6. H
1. I
2. J
3. K
4. L</pre>
<hr>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<li value="3">C</li>
<li value="4">D</li>
<li value="5">E</li>
<ol>
<li value="1">F</li>
<li value="2">G</li>
</ol>
<li value="6">H</li>
<ol>
<li value="1">I</li>
<li value="2">
J
<dir>
<li value="3">K</li>
<li value="4">L</li>
</dir>
</li>
</ol>
</ol>

View file

@ -0,0 +1,64 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be nearest ancestor ul or ul (but not dir) if it exists</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-list-owner-mixed-ref.html">
<style>
li {
list-style-type: decimal;
}
.list-item {
display: list-item;
list-style-type: decimal;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
1. F
2. G
6. H
1. I
2. J
3. K
4. L</pre>
<hr>
<ul>
<li>A</li>
<li>B</li>
<div>
<li>C</li>
<span>
<li>D</li>
<li>E</li>
</span>
<ol>
<li>F</li>
<span class="list-item">G</span>
</ol>
</div>
<li>H</li>
<ol>
<li>I</li>
<li>
J
<dir>
<li>K</li>
<li>L</li>
</dir>
</li>
</ol>
</ul>

View file

@ -0,0 +1,52 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>The dir element is not treated specially when calculating list owners</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<style>
li {
list-style-type: decimal;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
6. F
7. G
8. H
9. I
10. J
11. K
12. L</pre>
<hr>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<li value="3">C</li>
<li value="4">D</li>
<li value="5">E</li>
<dir>
<li value="6">F</li>
<li value="7">G</li>
</dir>
<li value="8">H</li>
<dir>
<li value="9">I</li>
<li value="10">
J
<dir>
<li value="11">K</li>
<li value="12">L</li>
</dir>
</li>
</dir>
</ol>

View file

@ -0,0 +1,58 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>The dir element is not treated specially when calculating list owners</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-list-owner-not-dir-ref.html">
<style>
li {
list-style-type: decimal;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
6. F
7. G
8. H
9. I
10. J
11. K
12. L</pre>
<hr>
<ol>
<li>A</li>
<li>B</li>
<div>
<li>C</li>
<span>
<li>D</li>
<li>E</li>
</span>
<dir>
<li>F</li>
<li>G</li>
</dir>
</div>
<li>H</li>
<dir>
<li>I</li>
<li>
J
<dir>
<li>K</li>
<li>L</li>
</dir>
</li>
</dir>
</ol>

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be narest ancestor ol if it exists</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
1. F
2. G
6. H
1. I
2. J
1. K
2. L</pre>
<hr>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<li value="3">C</li>
<li value="4">D</li>
<li value="5">E</li>
<ol>
<li value="1">F</li>
<li value="2">G</li>
</ol>
<li value="6">H</li>
<ol>
<li value="1">I</li>
<li value="2">
J
<ol>
<li value="1">K</li>
<li value="2">L</li>
</ol>
</li>
</ol>
</ol>

View file

@ -0,0 +1,52 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be narest ancestor ol if it exists</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-list-owner-ol-ref.html">
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
1. F
2. G
6. H
1. I
2. J
1. K
2. L</pre>
<hr>
<ol>
<li>A</li>
<li>B</li>
<div>
<li>C</li>
<span>
<li>D</li>
<li>E</li>
</span>
<ol>
<li>F</li>
<li>G</li>
</ol>
</div>
<li>H</li>
<ol>
<li>I</li>
<li>
J
<ol>
<li>K</li>
<li>L</li>
</ol>
</li>
</ol>
</ol>

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be the parent if there is no ancestor ul/ol/menu</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<style>
li {
list-style-type: decimal;
list-style-position: inside;
}
ol {
padding: 50px;
margin: 0;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
1. C
1. D
1. E
3. F</pre>
<hr>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<li value="1">C</li>
<li value="1">D</li>
<blockquote>
<li value="1">E</li>
</blockquote>
<li value="3">F</li>
</ol>

View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be the parent if there is no ancestor ul/ol/menu</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-list-owner-parent-ref.html">
<style>
li {
list-style-type: decimal;
list-style-position: inside;
}
.container {
padding: 50px;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
1. C
1. D
1. E
3. F</pre>
<hr>
<div class="container">
<li>A</li>
<li>B</li>
<div>
<li>C</li>
<span>
<li>D</li>
</span>
</div>
<blockquote>
<li>E</li>
</blockquote>
<li>F</li>
</div>

View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner calculation skips elements that do not generate layout boxes</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
6. F
7. G
8. H
9. I
10. J
1. K
2. L</pre>
<hr>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<li value="3">C</li>
<li value="4">D</li>
<li value="5">E</li>
<li value="6">F</li>
<li value="7">G</li>
<li value="8">H</li>
<li value="9">I</li>
<li value="10">
J
<ol>
<li value="1">K</li>
<li value="2">L</li>
</ol>
</li>
</ol>

View file

@ -0,0 +1,52 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner calculation skips elements that do not generate layout boxes</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-list-owner-skip-no-boxes-ref.html">
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
6. F
7. G
8. H
9. I
10. J
1. K
2. L</pre>
<hr>
<ol>
<li>A</li>
<li>B</li>
<div>
<li>C</li>
<span>
<li>D</li>
<li>E</li>
</span>
<ol style="display: contents;">
<li>F</li>
<li>G</li>
</ol>
</div>
<li>H</li>
<ol style="display: contents;">
<li>I</li>
<li>
J
<ol>
<li>K</li>
<li>L</li>
</ol>
</li>
</ol>
</ol>

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be nearest ancestor ul if it exists</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
1. F
2. G
6. H
1. I
2. J
1. K
2. L</pre>
<hr>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<li value="3">C</li>
<li value="4">D</li>
<li value="5">E</li>
<ol>
<li value="1">F</li>
<li value="2">G</li>
</ol>
<li value="6">H</li>
<ol>
<li value="1">I</li>
<li value="2">
J
<ol>
<li value="1">K</li>
<li value="2">L</li>
</ol>
</li>
</ol>
</ol>

View file

@ -0,0 +1,58 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>list owner is calculated to be nearest ancestor ul if it exists</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-list-owner-ul-ref.html">
<style>
li {
list-style-type: decimal;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. C
4. D
5. E
1. F
2. G
6. H
1. I
2. J
1. K
2. L</pre>
<hr>
<ul>
<li>A</li>
<li>B</li>
<div>
<li>C</li>
<span>
<li>D</li>
<li>E</li>
</span>
<ul>
<li>F</li>
<li>G</li>
</ul>
</div>
<li>H</li>
<ul>
<li>I</li>
<li>
J
<ul>
<li>K</li>
<li>L</li>
</ul>
</li>
</ul>
</ul>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>If no ancestors generate CSS boxes, the list item has no owner, and thus gets numbered as 0</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<style>
html, body {
display: contents;
}
li {
list-style-type: decimal;
margin-left: 50px;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>0. A
0. B
0. C</pre>
<hr>
<li value="0">A</li>
<li value="0">B</li>
<li value="0">C</li>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>If no ancestors generate CSS boxes, the list item has no owner, and thus gets numbered as 0</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-no-list-owner-ref.html">
<style>
html, body {
display: contents;
}
li {
list-style-type: decimal;
margin-left: 50px;
}
</style>
<p>This test matches if the list displays similar to the following</p>
<pre>0. A
0. B
0. C</pre>
<hr>
<li>A</li>
<li>B</li>
<li>C</li>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>List items that are not being rendered do not participate in numbering</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. D
4. E
5. G</pre>
<hr>
<ol>
<li value="1">A</li>
<li value="2">B</li>
<li value="3">D</li>
<li value="4">E</li>
<li value="5">G</li>
</ol>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>List items that are not being rendered do not participate in numbering</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#ordinal-value">
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#list-owner">
<link rel="match" href="grouping-li-reftest-not-being-rendered-ref.html">
<p>This test matches if the list displays similar to the following</p>
<pre>1. A
2. B
3. D
4. E
5. G</pre>
<hr>
<ol>
<li>A</li>
<li>B</li>
<li hidden>C</li>
<li>D</li>
<div>
<li>E</li>
<li hidden>F</li>
<li>G</li>
</div>
</ol>

View file

@ -17,9 +17,6 @@
<p>These reftests are necessary because the values of the ol's li children as calculated by the user agent are NOT available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote>"The reversed attribute is a boolean attribute. If present, it indicates that the list is a descending list (..., 3, 2, 1). If the attribute is omitted, the list is an ascending list (1, 2, 3, ...)."</blockquote>
<p><strong>This reftest passes if you see an ascending list followed by two descending lists.</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -20,9 +20,6 @@
<p>These reftests are necessary because the values of the ol's li children as calculated by the user agent are NOT available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote>"The reversed attribute is a boolean attribute. If present, it indicates that the list is a descending list (..., 3, 2, 1). If the attribute is omitted, the list is an ascending list (1, 2, 3, ...)."</blockquote>
<p><strong>This reftest passes if you see an ascending list followed by two descending lists.</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -14,10 +14,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote><p>The first item in the list has the ordinal value given by the ol element's start attribute, unless that li element has a value attribute with a value that can be successfully parsed, in which case it has the ordinal value given by that value attribute.</p>
<p>Each subsequent item in the list has the ordinal value given by its value attribute, if it has one, or, if it doesn't, the ordinal value of the previous item, plus one if the reversed is absent, or minus one if it is present.</p></blockquote>
<p><strong>This reftest passes if each list's items are numbered identically to the horizontal sequence immediately above those list items.</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -17,10 +17,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote><p>The first item in the list has the ordinal value given by the ol element's start attribute, unless that li element has a value attribute with a value that can be successfully parsed, in which case it has the ordinal value given by that value attribute.</p>
<p>Each subsequent item in the list has the ordinal value given by its value attribute, if it has one, or, if it doesn't, the ordinal value of the previous item, plus one if the reversed is absent, or minus one if it is present.</p></blockquote>
<p><strong>This reftest passes if each list's items are numbered identically to the horizontal sequence immediately above those list items.</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -14,10 +14,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote><p>The first item in the list has the ordinal value given by the ol element's start attribute, unless that li element has a value attribute with a value that can be successfully parsed, in which case it has the ordinal value given by that value attribute.</p>
<p>Each subsequent item in the list has the ordinal value given by its value attribute, if it has one, or, if it doesn't, the ordinal value of the previous item, plus one if the reversed is absent, or minus one if it is present.</p></blockquote>
<p><strong>This reftest passes if each list's items are numbered identically to the horizontal sequence immediately above those list items.</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -17,10 +17,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote><p>The first item in the list has the ordinal value given by the ol element's start attribute, unless that li element has a value attribute with a value that can be successfully parsed, in which case it has the ordinal value given by that value attribute.</p>
<p>Each subsequent item in the list has the ordinal value given by its value attribute, if it has one, or, if it doesn't, the ordinal value of the previous item, plus one if the reversed is absent, or minus one if it is present.</p></blockquote>
<p><strong>This reftest passes if each list's items are numbered identically to the horizontal sequence immediately above those list items.</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -14,9 +14,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote><p>The type attribute represents the state given in the cell in the second column of the row whose first cell matches the attribute's value; if none of the cells match, or if the attribute is omitted, then the attribute represents the decimal state.</p></blockquote>
<p><strong>This reftest passes if each list's items are labelled identically to the horizontal sequence immediately above those list items:</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -16,9 +16,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote><p>The type attribute represents the state given in the cell in the second column of the row whose first cell matches the attribute's value; if none of the cells match, or if the attribute is omitted, then the attribute represents the decimal state.</p></blockquote>
<p><strong>This reftest passes if each list's items are labelled identically to the horizontal sequence immediately above those list items:</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -14,9 +14,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote>User agents should render the items of the list in a manner consistent with the state of the type attribute of the ol element.</blockquote>
<p><strong>This reftest passes if each list's items are labelled identically to the horizontal sequence immediately above those list items:</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -16,9 +16,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states:</p>
<blockquote>User agents should render the items of the list in a manner consistent with the state of the type attribute of the ol element.</blockquote>
<p><strong>This reftest passes if each list's items are labelled identically to the horizontal sequence immediately above those list items:</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -14,8 +14,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states: Numbers less than or equal to zero should always use the decimal system regardless of the type attribute.</p>
<p><strong>This reftest passes if each list's items are labelled identically to the horizontal sequence immediately above those list items:</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

View file

@ -16,8 +16,6 @@
<body>
<p>This test continues to validate the ol element. This reftest is necessary because the values of the ol's li children as calculated and displayed by the user agent are NOT systematically available programatically. Only explicitly-set values are available programatically. Therefore, we need to check actual rendering against expected rendering.</p>
<p>The spec states: Numbers less than or equal to zero should always use the decimal system regardless of the type attribute.</p>
<p><strong>This reftest passes if each list's items are labelled identically to the horizontal sequence immediately above those list items:</strong></p>
<p>(Note: each list item has no content; only the sequencing should appear.)</p>

Some files were not shown because too many files have changed in this diff Show more