diff --git a/source b/source index 243c0c1cf7f..5ac4faf7eb7 100644 --- a/source +++ b/source @@ -4060,6 +4060,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
scroll
eventscrollend
eventThe following features and terms are defined in CSS Syntax: @@ -10932,6 +10933,9 @@ partial interface Document { set of not restored reason details, initially empty.
+Each Document
has an open dialogs list, which is a list of
+ dialog
elements, initially empty.
DocumentOrShadowRoot
interfaceDOM defines the Content attributes:
closedby
open
HTMLDialogElement
.dialog
element is active and that the user can interact with it.
+ The closedby
+ content attribute is an enumerated attribute with the following keywords and
+ states:
Keyword + | State + | Brief description + |
---|---|---|
any
+ | Any + | Close requests or clicks outside close the dialog. + |
closerequest
+ | Close Request + | Close requests close the dialog. + |
none
+ | None + | No user actions automatically close the dialog. + |
The closedby
attribute's invalid value default and missing value
+ default are both the Auto state.
The Auto state behaves as
+ Close Request state when the
+ dialog
was shown using its showModal()
+ method; otherwise the None state.
A dialog
element without an open
attribute
@@ -61781,6 +61822,27 @@ interface HTMLDialogElement : HTMLElement {
The argument, if provided, provides a return value.
+dialog.requestClose([ result ])
Acts as if a close request was sent targeting
+ dialog, by first firing a cancel
event, and if
+ that event is not canceled with preventDefault()
,
+ proceeding to close the dialog in the same way as the close()
method (including firing a close
event).
This is a helper utility that can be used to consolidate cancelation and closing logic into
+ the cancel
and close
event
+ handlers, by having all non-close request closing
+ affordances call this method.
Note that this method ignores the closedby
+ attribute: that is, even if closedby
is set to
+ "none
", the same behavior will apply.
The argument, if provided, provides a return value.
+dialog.returnValue [ = result ]
Returns the dialog
's return value.
If this has an open
attribute and the
- is modal flag of this is false, then return.
If this has an open
attribute and
+ is modal of this is false, then return.
If this has an open
attribute, then
throw an "InvalidStateError
" DOMException
.
Add an open
attribute to this, whose
value is the empty string.
Add this to this's node document's open + dialogs list.
Set the dialog close watcher with this.
Set this's previously focused element to the focused element.
If this has an open
attribute and the
- is modal flag of this is true, then return.
If this has an open
attribute and
+ is modal of this is true, then return.
If this has an open
attribute, then
throw an "InvalidStateError
" DOMException
.
Add an open
attribute to this, whose
value is the empty string.
Set the is modal flag of this to true.
Set is modal of this to true.
Assert: this's node document's open + dialogs list does not contain + this.
Add this to this's node document's open + dialogs list.
Let this's node document be contain this, then add an element to the top layer given this.
Set this's close watcher to the - result of establishing a close watcher given - this's relevant global object, with:
- -cancelAction given
- canPreventClose being to return the result of firing an event named cancel
at this, with the cancelable
attribute initialized to
- canPreventClose.
closeAction being to close the - dialog given this and null.
Set the dialog close watcher with this.
Set this's previously focused element to the focused element.
Run the dialog focusing steps given this.
To set the dialog close watcher, given a dialog
+ element dialog:
Set dialog's close watcher to the + result of establishing a close watcher given + dialog's relevant global object, with:
+ +cancelAction given
+ canPreventClose being to return the result of firing
+ an event named cancel
at dialog, with the
+ cancelable
attribute initialized to
+ canPreventClose.
closeAction being to close the + dialog given dialog and dialog's request close return + value.
getEnabledState being to return
+ true if dialog's enable close watcher for requestClose()
is true or dialog's
+ computed closed-by state is not None; otherwise false.
To retrieve a dialog's computed closed-by state, given a dialog
+ dialog:
+
+
If the state of dialog's closedby
+ attribute is Auto:
If dialog's is modal is true, then return Close Request.
Return None.
Return the state of dialog's closedby
attribute.
The dialog focusing steps, given a dialog
element subject,
are as follows:
Set the is modal flag of removedNode to false.
Set is modal of removedNode to false.
Remove removedNode from + removedNode's node document's open dialogs list.
The HTMLDialogElement
: HTMLElement {
Close the dialog this with returnValue.
The requestClose(returnValue)
method steps
+ are:
If this does not have an open
+ attribute, then return.
Assert: this's close + watcher is not null.
Set dialog's enable close watcher for requestClose()
to true.
If returnValue is not given, then set it to null.
Set this's request close return value to + returnValue.
Request to close dialog's + close watcher with false.
Set dialog's enable close watcher for requestClose()
to false.
When a dialog
element subject is to be closed, with null or a string result, run these steps:
Remove subject's open
attribute.
If the is modal flag of subject is true, then request an
+ If is modal of subject is true, then request an
element to be removed from the top layer given subject. Let wasModal be the value of subject's is
modal flag. Set the is modal flag of subject to false. Set is modal of subject to false. Remove subject from subject's
+ node document's open dialogs list. If result is not null, then set the Set the request close return value to null. If subject's previously focused element is not null, then: The Each Each Each Each Each Each HTML element has a previously focused
element which is null or an element, and it is initially null. When The The returnValue
attribute to result.
+ Document
has a dialog pointerdown target, which is an HTML dialog element or null, initially null.dialog
element has a close watcher,
which is a close watcher or null, initially null.dialog
element has an is modal flag. When a dialog
- element is created, this flag must be set to false.dialog
element has a request close return value, which is a
+ string, initially null.dialog
element has an enable close watcher for requestClose()
boolean, initially false.dialog
element has an is modal boolean, initially false.HTMLDialogElement : HTMLElement {
+ closedBy
IDL attribute must reflect the
+ closedby
content attribute, limited to only
+ known values.open
IDL
attribute must reflect the open
content
attribute.
"Light dismiss" means that clicking outside of a dialog
element whose closedby
attribute is in the Any state will close the dialog
element. This
+ is in addition to how such dialog
s respond to close requests.
To light dismiss open dialogs, given a PointerEvent
event:
Assert: event's isTrusted
attribute is true.
Let document be event's target's node document.
If document's open dialogs list is empty, then return.
Let ancestor be the result of running nearest clicked dialog + given event.
If event's type
is
+ "pointerdown
", then set document's
+ dialog pointerdown target to ancestor.
If event's type
is
+ "pointerup
", then:
Let sameTarget be true if ancestor is document's + dialog pointerdown target.
Set document's dialog pointerdown target to null.
If sameTarget is false, then return.
Let topmostDialog be the last element of document's open + dialogs list.
If ancestor is topmostDialog, then return.
If topmostDialog's computed closed-by state is not Any, then return.
Assert: topmostDialog's close watcher is not null.
Request to close + topmostDialog's close watcher with + false.
To run light dismiss activities, given a PointerEvent
+ event:
Run light dismiss open popovers with event.
Run light dismiss open dialogs with event.
Run light dismiss activities will be called by the Pointer Events spec when the user clicks + or touches anywhere on the page.
+ +To find the nearest clicked dialog, given a PointerEvent
+ event:
Let target be event's target.
If target is a dialog
element, target has an open
attribute, target's is modal is
+ true, and event's clientX
and
+ clientY
are outside the bounds of target,
+ then return null.
+
+
The check for clientX
and clientY
is because a pointer event that hits the ::backdrop
pseudo element of a dialog will result in event having a
+ target of the dialog element itself.
Let currentNode be target.
While currentNode is not null:
+ +If currentNode is a dialog
element and currentNode
+ has an open
attribute, then return
+ currentNode.
Set currentNode to currentNode's parent in the flat + tree.
Return null.
dialog
elements whose is modal flag is truedialog
elements whose is modal is trueAn is running cancel action boolean.
A get enabled state, an algorithm + accepting no arguments and returning a boolean. This algorithm can never throw an + exception.
A close watcher closeWatcher is
@@ -82928,8 +83188,10 @@ body { display:none }
To establish a close watcher given a
Window
window, a list
- of steps cancelAction, and a
- list of steps closeAction:
Assert: window's is running cancel action
To request to close a close - watcher closeWatcher:
+ watcher closeWatcher with boolean requireHistoryActionActivation:If closeWatcher is not active, then return true.
If the result of running closeWatcher's get enabled state is false, then return + true.
If closeWatcher's is running cancel action is true, then return true.
If window's associated
Document
is not fully active, then return true.
Let canPreventClose be true if window's close watcher
- manager's groups's size is less than window's close watcher manager's
+
+ Let canPreventClose be true if requireHistoryActionActivation is
+ false, or if window's close watcher manager's groups's size is
+ less than window's close watcher manager's allowed number of groups, and
window has history-action activation; otherwise false. If closeWatcher is not active, then
return. If the result of running closeWatcher's get enabled state is false, then return. If closeWatcher's window's associated Document
is not fully
active, then return.
Set processedACloseWatcher to true.
If the result of running closeWatcher's get enabled state is true, set + processedACloseWatcher to true.
Let shouldProceed be the result of requesting to close - closeWatcher.
If shouldProceed is false, then break.
The requestClose()
method steps are to request to close this's internal
- close watcher.
The close()
method steps are to close this's
@@ -84605,8 +84883,9 @@ dictionary DragEventInit : MouseEventInit {
If there is no relevant pointing device, then initialize event's screenX
, screenY
, clientX
, clientY
, and button
attributes to 0.
screenY
, clientX
, clientY
,
+ and button
attributes to 0.
Dispatch event at the specified @@ -85847,6 +86126,9 @@ dictionary DragEventInit : MouseEventInit {
closeAction being to hide a popover given element, true, true, and false.
getEnabledState being to return + true.
expectedDocument is not null and element's node document is not expectedDocument;
element is a dialog
element and its is modal flag
+
element is a dialog
element and its is modal
is set to true; or
element's fullscreen flag is set,
To light dismiss open popovers, given an Event
event:
To light dismiss open popovers, given a PointerEvent
+ event:
Assert: event's If topmostPopover is null, then return. If event is a If event's If event is a If event's Let ancestor be the result of running topmost clicked popover
@@ -86775,10 +87057,6 @@ dictionary DragEventInit : MouseEventInit {
Light dismiss open popovers will be called by the Pointer Events spec when the user clicks
- or touches anywhere on the page. To find the topmost clicked popover, given a DragEventInit : MouseEventInit {
PointerEvent
and event's type
is "pointerdown
",
- then: set document's popover pointerdown target to the result of running
- topmost clicked popover given target.type
is "pointerdown
", then: set document's popover
+ pointerdown target to the result of running topmost clicked popover given
+ target.PointerEvent
and event's type
is "pointerup
",
- then:type
is "pointerup
", then:
- Node
node:
@@ -142633,6 +142911,13 @@ interface External {
HTML elements
Classes to which the element belongs
Set of space-separated tokens
+
+ closedby
+ dialog
+ Which user actions will close the dialog
+ " any
";
+ "closerequest
";
+ "none
";
color
link