Commit ccabfd31 authored by sunyunjia's avatar sunyunjia Committed by Commit bot

Import focus-manual.html from W3C.

This is a follow-up patch of https://codereview.chromium.org/2332843002/

Import wpt@de70de04726dedd0981c644669911096854929b6

Using update-w3c-deps in Chromium
8e715596.

Review-Url: https://codereview.chromium.org/2342603002
Cr-Commit-Position: refs/heads/master@{#418649}
parent d513f265
...@@ -794,6 +794,9 @@ crbug.com/630671 imported/wpt/pointerevents/pointerevent_capture_suppressing_mou ...@@ -794,6 +794,9 @@ crbug.com/630671 imported/wpt/pointerevents/pointerevent_capture_suppressing_mou
crbug.com/630671 imported/wpt/pointerevents/pointerevent_releasepointercapture_events_to_original_target-manual.html [ Skip ] crbug.com/630671 imported/wpt/pointerevents/pointerevent_releasepointercapture_events_to_original_target-manual.html [ Skip ]
crbug.com/630671 imported/wpt/pointerevents/pointerevent_setpointercapture_relatedtarget-manual.html [ Skip ] crbug.com/630671 imported/wpt/pointerevents/pointerevent_setpointercapture_relatedtarget-manual.html [ Skip ]
# These are the failing tests because Chrome hasn't implemented according to the spec.
crbug.com/645988 imported/wpt/uievents/order-of-events/focus-events/focus-manual.html [ Failure ]
# The commented lines here for Mac is due to the fact that there is a more # The commented lines here for Mac is due to the fact that there is a more
# generic skip rule in the next block of rules. However, when they get fixed # generic skip rule in the next block of rules. However, when they get fixed
# these should be uncommented as there is no touch support on Mac. # these should be uncommented as there is no touch support on Mac.
......
...@@ -303,7 +303,7 @@ imported/wpt/tools [ Skip ] ...@@ -303,7 +303,7 @@ imported/wpt/tools [ Skip ]
# imported/wpt/touch-events [ Pass ] # imported/wpt/touch-events [ Pass ]
imported/wpt/typedarrays [ Skip ] imported/wpt/typedarrays [ Skip ]
## Owners: dtapuska@chromium.org ## Owners: dtapuska@chromium.org
# imported/wpt/uievents [ Pass ] imported/wpt/uievents [ Pass ]
imported/wpt/url [ Skip ] imported/wpt/url [ Skip ]
## Owners: jsbell@chromium.org ## Owners: jsbell@chromium.org
# imported/wpt/user-timing [ Pass ] # imported/wpt/user-timing [ Pass ]
...@@ -507,6 +507,7 @@ imported/wpt/html/browsers/history/the-location-interface/scripted_click_locatio ...@@ -507,6 +507,7 @@ imported/wpt/html/browsers/history/the-location-interface/scripted_click_locatio
imported/wpt/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html [ Skip ] imported/wpt/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html [ Skip ]
imported/wpt/html/browsers/origin/cross-origin-objects/cross-origin-objects.html [ Skip ] imported/wpt/html/browsers/origin/cross-origin-objects/cross-origin-objects.html [ Skip ]
imported/wpt/html/browsers/origin/cross-origin-objects/cross-origin-objects.sub.html [ Skip ] imported/wpt/html/browsers/origin/cross-origin-objects/cross-origin-objects.sub.html [ Skip ]
imported/wpt/html/browsers/origin/origin-of-data-document.html [ Skip ]
imported/wpt/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-01.html [ Skip ] imported/wpt/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-01.html [ Skip ]
imported/wpt/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-02.html [ Skip ] imported/wpt/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-02.html [ Skip ]
imported/wpt/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-03.html [ Skip ] imported/wpt/html/browsers/the-window-object/accessing-other-browsing-contexts/indexed-browsing-contexts-03.html [ Skip ]
......
...@@ -212,6 +212,7 @@ interface Node : EventTarget { ...@@ -212,6 +212,7 @@ interface Node : EventTarget {
readonly attribute boolean isConnected; readonly attribute boolean isConnected;
readonly attribute Document? ownerDocument; readonly attribute Document? ownerDocument;
Node getRootNode(optional GetRootNodeOptions options);
readonly attribute Node? parentNode; readonly attribute Node? parentNode;
readonly attribute Element? parentElement; readonly attribute Element? parentElement;
boolean hasChildNodes(); boolean hasChildNodes();
...@@ -248,6 +249,9 @@ interface Node : EventTarget { ...@@ -248,6 +249,9 @@ interface Node : EventTarget {
Node removeChild(Node child); Node removeChild(Node child);
}; };
dictionary GetRootNodeOptions {
boolean composed = false;
};
[Constructor, [Constructor,
Exposed=Window] Exposed=Window]
......
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Node.prototype.getRootNode()</title>
<link rel="help" href="https://dom.spec.whatwg.org/#dom-node-getrootnode">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
test(function () {
var element = document.createElement('div');
assert_equals(element.getRootNode(), element, 'getRootNode() on an element without a parent must return the element itself');
var text = document.createTextNode('');
assert_equals(text.getRootNode(), text, 'getRootNode() on a text node without a parent must return the text node itself');
var processingInstruction = document.createProcessingInstruction('target', 'data');
assert_equals(processingInstruction.getRootNode(), processingInstruction, 'getRootNode() on a processing instruction node without a parent must return the processing instruction node itself');
assert_equals(document.getRootNode(), document, 'getRootNode() on a document node must return the document itself');
}, 'getRootNode() must return the context object when it does not have any parent');
test(function () {
var parent = document.createElement('div');
var element = document.createElement('div');
parent.appendChild(element);
assert_equals(element.getRootNode(), parent, 'getRootNode() on an element with a single ancestor must return the parent node');
var text = document.createTextNode('');
parent.appendChild(text);
assert_equals(text.getRootNode(), parent, 'getRootNode() on a text node with a single ancestor must return the parent node');
var processingInstruction = document.createProcessingInstruction('target', 'data');
parent.appendChild(processingInstruction)
assert_equals(processingInstruction.getRootNode(), parent, 'getRootNode() on a processing instruction node with a single ancestor must return the parent node');
}, 'getRootNode() must return the parent node of the context object when the context object has a single ancestor not in a document');
test(function () {
var parent = document.createElement('div');
document.body.appendChild(parent);
var element = document.createElement('div');
parent.appendChild(element);
assert_equals(element.getRootNode(), document, 'getRootNode() on an element inside a document must return the document');
var text = document.createTextNode('');
parent.appendChild(text);
assert_equals(text.getRootNode(), document, 'getRootNode() on a text node inside a document must return the document');
var processingInstruction = document.createProcessingInstruction('target', 'data');
parent.appendChild(processingInstruction)
assert_equals(processingInstruction.getRootNode(), document, 'getRootNode() on a processing instruction node inside a document must return the document');
}, 'getRootNode() must return the document when a node is in document');
test(function () {
var fragment = document.createDocumentFragment();
var parent = document.createElement('div');
fragment.appendChild(parent);
var element = document.createElement('div');
parent.appendChild(element);
assert_equals(element.getRootNode(), fragment, 'getRootNode() on an element inside a document fragment must return the fragment');
var text = document.createTextNode('');
parent.appendChild(text);
assert_equals(text.getRootNode(), fragment, 'getRootNode() on a text node inside a document fragment must return the fragment');
var processingInstruction = document.createProcessingInstruction('target', 'data');
parent.appendChild(processingInstruction)
assert_equals(processingInstruction.getRootNode(), fragment,
'getRootNode() on a processing instruction node inside a document fragment must return the fragment');
}, 'getRootNode() must return a document fragment when a node is in the fragment');
</script>
</body>
</html>
...@@ -137,8 +137,6 @@ var embeddedElements = { ...@@ -137,8 +137,6 @@ var embeddedElements = {
ping: "urls", ping: "urls",
rel: "string", rel: "string",
relList: {type: "tokenlist", domAttrName: "rel"}, relList: {type: "tokenlist", domAttrName: "rel"},
hreflang: "string",
type: "string",
// HTMLHyperlinkElementUtils // HTMLHyperlinkElementUtils
href: "url", href: "url",
......
<!doctype html>
<title>The hidden attribute</title>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<p>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=match href=hidden-1-ref.html>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<link rel=help href=https://html.spec.whatwg.org/multipage/#the-hidden-attribute>
<link rel=help href=https://html.spec.whatwg.org/multipage/#hidden-elements>
<p>This line should be visible.
<p hidden>This line should not be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<p>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=match href=hidden-1-ref.html>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<link rel=help href=https://html.spec.whatwg.org/multipage/#the-hidden-attribute>
<link rel=help href=https://html.spec.whatwg.org/multipage/#hidden-elements>
<style>
p { display: none; }
[hidden] { display: block; }
</style>
<p hidden>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<p>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=match href=hidden-1-ref.html>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<link rel=help href=https://html.spec.whatwg.org/multipage/#the-hidden-attribute>
<link rel=help href=https://html.spec.whatwg.org/multipage/#hidden-elements>
<p hidden>This line should be visible.
<p>This line should not be visible.
<script>
document.getElementsByTagName("p")[0].hidden = false;
document.getElementsByTagName("p")[1].hidden = true;
</script>
<!doctype html>
<title>The hidden attribute</title>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<p>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=match href=hidden-1-ref.html>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<link rel=help href=https://html.spec.whatwg.org/multipage/#the-hidden-attribute>
<link rel=help href=https://html.spec.whatwg.org/multipage/#hidden-elements>
<p hidden>This line should be visible.
<p>This line should not be visible.
<script>
document.getElementsByTagName("p")[0].removeAttribute("hidden");
document.getElementsByTagName("p")[1].setAttribute("hidden", "");
</script>
<!doctype html>
<title>The hidden attribute</title>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<p>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=match href=hidden-1-ref.html>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<link rel=help href=https://html.spec.whatwg.org/multipage/#the-hidden-attribute>
<link rel=help href=https://html.spec.whatwg.org/multipage/#hidden-elements>
<style>
p { display: block; }
</style>
<p hidden>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<p>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=match href=hidden-1-ref.html>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<link rel=help href=https://html.spec.whatwg.org/multipage/#the-hidden-attribute>
<link rel=help href=https://html.spec.whatwg.org/multipage/#hidden-elements>
<style>
p { display: block !important; }
</style>
<p hidden>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<p>This line should be visible.
<!doctype html>
<title>The hidden attribute</title>
<link rel=match href=hidden-1-ref.html>
<link rel=author title=Ms2ger href=mailto:Ms2ger@gmail.com>
<link rel=help href=https://html.spec.whatwg.org/multipage/#the-hidden-attribute>
<link rel=help href=https://html.spec.whatwg.org/multipage/#hidden-elements>
<p>This line should be visible.
<p hidden=hidden>This line should not be visible.
<p hidden=blue>This line should not be visible.
<p hidden=true>This line should not be visible.
<p hidden=false>This line should not be visible.
<!DOCTYPE html>
<title>Dynamic manipulation of textarea.wrap</title>
<link rel=help href=https://html.spec.whatwg.org/multipage/#dom-textarea-wrap>
<link rel=author title=Ms2ger href=mailto:ms2ger@gmail.com>
<textarea wrap=soft cols=20>01234567890 01234567890 01234567890</textarea>
<!DOCTYPE html>
<title>Dynamic manipulation of textarea.wrap</title>
<link rel=match href=wrap-reflect-1-ref.html>
<link rel=help href=https://html.spec.whatwg.org/multipage/#dom-textarea-wrap>
<link rel=author title=Ms2ger href=mailto:ms2ger@gmail.com>
<textarea wrap=off cols=20>01234567890 01234567890 01234567890</textarea>
<script>
document.getElementsByTagName("textarea")[0].wrap = "soft";
</script>
<!DOCTYPE html>
<title>Dynamic manipulation of textarea.wrap</title>
<link rel=help href=https://html.spec.whatwg.org/multipage/#dom-textarea-wrap>
<link rel=author title=Ms2ger href=mailto:ms2ger@gmail.com>
<textarea wrap=soft cols=20>01234567890 01234567890 01234567890</textarea>
<!DOCTYPE html>
<title>Dynamic manipulation of textarea.wrap</title>
<link rel=match href=wrap-reflect-1-ref.html>
<link rel=help href=https://html.spec.whatwg.org/multipage/#dom-textarea-wrap>
<link rel=author title=Ms2ger href=mailto:ms2ger@gmail.com>
<textarea wrap=off cols=20>01234567890 01234567890 01234567890</textarea>
<script>
document.getElementsByTagName("textarea")[0].setAttribute("wrap", "soft");
</script>
<!doctype html>
<title>Historical table features should not be supported</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
function t(property, tagNames) {
if (typeof tagNames === "string") {
tagNames = [tagNames];
}
tagNames.forEach(function(tagName) {
test(function() {
assert_false(property in document.createElement(tagName));
}, tagName + '.' + property + ' should not be supported');
});
}
// added in https://github.com/whatwg/html/commit/6db0d8d4e3456140de958c963afe9bb9ec7b6a25
// removed in https://github.com/whatwg/html/commit/59b7e2466c2b7c5c408a4963b05b13fd808aa07a
t('onsort', 'table');
t('sortable', 'table');
t('stopSorting', 'table');
t('sorted', 'th');
t('sort', 'th');
</script>
<!doctype html>
<title>Historical text-level element features should not be supported</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
function t(property, tagNames) {
if (typeof tagNames === "string") {
tagNames = [tagNames];
}
tagNames.forEach(function(tagName) {
test(function() {
assert_false(property in document.createElement(tagName));
}, tagName + '.' + property + ' should not be supported');
});
}
// <area> and <link> are in other sections in the spec, but we'll test them here together with <a>
// removed in https://github.com/whatwg/html/commit/790479ab1ba143efc27d1f92cd0465627df48fb0
t('hreflang', 'area');
t('type', 'area');
// renamed to dateTime in https://github.com/whatwg/html/commit/8b6732237c7021cd61e3c3463146234ca8ce5bad
t('datetime', 'time');
// removed in https://github.com/whatwg/html/commit/66fcb2357f205448fe2f40d7834a1e8ea2ed283b
t('media', ['a', 'area']);
// renamed to noreferrer in https://github.com/whatwg/html/commit/6a34274e99593e767ae99744a6c38a19489915c6
t('noreferer', ['link', 'a', 'area']);
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Focus-related events should fire in the correct order</title>
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
<link rel="help" href="https://w3c.github.io/uievents/#events-focusevent-event-order">
<meta name="flags" content="interact">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<ol>
<li>Click into the first text input.</li>
<li>Click into the second text input.</li>
<li>Click the "Done" button.</li>
</ol>
<input type="text" id="a" value="First">
<br>
<input type="text" id="b" value="Second">
<br>
<button type="button" id="done">Done</button>
<script>
setup({explicit_timeout: true});
var done = false;
var events = [];
var targets = [];
function record(e) {
if (done) {
return;
}
events.push(e.type);
targets.push(e.target.id);
}
function finish() {
done = true;
}
var relevantEvents = [
'focus',
'blur',
'focusin',
'focusout'
];
window.onload = function () {
var a = document.getElementById('a');
var b = document.getElementById('b');
var inputs = [a, b];
b.addEventListener('blur', finish, false);
b.addEventListener('focusout', finish, false);
for (var i = 0; i < inputs.length; i++) {
for (var k = 0; k < relevantEvents.length; k++) {
inputs[i].addEventListener(relevantEvents[k], record, false);
}
}
async_test(function(t) {
document.getElementById('done').addEventListener('click', function () {
finish();
t.step(function () {
assert_array_equals(
events,
['focusin', 'focus', 'focusout', 'focusin', 'blur', 'focus'],
'Focus-related events should fire in this order: focusin, focus, focusout, focusin, blur, focus'
);
assert_array_equals(
targets,
[ 'a', 'a', 'a', 'b', 'a', 'b'],
'Focus-related events should fire at the correct targets'
);
t.done();
});
}, false);
}, 'Focus-related events should fire in the correct order');
};
</script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment