Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: sky/specs/apis.md

Issue 752093003: Specs: clean up event listeners a bit. Drop the pointless (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/specs/apis.md
diff --git a/sky/specs/apis.md b/sky/specs/apis.md
index 0e559d3c53e7e42f6bfac06a760d767adb66a699..c5556bccf0c2e59422d23f6d413f35ddf61e9888 100644
--- a/sky/specs/apis.md
+++ b/sky/specs/apis.md
@@ -16,17 +16,24 @@ module 'sky:core' {
attribute any data; // O(1)
readonly attribute EventTarget target; // O(1)
- void preventDefault(); // O(1)
- attribute any result; // O(1) // defaults to undefined
+ attribute Boolean handled; // O(1)
+ attribute any result; // O(1)
// TODO(ianh): do events get blocked at scope boundaries, e.g. focus events when both sides are in the scope?
- // TODO(ianh): do events ger retargetted, e.g. focus when leaving a custom element?
+ // TODO(ianh): do events get retargetted, e.g. focus when leaving a custom element?
}
- callback EventListener any (Event event); // return value is assigned to Event.result
+ callback EventListener any (Event event);
+ // if the return value is not undefined:
+ // assign it to event.result
+ // set event.handled to true
abstract class EventTarget {
- any dispatchEvent(Event event); // O(N) in total number of listeners for this type in the chain // returns Event.result
+ any dispatchEvent(Event event); // O(N) in total number of listeners for this type in the chain
+ // sets event.handled to false and event.result to undefined
+ // makes a record of the event target chain
+ // invokes all the handlers on the chain in turn
+ // returns event.result
void addEventListener(String type, EventListener listener); // O(1)
void removeEventListener(String type, EventListener listener); // O(N) in event listeners with that type
private Array<String> getRegisteredEventListenerTypes(); // O(N)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698