Skip to content

Commit

Permalink
Bug 1809253 [wpt PR 37815] - Change popover invoking attributes to us…
Browse files Browse the repository at this point in the history
…e Element reflection, a=testonly

Automatic update from web-platform-tests
Change popover invoking attributes to use Element reflection

Per the conversation at [1], we've decided to make the IDL reflections
of the invoking attributes (popovertoggletarget, popovershowtarget, and
popoverhidetarget) use Element reflection, and be named accordingly.

[1] whatwg/html#8221 (comment)

Fixed: 1405856
Bug: 1307772
Change-Id: Iace783795c2db7a19e11fbc4f0c4da33a8765779
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4148056
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: Joey Arhar <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1090582}

--

wpt-commits: a0ddc451e02afbbe600c679fe1edab0e4f878ecf
wpt-pr: 37815
  • Loading branch information
mfreed7 authored and moz-wptsync-bot committed Jan 18, 2023
1 parent a282f92 commit d6a155c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
return el;
};
}
function setInvokingContentAttribute(invoker,attr,idref) {
invoker.setAttribute(attr,idref);
assert_equals(invoker[attr + "Element"],document.getElementById(idref));
}
const supportedButtonTypes = ['button','reset','submit',''].map(type => {
return {
name: `<button type="${type}">`,
Expand Down Expand Up @@ -85,13 +89,13 @@
assert_not_equals(popover1.id,popover2.id);
const invoker = testcase.makeElement(test);
if (use_idl) {
invoker.popoverToggleTarget = t===1 ? popover1.id : (t===2 ? popover2.id : null);
invoker.popoverShowTarget = s===1 ? popover1.id : (s===2 ? popover2.id : null);
invoker.popoverHideTarget = h===1 ? popover1.id : (h===2 ? popover2.id : null);
invoker.popoverToggleTargetElement = t===1 ? popover1 : (t===2 ? popover2 : null);
invoker.popoverShowTargetElement = s===1 ? popover1 : (s===2 ? popover2 : null);
invoker.popoverHideTargetElement = h===1 ? popover1 : (h===2 ? popover2 : null);
} else {
if (t) invoker.setAttribute('popovertoggletarget',t===1 ? popover1.id : popover2.id);
if (s) invoker.setAttribute('popovershowtarget',s===1 ? popover1.id : popover2.id);
if (h) invoker.setAttribute('popoverhidetarget',h===1 ? popover1.id : popover2.id);
if (t) setInvokingContentAttribute(invoker,'popoverToggleTarget',t===1 ? popover1.id : popover2.id);
if (s) setInvokingContentAttribute(invoker,'popoverShowTarget',s===1 ? popover1.id : popover2.id);
if (h) setInvokingContentAttribute(invoker,'popoverHideTarget',h===1 ? popover1.id : popover2.id);
}
assert_true(!document.getElementById(popover1.id));
assert_true(!document.getElementById(popover2.id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
document.body.appendChild(button);
assert_equals(ex.id,'');
ex.id = 'popover-id';
button.popoverToggleTarget = ex.id;
button.popoverToggleTargetElement = ex;
assert_true(ex.matches(':closed'));
await clickOn(button);
ensureIsOpenPopover(ex,'Invoking element should be able to invoke all popovers');
Expand Down
8 changes: 3 additions & 5 deletions testing/web-platform/tests/interfaces/popover.tentative.idl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ partial interface HTMLElement {
};

interface mixin PopoverTargetElement {
// TODO(crbug.com/1405856): These might change to `Element`, or additional
// attributes like `popoverToggleTargetElement` might be added for that.
[CEReactions] attribute DOMString? popoverToggleTarget;
[CEReactions] attribute DOMString? popoverHideTarget;
[CEReactions] attribute DOMString? popoverShowTarget;
[CEReactions] attribute Element? popoverToggleTargetElement;
[CEReactions] attribute Element? popoverHideTargetElement;
[CEReactions] attribute Element? popoverShowTargetElement;
};
HTMLInputElement includes PopoverTargetElement;
HTMLButtonElement includes PopoverTargetElement;
Expand Down

0 comments on commit d6a155c

Please sign in to comment.