mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision 66c4613f823c4384c78ada77346eda17bb128947
This commit is contained in:
parent
183772583f
commit
a91433f0c8
234 changed files with 4368 additions and 967 deletions
|
@ -1,4 +1,5 @@
|
|||
@Ms2ger
|
||||
@foolip
|
||||
@gsnedders
|
||||
@jdm
|
||||
@jgraham
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
test(function () {
|
||||
var href = location.href;
|
||||
location.assign("http://:");
|
||||
assert_throws('SYNTAX_ERR', function() { location.assign("http://:"); });
|
||||
assert_equals(location.href, href);
|
||||
}, "URL that fails to parse");
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Document#defaultView</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_equals(document.defaultView, window);
|
||||
}, "Document in a browsing context");
|
||||
|
||||
test(function() {
|
||||
var d = new Document();
|
||||
assert_equals(d.defaultView, null);
|
||||
}, "Document created with the Document constructor");
|
||||
|
||||
test(function() {
|
||||
var d = document.implementation.createDocument(null, null);
|
||||
assert_equals(d.defaultView, null);
|
||||
}, "Document created with createDocument");
|
||||
|
||||
test(function() {
|
||||
var d = document.implementation.createHTMLDocument();
|
||||
assert_equals(d.defaultView, null);
|
||||
}, "Document created with createHTMLDocument");
|
||||
|
||||
test(function() {
|
||||
var parser = new DOMParser();
|
||||
var d = parser.parseFromString("<foo\/\>", "application/xml");
|
||||
assert_equals(d.defaultView, null);
|
||||
}, "Document created with XML DOMParser");
|
||||
|
||||
test(function() {
|
||||
var parser = new DOMParser();
|
||||
var d = parser.parseFromString("bar", "text/html");
|
||||
assert_equals(d.defaultView, null);
|
||||
}, "Document created with HTML DOMParser");
|
||||
</script>
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Window#document</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var URL = "/common/blank.html";
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
document.body.appendChild(iframe);
|
||||
var initialWindow = iframe.contentWindow;
|
||||
var initialDocument = initialWindow.document;
|
||||
assert_equals(initialDocument.URL, "about:blank");
|
||||
iframe.src = URL;
|
||||
iframe.onload = this.step_func_done(function() {
|
||||
assert_equals(iframe.contentWindow, initialWindow);
|
||||
assert_equals(initialDocument.URL, "about:blank");
|
||||
var loadedDocument = initialWindow.document;
|
||||
assert_equals(loadedDocument.URL, location.href.replace(location.pathname, URL));
|
||||
assert_not_equals(initialDocument, loadedDocument);
|
||||
});
|
||||
}, "Document in a browsing context");
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>window[@@iterator]</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_false(Symbol.iterator in window);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,55 @@
|
|||
<!doctype html>
|
||||
<link rel="match" href="table-cell-width-ref.html">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 400px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
td, th {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
td:first-child, th:first-child {
|
||||
background-color: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- width=0 should be treated as 'auto' -->
|
||||
<table>
|
||||
<tr>
|
||||
<th width=0>a</th>
|
||||
<th>a</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width=0>a</td>
|
||||
<td>a</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- test valid width attribute value-->
|
||||
<table>
|
||||
<tr>
|
||||
<th width=100>a</th>
|
||||
<th>a</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width=100>a</td>
|
||||
<td>a</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<link rel="match" href="table-width-ref.html">
|
||||
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- width=0 should be treated as 'auto' -->
|
||||
<table width=0>
|
||||
<tr>
|
||||
<td>
|
||||
a b
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
|
||||
<table width=1>
|
||||
<tr>
|
||||
<td>
|
||||
a b
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -24,21 +24,21 @@ var testElements = [
|
|||
},
|
||||
{
|
||||
tag: "input",
|
||||
types: ["datetime"],
|
||||
types: ["datetime-local"],
|
||||
testData: [
|
||||
{conditions: {value: ""}, expected: false, name: "[target] The value attribute is empty"},
|
||||
{conditions: {value: "2000-01-01T12:00:00Z"}, expected: false, name: "[target] The value attribute is a valid date and time string"},
|
||||
{conditions: {value: "abc"}, expected: true, name: "[target] The value attribute cannot convert to a valid normalized forced-UTC global date and time string"}
|
||||
{conditions: {value: "2000-01-01T12:00:00"}, expected: false, name: "[target] The value attribute is a valid date and time string"},
|
||||
{conditions: {value: "abc"}, expected: false, name: "[target] The value attribute cannot convert to a valid normalized forced-UTC global date and time string"}
|
||||
]
|
||||
},
|
||||
{
|
||||
tag: "input",
|
||||
types: ["color"],
|
||||
testData: [
|
||||
{conditions: {value: ""}, expected: true, name: "[target] The value attribute is empty"},
|
||||
{conditions: {value: ""}, expected: false, name: "[target] The value attribute is empty"},
|
||||
{conditions: {value: "#000000"}, expected: false, name: "[target] The value attribute is a valid sample color"},
|
||||
{conditions: {value: "#FFFFFF"}, expected: false, name: "[target] The value attribute is not a valid lowercase sample color"},
|
||||
{conditions: {value: "abc"}, expected: true, name: "[target] The value attribute cannot convert to a valid sample color"}
|
||||
{conditions: {value: "abc"}, expected: false, name: "[target] The value attribute cannot convert to a valid sample color"}
|
||||
]
|
||||
},
|
||||
];
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>The selection interface members</title>
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#textFieldSelection">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var valid = ["text", "search", "url", "tel", "password"];
|
||||
var invalid = ["hidden", "datetime", "date", "month", "week", "datetime-local",
|
||||
"number", "range", "color", "checkbox", "radio", "button",
|
||||
"file", "email", "submit", "image", "reset"];
|
||||
valid.forEach(function(aType) {
|
||||
test(function() {
|
||||
var input = document.createElement("input");
|
||||
input.type = aType;
|
||||
assert_equals(input.type, aType, "Input type unsupported")
|
||||
input.select();
|
||||
var a = input.selectionStart;
|
||||
input.selectionStart = 0;
|
||||
a = input.selectionEnd;
|
||||
input.selectionEnd = 0;
|
||||
input.setSelectionRange(0, 0);
|
||||
}, "Selection attributes should apply to type " + aType)
|
||||
})
|
||||
|
||||
invalid.forEach(function(aType) {
|
||||
test(function() {
|
||||
var input = document.createElement("input");
|
||||
input.type = aType;
|
||||
assert_equals(input.type, aType, "Input type unsupported")
|
||||
assert_throws("INVALID_STATE_ERR", function() { input.select(); }, "Should throw with type " + aType);
|
||||
assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionStart; });
|
||||
assert_throws("INVALID_STATE_ERR", function() { input.selectionStart = 0; });
|
||||
assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionEnd; });
|
||||
assert_throws("INVALID_STATE_ERR", function() { input.selectionEnd = 0; });
|
||||
assert_throws("INVALID_STATE_ERR", function() { input.setSelectionRange(0, 0); });
|
||||
}, "Selection attributes should not apply to type " + aType)
|
||||
})
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,131 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Input element programmatic selection support</title>
|
||||
<link rel="author" title="yaycmyk" href="mailto:evan@yaycmyk.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#dom-textarea/input-select">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
/* all textual, non-hidden inputs support .select() */
|
||||
test(function() {
|
||||
var valid = [
|
||||
"text",
|
||||
"search",
|
||||
"url",
|
||||
"tel",
|
||||
"email",
|
||||
"password",
|
||||
"date",
|
||||
"month",
|
||||
"week",
|
||||
"time",
|
||||
"datetime-local",
|
||||
"number",
|
||||
"color",
|
||||
"file",
|
||||
];
|
||||
|
||||
var invalid = [
|
||||
"hidden",
|
||||
"range",
|
||||
"checkbox",
|
||||
"radio",
|
||||
"submit",
|
||||
"image",
|
||||
"reset",
|
||||
"button"
|
||||
];
|
||||
|
||||
valid.forEach(function(type) {
|
||||
test(function() {
|
||||
var input = document.createElement("input");
|
||||
var a;
|
||||
|
||||
input.type = type;
|
||||
assert_equals(input.type, type, "the given input type is not supported");
|
||||
|
||||
input.select();
|
||||
|
||||
}, "input type " + type + " should support the select() method");
|
||||
});
|
||||
|
||||
invalid.forEach(function(type) {
|
||||
test(function() {
|
||||
var input = document.createElement("input");
|
||||
|
||||
input.type = type;
|
||||
assert_equals(input.type, type, "the given input type is not supported");
|
||||
|
||||
assert_throws("INVALID_STATE_ERR", function() { input.select(); });
|
||||
|
||||
}, "input type " + type + " should not support the select() method");
|
||||
});
|
||||
});
|
||||
|
||||
/* only certain input types are allowed to have a variable-length selection */
|
||||
test(function() {
|
||||
var valid = [
|
||||
"text",
|
||||
"search",
|
||||
"url",
|
||||
"tel",
|
||||
"password"
|
||||
];
|
||||
|
||||
var invalid = [
|
||||
"hidden",
|
||||
"email",
|
||||
"date",
|
||||
"month",
|
||||
"week",
|
||||
"time",
|
||||
"datetime-local",
|
||||
"number",
|
||||
"range",
|
||||
"color",
|
||||
"checkbox",
|
||||
"radio",
|
||||
"file",
|
||||
"submit",
|
||||
"image",
|
||||
"reset",
|
||||
"button"
|
||||
];
|
||||
|
||||
valid.forEach(function(type) {
|
||||
test(function() {
|
||||
var input = document.createElement("input");
|
||||
var a;
|
||||
|
||||
input.type = type;
|
||||
assert_equals(input.type, type, "the given input type is not supported");
|
||||
|
||||
a = input.selectionStart;
|
||||
input.selectionStart = 0;
|
||||
a = input.selectionEnd;
|
||||
input.selectionEnd = 0;
|
||||
input.setSelectionRange(0, 0);
|
||||
input.setRangeText('', 0, 0);
|
||||
|
||||
}, "input type " + type + " should support all selection attributes and methods");
|
||||
});
|
||||
|
||||
invalid.forEach(function(type) {
|
||||
test(function() {
|
||||
var input = document.createElement("input");
|
||||
|
||||
input.type = type;
|
||||
assert_equals(input.type, type, "the given input type is not supported");
|
||||
|
||||
assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionStart; });
|
||||
assert_throws("INVALID_STATE_ERR", function() { input.selectionStart = 0; });
|
||||
assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionEnd; });
|
||||
assert_throws("INVALID_STATE_ERR", function() { input.selectionEnd = 0; });
|
||||
assert_throws("INVALID_STATE_ERR", function() { input.setSelectionRange(0, 0); });
|
||||
assert_throws("INVALID_STATE_ERR", function() { input.setRangeText('', 0, 0); });
|
||||
|
||||
}, "input type " + type + " should not support variable-length selections");
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -32,8 +32,11 @@ test(function() {
|
|||
|
||||
assert_equals(template.ownerDocument, doc.body.ownerDocument,
|
||||
'Wrong template node owner document');
|
||||
assert_equals(template.content.ownerDocument, doc,
|
||||
'Wrong template content owner document');
|
||||
var ownerDoc = template.content.ownerDocument;
|
||||
assert_not_equals(ownerDoc, doc, 'Wrong template content owner document');
|
||||
assert_not_equals(ownerDoc, document, 'Wrong template content owner document');
|
||||
assert_equals(ownerDoc.defaultView, null,
|
||||
'Template content owner document should not have a browsing context');
|
||||
|
||||
}, 'Parsing XHTML: Node\'s node document must be set to that of the element '
|
||||
+ 'to which it will be appended. Test empty template');
|
||||
|
|
|
@ -22,6 +22,13 @@ function templateIsAChild(element) {
|
|||
'Template element should be a descendant of the ' + element.tagName + ' element');
|
||||
}
|
||||
|
||||
function templateIsDisallowedAsAChild(element) {
|
||||
element.innerHTML = '<template>some text</template>';
|
||||
|
||||
assert_equals(element.querySelector('template'), null,
|
||||
'Template element should not be allowed as a descendant of the ' + element.tagName + ' element');
|
||||
}
|
||||
|
||||
function templateIsAnIndirectChild(element) {
|
||||
element.innerHTML = '<div><template>some text</template></div>';
|
||||
|
||||
|
@ -29,6 +36,13 @@ function templateIsAnIndirectChild(element) {
|
|||
'Template element should be a descendant of the ' + element.tagName + ' element');
|
||||
}
|
||||
|
||||
function templateIsDisallowedAsAnIndirectChild(element) {
|
||||
element.innerHTML = '<div><template>some text</template></div>';
|
||||
|
||||
assert_equals(element.querySelector('template'), null,
|
||||
'Template element should not be allowed as indirect descendant of the ' + element.tagName + ' element');
|
||||
}
|
||||
|
||||
function templateIsAnAppendedChild(doc, element) {
|
||||
var template = doc.createElement('template');
|
||||
|
||||
|
@ -58,13 +72,16 @@ var parameters = [['Template element as a descendant of the BODY element. ' +
|
|||
['Template element as a descendant of the HEAD element. ' +
|
||||
'Template element is created by innerHTML',
|
||||
doc.head],
|
||||
['Template element as a descendant of the FRAMESET element. ' +
|
||||
'Template element is created by innerHTML',
|
||||
frameset]
|
||||
];
|
||||
generate_tests(templateIsAChild, parameters,
|
||||
'Template element as a descendant of the HEAD, BODY and FRAMESET elements');
|
||||
'Template element as a descendant of the HEAD and BODY elements');
|
||||
|
||||
parameters = [['Template element as a descendant of the FRAMESET element. ' +
|
||||
'Template element is created by innerHTML',
|
||||
frameset],
|
||||
];
|
||||
generate_tests(templateIsDisallowedAsAChild, parameters,
|
||||
'Template element should be disallowed as a descendant of the FRAMESET elements');
|
||||
|
||||
|
||||
parameters = [['Template element as an indirect descendant of the BODY element. ' +
|
||||
|
@ -73,13 +90,17 @@ parameters = [['Template element as an indirect descendant of the BODY element.
|
|||
['Template element as an indirect descendant of the HEAD element. ' +
|
||||
'Template element is created by innerHTML',
|
||||
doc.head],
|
||||
['Template element as an indirect descendant of the FRAMESET element. ' +
|
||||
'Template element is created by innerHTML',
|
||||
frameset]
|
||||
];
|
||||
generate_tests(templateIsAnIndirectChild, parameters,
|
||||
'Template element as an indirect descendant of the HEAD, BODY and FRAMESET elements');
|
||||
|
||||
parameters = [['Template element as a descendant of the FRAMESET element. ' +
|
||||
'Template element is created by innerHTML',
|
||||
frameset],
|
||||
];
|
||||
generate_tests(templateIsDisallowedAsAnIndirectChild, parameters,
|
||||
'Template element should be disallowed as an indirect descendant of the FRAMESET elements');
|
||||
|
||||
|
||||
|
||||
parameters = [['Template element as a descendant of the BODY element. ' +
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Selector: pseudo-classes (:focus for autofocus)</title>
|
||||
<link rel="author" title="Kent Tamura" href="mailto:tkent@chromium.org">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/forms.html#autofocusing-a-form-control:-the-autofocus-attribute">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
// This test can't be merged to focus.html because element.focus() may affect
|
||||
// autofocus behavior.
|
||||
var autofocusTest = async_test(":focus selector should work with an autofocused element.");
|
||||
var input = document.createElement("input");
|
||||
input.autofocus = true;
|
||||
input.addEventListener("focus", function() {
|
||||
autofocusTest.step(function() {
|
||||
assert_array_equals(document.querySelectorAll(":focus"), [input])
|
||||
autofocusTest.done();
|
||||
});
|
||||
}, false);
|
||||
document.body.appendChild(input);
|
||||
</script>
|
||||
</body>
|
|
@ -11,7 +11,6 @@
|
|||
<button id=button1 type=submit>button1</button>
|
||||
<input id=input1>
|
||||
<input id=input2 disabled>
|
||||
<input id=input3 autofocus>
|
||||
<textarea id=textarea1>textarea1</textarea>
|
||||
<input type=checkbox id=checkbox1 checked>
|
||||
<input type=radio id=radio1 checked>
|
||||
|
@ -20,8 +19,6 @@
|
|||
<iframe src="focus-iframe.html" id=iframe onload="load()"></iframe>
|
||||
|
||||
<script>
|
||||
testSelector(":focus", ["input3"], "input3 has the attribute autofocus");
|
||||
|
||||
document.getElementById("input1").focus(); // set the focus on input1
|
||||
testSelector(":focus", ["input1"], "input1 has the focus");
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<head>
|
||||
<title>HTML Templates: additions to 'in frameset' insertion mode</title>
|
||||
<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<meta name="assert" content="If parser is in 'in frameset' insertion mode and meets frameset end tag then if the stack of open elements has a template element in html scope then this is a parse error; ignore the token">
|
||||
<link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-head-addition">
|
||||
<meta name="assert" content="If parser is in 'in frameset' insertion mode then a start tag or an end tag whose name is 'template' is a parsing error">
|
||||
<link rel="help" href="https://www.w3.org/TR/2015/WD-html51-20151008/syntax.html#parsing-main-inframeset">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/resources/common.js"></script>
|
||||
|
@ -18,15 +18,9 @@ testInIFrame('/html/semantics/scripting-1/the-template-element/resources/framese
|
|||
var doc = context.iframes[0].contentDocument;
|
||||
|
||||
var frameset = doc.querySelector('frameset');
|
||||
assert_equals(frameset.children.length, 1, 'Wrong number of frameset children elements');
|
||||
assert_equals(frameset.children.length, 0, 'Wrong number of frameset children elements');
|
||||
|
||||
var template = frameset.querySelector('template');
|
||||
assert_equals(template.tagName, 'TEMPLATE', 'FRAMESET should contain template element');
|
||||
assert_equals(template.content.childNodes.length, 0,
|
||||
'Template content should be empty');
|
||||
|
||||
}, '</frameset> tag should be ignored if there\'s TEMPLATE element in '
|
||||
+ 'the stack of open elements');
|
||||
}, '<template> tag should be ignored in "in frameset" insertion mode');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -66,26 +66,6 @@ test(function () {
|
|||
|
||||
|
||||
|
||||
test(function () {
|
||||
var doc = newHTMLDocument();
|
||||
|
||||
doc.open();
|
||||
doc.write('<frameset><template id="tmpl1"><div id="div">DIV</div></template></frameset>');
|
||||
doc.close();
|
||||
|
||||
var template = doc.querySelector('#tmpl1');
|
||||
|
||||
var div = template.content.querySelector('#div');
|
||||
|
||||
assert_equals(div.ownerDocument, template.content.ownerDocument,
|
||||
'Wrong ownerDocument of the element in template');
|
||||
|
||||
}, 'Test ownerDocument property of the element in a template. '
|
||||
+ 'Current DOCUMENT has no browsing context. Test template element '
|
||||
+ 'in the root of the frameset');
|
||||
|
||||
|
||||
|
||||
test(function () {
|
||||
var doc = newHTMLDocument();
|
||||
doc.body.innerHTML = '<template id="tmpl1">'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue