-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw exception for popovers/dialogs in non-active documents
See discussion at: whatwg/html#10659 and spec PR at: whatwg/html#10705 Web-facing change PSA: https://groups.google.com/a/chromium.org/g/blink-dev/c/jRFiIIkXv_k/m/jnPTfg8WBgAJ Fixed: 373684393 Change-Id: I50e400ee526775f915f006865301fff2f04016b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5943740 Reviewed-by: Domenic Denicola <domenic@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Domenic Denicola <domenic@chromium.org> Cr-Commit-Position: refs/heads/main@{#1375681}
- Loading branch information
1 parent
fb143c3
commit bdf8f40
Showing
3 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
html/semantics/interactive-elements/the-dialog-element/dialog-active-document.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<link rel="author" href="mailto:masonf@chromium.org"> | ||
<link rel=help href="https://github.com/whatwg/html/pull/10705"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<script> | ||
test(() => { | ||
const doc = document.implementation.createHTMLDocument(); | ||
const dialog = doc.createElement('dialog'); | ||
doc.body.appendChild(dialog); | ||
assert_throws_dom('InvalidStateError',() => dialog.showModal()); | ||
assert_false(dialog.matches('[open]')); | ||
},'showModal should throw when the document isn\'t active'); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<link rel="author" href="mailto:masonf@chromium.org"> | ||
<link rel=help href="https://github.com/whatwg/html/pull/10705"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<script> | ||
test(() => { | ||
const doc = document.implementation.createHTMLDocument(); | ||
const popover = doc.createElement('div'); | ||
popover.setAttribute('popover',''); | ||
doc.body.appendChild(popover); | ||
assert_throws_dom('InvalidStateError',() => popover.showPopover()); | ||
assert_false(popover.matches(':open')); | ||
},'showPopover should throw when the document isn\'t active'); | ||
</script> |