| Index: third_party/google_input_tools/third_party/closure_library/closure/goog/events/eventhandler.js
|
| diff --git a/third_party/google_input_tools/third_party/closure_library/closure/goog/events/eventhandler.js b/third_party/google_input_tools/third_party/closure_library/closure/goog/events/eventhandler.js
|
| index 70071f9a6b9419b62c779bdb4fa2e527e287fa75..19437b988bddcf4d30858354d91011338a30d3c4 100644
|
| --- a/third_party/google_input_tools/third_party/closure_library/closure/goog/events/eventhandler.js
|
| +++ b/third_party/google_input_tools/third_party/closure_library/closure/goog/events/eventhandler.js
|
| @@ -76,13 +76,13 @@ goog.forwardDeclare('goog.events.EventWrapper');
|
| */
|
| goog.events.EventHandler = function(opt_scope) {
|
| goog.Disposable.call(this);
|
| - // TODO(user): Rename this to this.scope_ and fix the classes in google3
|
| + // TODO(mknichel): Rename this to this.scope_ and fix the classes in google3
|
| // that access this private variable. :(
|
| this.handler_ = opt_scope;
|
|
|
| /**
|
| * Keys for events that are being listened to.
|
| - * @type {!Object.<!goog.events.Key>}
|
| + * @type {!Object<!goog.events.Key>}
|
| * @private
|
| */
|
| this.keys_ = {};
|
| @@ -94,7 +94,7 @@ goog.inherits(goog.events.EventHandler, goog.Disposable);
|
| * Utility array used to unify the cases of listening for an array of types
|
| * and listening for a single event, without using recursion or allocating
|
| * an array each time.
|
| - * @type {!Array.<string>}
|
| + * @type {!Array<string>}
|
| * @const
|
| * @private
|
| */
|
| @@ -105,14 +105,14 @@ goog.events.EventHandler.typeArray_ = [];
|
| * Listen to an event on a Listenable. If the function is omitted then the
|
| * EventHandler's handleEvent method will be used.
|
| * @param {goog.events.ListenableType} src Event source.
|
| - * @param {string|Array.<string>|
|
| - * !goog.events.EventId.<EVENTOBJ>|!Array.<!goog.events.EventId.<EVENTOBJ>>}
|
| + * @param {string|Array<string>|
|
| + * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>}
|
| * type Event type to listen for or array of event types.
|
| * @param {function(this:SCOPE, EVENTOBJ):?|{handleEvent:function(?):?}|null=}
|
| * opt_fn Optional callback function to be used as the listener or an object
|
| * with handleEvent function.
|
| * @param {boolean=} opt_capture Optional whether to use capture phase.
|
| - * @return {!goog.events.EventHandler.<SCOPE>} This object, allowing for
|
| + * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for
|
| * chaining of calls.
|
| * @template EVENTOBJ
|
| */
|
| @@ -126,21 +126,21 @@ goog.events.EventHandler.prototype.listen = function(
|
| * Listen to an event on a Listenable. If the function is omitted then the
|
| * EventHandler's handleEvent method will be used.
|
| * @param {goog.events.ListenableType} src Event source.
|
| - * @param {string|Array.<string>|
|
| - * !goog.events.EventId.<EVENTOBJ>|!Array.<!goog.events.EventId.<EVENTOBJ>>}
|
| + * @param {string|Array<string>|
|
| + * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>}
|
| * type Event type to listen for or array of event types.
|
| * @param {function(this:T, EVENTOBJ):?|{handleEvent:function(this:T, ?):?}|
|
| * null|undefined} fn Optional callback function to be used as the
|
| * listener or an object with handleEvent function.
|
| * @param {boolean|undefined} capture Optional whether to use capture phase.
|
| * @param {T} scope Object in whose scope to call the listener.
|
| - * @return {!goog.events.EventHandler.<SCOPE>} This object, allowing for
|
| + * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for
|
| * chaining of calls.
|
| * @template T,EVENTOBJ
|
| */
|
| goog.events.EventHandler.prototype.listenWithScope = function(
|
| src, type, fn, capture, scope) {
|
| - // TODO(user): Deprecate this function.
|
| + // TODO(mknichel): Deprecate this function.
|
| return this.listen_(src, type, fn, capture, scope);
|
| };
|
|
|
| @@ -149,15 +149,15 @@ goog.events.EventHandler.prototype.listenWithScope = function(
|
| * Listen to an event on a Listenable. If the function is omitted then the
|
| * EventHandler's handleEvent method will be used.
|
| * @param {goog.events.ListenableType} src Event source.
|
| - * @param {string|Array.<string>|
|
| - * !goog.events.EventId.<EVENTOBJ>|!Array.<!goog.events.EventId.<EVENTOBJ>>}
|
| + * @param {string|Array<string>|
|
| + * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>}
|
| * type Event type to listen for or array of event types.
|
| * @param {function(EVENTOBJ):?|{handleEvent:function(?):?}|null=} opt_fn
|
| * Optional callback function to be used as the listener or an object with
|
| * handleEvent function.
|
| * @param {boolean=} opt_capture Optional whether to use capture phase.
|
| * @param {Object=} opt_scope Object in whose scope to call the listener.
|
| - * @return {!goog.events.EventHandler.<SCOPE>} This object, allowing for
|
| + * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for
|
| * chaining of calls.
|
| * @template EVENTOBJ
|
| * @private
|
| @@ -198,21 +198,19 @@ goog.events.EventHandler.prototype.listen_ = function(src, type, opt_fn,
|
| * event listener is removed from the target. If an array of event types is
|
| * provided, each event type will be listened to once.
|
| * @param {goog.events.ListenableType} src Event source.
|
| - * @param {string|Array.<string>|
|
| - * !goog.events.EventId.<EVENTOBJ>|!Array.<!goog.events.EventId.<EVENTOBJ>>}
|
| + * @param {string|Array<string>|
|
| + * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>}
|
| * type Event type to listen for or array of event types.
|
| * @param {function(this:SCOPE, EVENTOBJ):?|{handleEvent:function(?):?}|null=} opt_fn
|
| * Optional callback function to be used as the listener or an object with
|
| * handleEvent function.
|
| * @param {boolean=} opt_capture Optional whether to use capture phase.
|
| - * @return {!goog.events.EventHandler.<SCOPE>} This object, allowing for
|
| + * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for
|
| * chaining of calls.
|
| * @template EVENTOBJ
|
| */
|
| goog.events.EventHandler.prototype.listenOnce = function(
|
| src, type, opt_fn, opt_capture) {
|
| - // TODO(user): Remove the opt_scope from this function and then
|
| - // templatize it.
|
| return this.listenOnce_(src, type, opt_fn, opt_capture);
|
| };
|
|
|
| @@ -223,21 +221,21 @@ goog.events.EventHandler.prototype.listenOnce = function(
|
| * event listener is removed from the target. If an array of event types is
|
| * provided, each event type will be listened to once.
|
| * @param {goog.events.ListenableType} src Event source.
|
| - * @param {string|Array.<string>|
|
| - * !goog.events.EventId.<EVENTOBJ>|!Array.<!goog.events.EventId.<EVENTOBJ>>}
|
| + * @param {string|Array<string>|
|
| + * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>}
|
| * type Event type to listen for or array of event types.
|
| * @param {function(this:T, EVENTOBJ):?|{handleEvent:function(this:T, ?):?}|
|
| * null|undefined} fn Optional callback function to be used as the
|
| * listener or an object with handleEvent function.
|
| * @param {boolean|undefined} capture Optional whether to use capture phase.
|
| * @param {T} scope Object in whose scope to call the listener.
|
| - * @return {!goog.events.EventHandler.<SCOPE>} This object, allowing for
|
| + * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for
|
| * chaining of calls.
|
| * @template T,EVENTOBJ
|
| */
|
| goog.events.EventHandler.prototype.listenOnceWithScope = function(
|
| src, type, fn, capture, scope) {
|
| - // TODO(user): Deprecate this function.
|
| + // TODO(mknichel): Deprecate this function.
|
| return this.listenOnce_(src, type, fn, capture, scope);
|
| };
|
|
|
| @@ -248,15 +246,15 @@ goog.events.EventHandler.prototype.listenOnceWithScope = function(
|
| * the event listener is removed from the target. If an array of event types is
|
| * provided, each event type will be listened to once.
|
| * @param {goog.events.ListenableType} src Event source.
|
| - * @param {string|Array.<string>|
|
| - * !goog.events.EventId.<EVENTOBJ>|!Array.<!goog.events.EventId.<EVENTOBJ>>}
|
| + * @param {string|Array<string>|
|
| + * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>}
|
| * type Event type to listen for or array of event types.
|
| * @param {function(EVENTOBJ):?|{handleEvent:function(?):?}|null=} opt_fn
|
| * Optional callback function to be used as the listener or an object with
|
| * handleEvent function.
|
| * @param {boolean=} opt_capture Optional whether to use capture phase.
|
| * @param {Object=} opt_scope Object in whose scope to call the listener.
|
| - * @return {!goog.events.EventHandler.<SCOPE>} This object, allowing for
|
| + * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for
|
| * chaining of calls.
|
| * @template EVENTOBJ
|
| * @private
|
| @@ -298,12 +296,12 @@ goog.events.EventHandler.prototype.listenOnce_ = function(
|
| * Callback method, or an object with a handleEvent function.
|
| * @param {boolean=} opt_capt Whether to fire in capture phase (defaults to
|
| * false).
|
| - * @return {!goog.events.EventHandler.<SCOPE>} This object, allowing for
|
| + * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for
|
| * chaining of calls.
|
| */
|
| goog.events.EventHandler.prototype.listenWithWrapper = function(
|
| src, wrapper, listener, opt_capt) {
|
| - // TODO(user): Remove the opt_scope from this function and then
|
| + // TODO(mknichel): Remove the opt_scope from this function and then
|
| // templatize it.
|
| return this.listenWithWrapper_(src, wrapper, listener, opt_capt);
|
| };
|
| @@ -322,13 +320,13 @@ goog.events.EventHandler.prototype.listenWithWrapper = function(
|
| * listener or an object with handleEvent function.
|
| * @param {boolean|undefined} capture Optional whether to use capture phase.
|
| * @param {T} scope Object in whose scope to call the listener.
|
| - * @return {!goog.events.EventHandler.<SCOPE>} This object, allowing for
|
| + * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for
|
| * chaining of calls.
|
| * @template T
|
| */
|
| goog.events.EventHandler.prototype.listenWithWrapperAndScope = function(
|
| src, wrapper, listener, capture, scope) {
|
| - // TODO(user): Deprecate this function.
|
| + // TODO(mknichel): Deprecate this function.
|
| return this.listenWithWrapper_(src, wrapper, listener, capture, scope);
|
| };
|
|
|
| @@ -346,7 +344,7 @@ goog.events.EventHandler.prototype.listenWithWrapperAndScope = function(
|
| * @param {boolean=} opt_capt Whether to fire in capture phase (defaults to
|
| * false).
|
| * @param {Object=} opt_scope Element in whose scope to call the listener.
|
| - * @return {!goog.events.EventHandler.<SCOPE>} This object, allowing for
|
| + * @return {!goog.events.EventHandler<SCOPE>} This object, allowing for
|
| * chaining of calls.
|
| * @private
|
| */
|
| @@ -375,8 +373,8 @@ goog.events.EventHandler.prototype.getListenerCount = function() {
|
| /**
|
| * Unlistens on an event.
|
| * @param {goog.events.ListenableType} src Event source.
|
| - * @param {string|Array.<string>|
|
| - * !goog.events.EventId.<EVENTOBJ>|!Array.<!goog.events.EventId.<EVENTOBJ>>}
|
| + * @param {string|Array<string>|
|
| + * !goog.events.EventId<EVENTOBJ>|!Array<!goog.events.EventId<EVENTOBJ>>}
|
| * type Event type or array of event types to unlisten to.
|
| * @param {function(EVENTOBJ):?|{handleEvent:function(?):?}|null=} opt_fn
|
| * Optional callback function to be used as the listener or an object with
|
| @@ -436,7 +434,12 @@ goog.events.EventHandler.prototype.unlistenWithWrapper = function(src, wrapper,
|
| * Unlistens to all events.
|
| */
|
| goog.events.EventHandler.prototype.removeAll = function() {
|
| - goog.object.forEach(this.keys_, goog.events.unlistenByKey);
|
| + goog.object.forEach(this.keys_, function(listenerObj, key) {
|
| + if (this.keys_.hasOwnProperty(key)) {
|
| + goog.events.unlistenByKey(listenerObj);
|
| + }
|
| + }, this);
|
| +
|
| this.keys_ = {};
|
| };
|
|
|
|
|