Skip to content

Commit 99b3a16

Browse files
committed
rename Invokers features from invoke to command
https://bugs.webkit.org/show_bug.cgi?id=276616 Reviewed by Anne van Kesteren. This renames the attributes invoketarget->commandfor and invokeaction->command, as well as renaming the InvokeEvent to CommandEvent, and it's action property to command. It also drops the `auto` action, requiring explicit `command` attribute for each action. Lastly, this also adds the logic preventing invokers from being triggered within a form without an explicit type=button attribute. These changes are based on a set of discussions around the proposals naming and semantics, which starts here: whatwg/html#9625 (comment) and concludes here; whatwg/html#9625 (comment) * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/idlharness.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeelement-interface.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invokeevent-interface.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-popover-invalid-behavior.tentative-expected.txt: * LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative-expected.txt. * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/CMakeLists.txt: * Source/WebCore/DerivedSources-input.xcfilelist: * Source/WebCore/DerivedSources-output.xcfilelist: * Source/WebCore/DerivedSources.make: * Source/WebCore/Headers.cmake: * Source/WebCore/SmartPointerExpectations/UncountedLocalVarsCheckerExpectations: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/bindings/js/WebCoreBuiltinNames.h: * Source/WebCore/dom/CommandEvent.cpp: Renamed from Source/WebCore/dom/InvokeEvent.cpp. (WebCore::CommandEvent::CommandEvent): (WebCore::CommandEvent::create): (WebCore::CommandEvent::createForBindings): (WebCore::CommandEvent::isCommandEvent const): (WebCore::CommandEvent::invoker const): * Source/WebCore/dom/CommandEvent.h: Renamed from Source/WebCore/dom/InvokeEvent.h. * Source/WebCore/dom/CommandEvent.idl: Renamed from Source/WebCore/dom/InvokeEvent.idl. * Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h: * Source/WebCore/dom/Document.cpp: (WebCore::Document::handlePopoverLightDismiss): * Source/WebCore/dom/Element.cpp: (WebCore::Element::isElementReflectionAttribute): * Source/WebCore/dom/Element.h: (WebCore::Element::isValidCommandType): (WebCore::Element::handleCommandInternal): (WebCore::Element::isValidInvokeAction): Deleted. (WebCore::Element::handleInvokeInternal): Deleted. * Source/WebCore/dom/Event.h: (WebCore::Event::isCommandEvent const): (WebCore::Event::isInputEvent const): (WebCore::Event::isInvokeEvent const): Deleted. * Source/WebCore/dom/EventInterfaces.in: * Source/WebCore/dom/EventNames.json: * Source/WebCore/html/HTMLAttributeNames.in: * Source/WebCore/html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::defaultEventHandler): * Source/WebCore/html/HTMLDialogElement.cpp: (WebCore::HTMLDialogElement::isValidCommandType): (WebCore::HTMLDialogElement::handleCommandInternal): (WebCore::HTMLDialogElement::isValidInvokeAction): Deleted. (WebCore::HTMLDialogElement::handleInvokeInternal): Deleted. * Source/WebCore/html/HTMLDialogElement.h: * Source/WebCore/html/HTMLElement.cpp: (WebCore::HTMLElement::isValidCommandType): (WebCore::HTMLElement::handleCommandInternal): (WebCore::HTMLElement::isValidInvokeAction): Deleted. (WebCore::HTMLElement::handleInvokeInternal): Deleted. * Source/WebCore/html/HTMLElement.h: * Source/WebCore/html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::commandForElement const): (WebCore::HTMLFormControlElement::commandType const): (WebCore::HTMLFormControlElement::handleCommand): (WebCore::HTMLFormControlElement::invokeTargetElement const): Deleted. (WebCore::HTMLFormControlElement::invokeAction const): Deleted. (WebCore::HTMLFormControlElement::handleInvokeAction): Deleted. * Source/WebCore/html/HTMLFormControlElement.h: * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::defaultEventHandler): * Source/WebCore/html/InvokerElement.idl: * Source/WebCore/page/FragmentDirective.h: Canonical link: https://commits.webkit.org/281345@main
1 parent 117bd2d commit 99b3a16

40 files changed

+271
-241
lines changed

LayoutTests/imported/w3c/web-platform-tests/html/semantics/invokers/idlharness.tentative-expected.txt

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ PASS Element includes ParentNode: member names are unique
55
PASS Element includes NonDocumentTypeChildNode: member names are unique
66
PASS Element includes ChildNode: member names are unique
77
PASS Element includes Slottable: member names are unique
8-
FAIL CommandEvent interface: existence and properties of interface object assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing
9-
FAIL CommandEvent interface object length assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing
10-
FAIL CommandEvent interface object name assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing
11-
FAIL CommandEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing
12-
FAIL CommandEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing
13-
FAIL CommandEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing
14-
FAIL CommandEvent interface: attribute invoker assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing
15-
FAIL CommandEvent interface: attribute command assert_own_property: self does not have own property "CommandEvent" expected property "CommandEvent" missing
16-
FAIL CommandEvent must be primary interface of new CommandEvent("invoke") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: CommandEvent"
17-
FAIL Stringification of new CommandEvent("invoke") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: CommandEvent"
18-
FAIL CommandEvent interface: new CommandEvent("invoke") must inherit property "invoker" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: CommandEvent"
19-
FAIL CommandEvent interface: new CommandEvent("invoke") must inherit property "command" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: CommandEvent"
8+
PASS CommandEvent interface: existence and properties of interface object
9+
PASS CommandEvent interface object length
10+
PASS CommandEvent interface object name
11+
PASS CommandEvent interface: existence and properties of interface prototype object
12+
PASS CommandEvent interface: existence and properties of interface prototype object's "constructor" property
13+
PASS CommandEvent interface: existence and properties of interface prototype object's @@unscopables property
14+
PASS CommandEvent interface: attribute invoker
15+
PASS CommandEvent interface: attribute command
16+
PASS CommandEvent must be primary interface of new CommandEvent("invoke")
17+
PASS Stringification of new CommandEvent("invoke")
18+
PASS CommandEvent interface: new CommandEvent("invoke") must inherit property "invoker" with the proper type
19+
PASS CommandEvent interface: new CommandEvent("invoke") must inherit property "command" with the proper type
2020

Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11

22

3-
FAIL commandForElement reflects invokee HTML element assert_equals: expected (object) Element node <div id="invokee"></div> but got (undefined) undefined
4-
FAIL commandForElement reflects set value assert_equals: expected "" but got "invokee"
5-
FAIL commandForElement reflects set value across shadow root into light dom assert_equals: expected "" but got "invokee"
6-
FAIL commandForElement does not reflect set value inside shadowroot assert_equals: expected null but got Element node <div></div>
7-
FAIL commandForElement throws error on assignment of non Element assert_throws_js: commandForElement attribute must be an instance of Element function "function () {
8-
invoker.commandForElement = {};
9-
}" did not throw
10-
FAIL command reflects '' when attribute empty, setAttribute version assert_equals: expected (string) "" but got (undefined) undefined
11-
FAIL command reflects same casing assert_equals: expected "fooBarBaz" but got ""
3+
PASS commandForElement reflects invokee HTML element
4+
PASS commandForElement reflects set value
5+
PASS commandForElement reflects set value across shadow root into light dom
6+
PASS commandForElement does not reflect set value inside shadowroot
7+
PASS commandForElement throws error on assignment of non Element
8+
PASS command reflects '' when attribute empty, setAttribute version
9+
PASS command reflects same casing
1210
PASS command reflects '' when attribute empty, IDL version
13-
FAIL command reflects tostring value assert_equals: expected "1,2,3" but got ""
14-
FAIL command reflects '' when attribute set to [] assert_equals: expected (string) "" but got (object) []
15-
FAIL command reflects tostring value 2 assert_equals: expected (string) "[object Object]" but got (object) object "[object Object]"
11+
PASS command reflects tostring value
12+
PASS command reflects '' when attribute set to []
13+
PASS command reflects tostring value 2
1614

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22

3-
FAIL CommandEvent propagates across shadow boundaries retargeting invoker Can't find variable: CommandEvent
4-
FAIL cross shadow CommandEvent retargets invoker to host element Can't find variable: CommandEvent
3+
PASS CommandEvent propagates across shadow boundaries retargeting invoker
4+
PASS cross shadow CommandEvent retargets invoker to host element
55

Original file line numberDiff line numberDiff line change
@@ -1,42 +1,25 @@
11

22

3-
FAIL command is a readonly defaulting to '' Can't find variable: CommandEvent
4-
FAIL invoker is readonly defaulting to null Can't find variable: CommandEvent
5-
FAIL command reflects initialized attribute Can't find variable: CommandEvent
6-
FAIL command set to undefined Can't find variable: CommandEvent
7-
FAIL command set to null Can't find variable: CommandEvent
8-
FAIL command set to false Can't find variable: CommandEvent
9-
FAIL command explicitly set to empty string Can't find variable: CommandEvent
10-
FAIL command set to true Can't find variable: CommandEvent
11-
FAIL command set to a number Can't find variable: CommandEvent
12-
FAIL command set to [] Can't find variable: CommandEvent
13-
FAIL command set to [1, 2, 3] Can't find variable: CommandEvent
14-
FAIL command set to an object Can't find variable: CommandEvent
15-
FAIL command set to an object with a toString function Can't find variable: CommandEvent
16-
FAIL CommandEventInit properties set value Can't find variable: CommandEvent
17-
FAIL CommandEventInit properties set value 2 Can't find variable: CommandEvent
18-
FAIL CommandEventInit properties set value 3 Can't find variable: CommandEvent
19-
FAIL invoker set to undefined Can't find variable: CommandEvent
20-
FAIL invoker set to null Can't find variable: CommandEvent
21-
FAIL invoker set to false assert_throws_js: invoker is not an object function "function () {
22-
new CommandEvent("test", { invoker: false });
23-
}" threw object "ReferenceError: Can't find variable: CommandEvent" ("ReferenceError") expected instance of function "function TypeError() {
24-
[native code]
25-
}" ("TypeError")
26-
FAIL invoker set to true assert_throws_js: invoker is not an object function "function () {
27-
const event = new CommandEvent("test", { invoker: true });
28-
}" threw object "ReferenceError: Can't find variable: CommandEvent" ("ReferenceError") expected instance of function "function TypeError() {
29-
[native code]
30-
}" ("TypeError")
31-
FAIL invoker set to {} assert_throws_js: invoker is not an object function "function () {
32-
const event = new CommandEvent("test", { invoker: {} });
33-
}" threw object "ReferenceError: Can't find variable: CommandEvent" ("ReferenceError") expected instance of function "function TypeError() {
34-
[native code]
35-
}" ("TypeError")
36-
FAIL invoker set to non-Element EventTarget assert_throws_js: invoker is not an Element function "function () {
37-
const eventInit = { command: "closed", invoker: new XMLHttpRequest() };
38-
const event = new CommandEvent("toggle", eventInit);
39-
}" threw object "ReferenceError: Can't find variable: CommandEvent" ("ReferenceError") expected instance of function "function TypeError() {
40-
[native code]
41-
}" ("TypeError")
3+
PASS command is a readonly defaulting to ''
4+
PASS invoker is readonly defaulting to null
5+
PASS command reflects initialized attribute
6+
PASS command set to undefined
7+
PASS command set to null
8+
PASS command set to false
9+
PASS command explicitly set to empty string
10+
PASS command set to true
11+
PASS command set to a number
12+
PASS command set to []
13+
PASS command set to [1, 2, 3]
14+
PASS command set to an object
15+
PASS command set to an object with a toString function
16+
PASS CommandEventInit properties set value
17+
PASS CommandEventInit properties set value 2
18+
PASS CommandEventInit properties set value 3
19+
PASS invoker set to undefined
20+
PASS invoker set to null
21+
PASS invoker set to false
22+
PASS invoker set to true
23+
PASS invoker set to {}
24+
PASS invoker set to non-Element EventTarget
4225

Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11

22

3-
FAIL event dispatches on click promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
4-
FAIL setting custom command property to -foo (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
5-
FAIL setting custom command attribute to -foo (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
6-
FAIL setting custom command property to foo- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
7-
FAIL setting custom command attribute to foo- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
8-
FAIL setting custom command property to cAsE-cArRiEs (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
9-
FAIL setting custom command attribute to cAsE-cArRiEs (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
10-
FAIL setting custom command property to - (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
11-
FAIL setting custom command attribute to - (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
12-
FAIL setting custom command property to -a- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
13-
FAIL setting custom command attribute to -a- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
14-
FAIL setting custom command property to a-b (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
15-
FAIL setting custom command attribute to a-b (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
16-
FAIL setting custom command property to --- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
17-
FAIL setting custom command attribute to --- (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
18-
FAIL setting custom command property to show-picker (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
19-
FAIL setting custom command attribute to show-picker (must include dash) sets event command promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: CommandEvent"
3+
PASS event dispatches on click
4+
PASS setting custom command property to -foo (must include dash) sets event command
5+
PASS setting custom command attribute to -foo (must include dash) sets event command
6+
PASS setting custom command property to foo- (must include dash) sets event command
7+
PASS setting custom command attribute to foo- (must include dash) sets event command
8+
PASS setting custom command property to cAsE-cArRiEs (must include dash) sets event command
9+
PASS setting custom command attribute to cAsE-cArRiEs (must include dash) sets event command
10+
PASS setting custom command property to - (must include dash) sets event command
11+
PASS setting custom command attribute to - (must include dash) sets event command
12+
PASS setting custom command property to -a- (must include dash) sets event command
13+
PASS setting custom command attribute to -a- (must include dash) sets event command
14+
PASS setting custom command property to a-b (must include dash) sets event command
15+
PASS setting custom command attribute to a-b (must include dash) sets event command
16+
PASS setting custom command property to --- (must include dash) sets event command
17+
PASS setting custom command attribute to --- (must include dash) sets event command
18+
PASS setting custom command property to show-picker (must include dash) sets event command
19+
PASS setting custom command attribute to show-picker (must include dash) sets event command
2020
PASS setting custom command property to foo (no dash) did not dispatch an event
2121
PASS setting custom command attribute to foo (no dash) did not dispatch an event
2222
PASS setting custom command property to foobar (no dash) did not dispatch an event
@@ -30,6 +30,6 @@ PASS setting custom command attribute to hidedocument (no dash) did not dispatch
3030
PASS event does not dispatch if click:preventDefault is called
3131
PASS event does not dispatch if invoker is disabled
3232
PASS event does not dispatch if invoker is form associated without `type`
33-
FAIL event dispatches if invoker is form associated with `type=button` assert_true: event was not called expected true got false
34-
FAIL event dispatches if invokee is non-HTML Element assert_equals: expected (object) Element node <svg id="svg-invokee"></svg> but got (undefined) undefined
33+
PASS event dispatches if invoker is form associated with `type=button`
34+
PASS event dispatches if invokee is non-HTML Element
3535

0 commit comments

Comments
 (0)