Skip to content

Commit 57d9f8c

Browse files
committed
Bug 1994864 [wpt PR 55493] - [EventTiming] Rename targetIdentifier to targetSelector after feedback., a=testonly
Automatic update from web-platform-tests [EventTiming] Rename targetIdentifier to targetSelector after feedback. Recently presented this new feature to the Web Performance WG at a biweekly meeting and got strong positive support, but feedback that the name is misleading (confusing with just element.id value), and also that the specific format of the query-selector for target might need to evolve in the future. Renaming based on that feedback, and will update spec wording PR. Spec Issue: w3c/event-timing#126 I2P: https://chromestatus.com/feature/5143499213242368 Spec: w3c/event-timing#160 Bug: 40887145 Change-Id: I154c6706578fa88485aa9a91eb6f8e8a700beb5b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7044923 Reviewed-by: Scott Haseley <shaseleychromium.org> Commit-Queue: Michal Mocny <mmocnychromium.org> Cr-Commit-Position: refs/heads/main{#1530914} -- wpt-commits: 021f7cd491c9d71de9631d9bdc13c299e2e512a2 wpt-pr: 55493 UltraBlame original commit: 43c56e6d62d3146db7ad65945ae091e737c131d3
1 parent f609541 commit 57d9f8c

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

testing/web-platform/tests/event-timing/target-identifier.html renamed to testing/web-platform/tests/event-timing/target-selector.tentative.html

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<meta charset=utf-8 />
44
<meta name="timeout" content="long">
5-
<title>Event Timing targetIdentifier.</title>
5+
<title>Event Timing targetSelector.</title>
66
<script src=/resources/testharness.js></script>
77
<script src=/resources/testharnessreport.js></script>
88
<script src=/resources/testdriver.js></script>
@@ -14,16 +14,14 @@
1414
<img id='img-with-id-and-src' src='/images/blue.png'>
1515
<img src='/images/green.png'>
1616
<script>
17-
function verifyTargetIdentifier(entry, target) {
18-
if ('targetIdentifier' in entry) {
19-
let expectedIdentifier = target.tagName;
20-
if (target.id) {
21-
expectedIdentifier += '#' + target.id;
22-
} else if (target.hasAttribute('src')) {
23-
expectedIdentifier += '[src="' + target.getAttribute('src') + '"]';
24-
}
25-
assert_equals(entry.targetIdentifier, expectedIdentifier);
17+
function computeExpectedTargetSelector(target) {
18+
let selector = target.tagName;
19+
if (target.id) {
20+
selector += '#' + target.id;
21+
} else if (target.hasAttribute('src')) {
22+
selector += '[src="' + target.getAttribute('src') + '"]';
2623
}
24+
return selector;
2725
}
2826

2927
function runTest(t, eventType, target) {
@@ -41,11 +39,9 @@
4139
assert_equals(entry.name, eventType);
4240
assert_equals(entry.entryType, 'event');
4341
assert_equals(entry.target, target);
44-
verifyTargetIdentifier(entry, target);
45-
if (entry.target) {
46-
const matchingElements = document.querySelectorAll(entry.targetIdentifier);
47-
assert_true(Array.from(matchingElements).includes(target));
48-
}
42+
assert_equals(entry.targetSelector, computeExpectedTargetSelector(entry.target));
43+
const matchingElements = document.querySelectorAll(entry.targetSelector);
44+
assert_true(Array.from(matchingElements).includes(target));
4945
});
5046
}
5147

@@ -90,7 +86,7 @@
9086
// The garbage collector might need some time to collect |target|.
9187
await new Promise(r => t.step_timeout(r, 0));
9288
assert_equals(entry.target, null);
93-
assert_equals(entry.targetIdentifier, expectedIdentifier);
89+
assert_equals(entry.targetSelector, expectedIdentifier);
9490
}, "Test with disconnected target");
9591
</script>
96-
</html>
92+
</html>

0 commit comments

Comments
 (0)