Skip to content

Commit e231a6f

Browse files
committed
Update closure-library to 04a8ceefc6972511e669563d47abeca18b28092c
1 parent e1d6510 commit e231a6f

File tree

190 files changed

+3761
-1813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+3761
-1813
lines changed

rake-tasks/crazy_fun/mappings/javascript.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@ def handle(fun, dir, args)
572572
formatting = !args[:no_format].nil? ? "" : '--formatting=PRETTY_PRINT'
573573
flags.push(formatting)
574574

575-
flags.push('--third_party=true') unless !flags.index('--third_party=false').nil?
576575
flags.push("--js_output_file=#{output}")
577576

578577
cmd = "" <<
@@ -845,7 +844,6 @@ def handle(fun, dir, args)
845844
(ENV['pretty_print'] == 'true') ? "--formatting=PRETTY_PRINT" : ""
846845

847846
cmd = "" <<
848-
"--third_party=false " <<
849847
"--js_output_file=#{output} " <<
850848
"--output_wrapper='#{wrapper}' " <<
851849
"--compilation_level=#{compilation_level(minify)} " <<

third_party/closure/goog/a11y/aria/aria.js

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,32 @@ goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = [
7575
];
7676

7777

78+
/**
79+
* A list of roles which are considered container roles.
80+
* Container roles are ARIA roles which use the aria-activedescendant property
81+
* to manage their active descendants or children. See
82+
* {@link http://www.w3.org/TR/wai-aria/states_and_properties
83+
* #aria-activedescendant} for more information.
84+
* @private @const
85+
*/
86+
goog.a11y.aria.CONTAINER_ROLES_ = [
87+
goog.a11y.aria.Role.COMBOBOX,
88+
goog.a11y.aria.Role.GRID,
89+
goog.a11y.aria.Role.GROUP,
90+
goog.a11y.aria.Role.LISTBOX,
91+
goog.a11y.aria.Role.MENU,
92+
goog.a11y.aria.Role.MENUBAR,
93+
goog.a11y.aria.Role.RADIOGROUP,
94+
goog.a11y.aria.Role.ROW,
95+
goog.a11y.aria.Role.ROWGROUP,
96+
goog.a11y.aria.Role.TAB_LIST,
97+
goog.a11y.aria.Role.TEXTBOX,
98+
goog.a11y.aria.Role.TOOLBAR,
99+
goog.a11y.aria.Role.TREE,
100+
goog.a11y.aria.Role.TREEGRID
101+
];
102+
103+
78104
/**
79105
* Sets the role of an element. If the roleName is
80106
* empty string or null, the role for the element is removed.
@@ -335,8 +361,8 @@ goog.a11y.aria.getStateString = function(element, stateName) {
335361
var attr = element.getAttribute(
336362
goog.a11y.aria.getAriaAttributeName_(stateName));
337363
goog.asserts.assert((attr == null || goog.isString(attr)) &&
338-
isNaN(Number(attr)) && attr != 'true' && attr != 'false');
339-
return attr == null ? null : attr;
364+
(attr == '' || isNaN(Number(attr))) && attr != 'true' && attr != 'false');
365+
return (attr == null || attr == '') ? null : attr;
340366
};
341367

342368

@@ -356,6 +382,32 @@ goog.a11y.aria.getStringArrayStateInternalUtil = function(element, stateName) {
356382
};
357383

358384

385+
/**
386+
* Returns true if element has an ARIA state/property, false otherwise.
387+
* @param {!Element} element The element to get the ARIA state for.
388+
* @param {!goog.a11y.aria.State|string} stateName the ARIA state name.
389+
* @return {boolean}
390+
*/
391+
goog.a11y.aria.hasState = function(element, stateName) {
392+
return element.hasAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
393+
};
394+
395+
396+
/**
397+
* Returns whether the element has a container ARIA role.
398+
* Container roles are ARIA roles that use the aria-activedescendant property
399+
* to manage their active descendants or children. See
400+
* {@link http://www.w3.org/TR/wai-aria/states_and_properties
401+
* #aria-activedescendant} for more information.
402+
* @param {!Element} element
403+
* @return {boolean}
404+
*/
405+
goog.a11y.aria.isContainerRole = function(element) {
406+
var role = goog.a11y.aria.getRole(element);
407+
return goog.array.contains(goog.a11y.aria.CONTAINER_ROLES_, role);
408+
};
409+
410+
359411
/**
360412
* Splits the input stringValue on whitespace.
361413
* @param {string} stringValue The value of the string to split.

third_party/closure/goog/a11y/aria/roles.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ goog.a11y.aria.Role = {
196196
// ARIA role for a textbox element.
197197
TEXTBOX: 'textbox',
198198

199+
// ARIA role for a textinfo element.
200+
TEXTINFO: 'textinfo',
201+
199202
// ARIA role for an element displaying elapsed time or time remaining.
200203
TIMER: 'timer',
201204

third_party/closure/goog/array/array.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -966,8 +966,8 @@ goog.array.removeDuplicates = function(arr, opt_rv, opt_hashFn) {
966966
var defaultHashFn = function(item) {
967967
// Prefix each type with a single character representing the type to
968968
// prevent conflicting keys (e.g. true and 'true').
969-
return goog.isObject(current) ? 'o' + goog.getUid(current) :
970-
(typeof current).charAt(0) + current;
969+
return goog.isObject(item) ? 'o' + goog.getUid(item) :
970+
(typeof item).charAt(0) + item;
971971
};
972972
var hashFn = opt_hashFn || defaultHashFn;
973973

@@ -1181,8 +1181,7 @@ goog.array.stableSort = function(arr, opt_compareFn) {
11811181
* and return a negative number, zero, or a positive number depending on
11821182
* whether the first argument is less than, equal to, or greater than the
11831183
* second.
1184-
* @template T
1185-
* @template K
1184+
* @template T,K
11861185
*/
11871186
goog.array.sortByKey = function(arr, keyFn, opt_compareFn) {
11881187
var keyCompareFn = opt_compareFn || goog.array.defaultCompare;

third_party/closure/goog/asserts/asserts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ goog.define('goog.asserts.ENABLE_ASSERTS', goog.DEBUG);
6060
goog.asserts.AssertionError = function(messagePattern, messageArgs) {
6161
messageArgs.unshift(messagePattern);
6262
goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs));
63-
// Remove the messagePattern afterwards to avoid permenantly modifying the
63+
// Remove the messagePattern afterwards to avoid permanently modifying the
6464
// passed in array.
6565
messageArgs.shift();
6666

third_party/closure/goog/async/animationdelay.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ goog.require('goog.functions');
5353
* @param {Object=} opt_handler The object scope to invoke the function in.
5454
* @constructor
5555
* @struct
56-
* @suppress {checkStructDictInheritance}
5756
* @extends {goog.Disposable}
5857
* @final
5958
*/

third_party/closure/goog/async/conditionaldelay.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ goog.require('goog.async.Delay');
6767
* @param {Object=} opt_handler The object scope to invoke the function in.
6868
* @constructor
6969
* @struct
70-
* @suppress {checkStructDictInheritance}
7170
* @extends {goog.Disposable}
7271
*/
7372
goog.async.ConditionalDelay = function(listener, opt_handler) {
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
// Copyright 2015 The Closure Library Authors. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS-IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/**
16+
* @fileoverview Definition of the goog.async.Debouncer class.
17+
*
18+
* @see ../demos/timers.html
19+
*/
20+
21+
goog.provide('goog.async.Debouncer');
22+
23+
goog.require('goog.Disposable');
24+
goog.require('goog.Timer');
25+
26+
27+
28+
/**
29+
* Debouncer will perform a specified action exactly once for any sequence of
30+
* signals fired repeatedly so long as they are fired less than a specified
31+
* interval apart (in milliseconds). Whether it receives one signal or multiple,
32+
* it will always wait until a full interval has elapsed since the last signal
33+
* before performing the action.
34+
* @param {function(this: T)} listener Function to callback when the action is
35+
* triggered.
36+
* @param {number} interval Interval over which to debounce. The listener will
37+
* only be called after the full interval has elapsed since the last signal.
38+
* @param {T=} opt_handler Object in whose scope to call the listener.
39+
* @constructor
40+
* @struct
41+
* @extends {goog.Disposable}
42+
* @final
43+
* @template T
44+
*/
45+
goog.async.Debouncer = function(listener, interval, opt_handler) {
46+
goog.async.Debouncer.base(this, 'constructor');
47+
48+
/**
49+
* Function to callback
50+
* @private {function(this: T)}
51+
*/
52+
this.listener_ = listener;
53+
54+
/**
55+
* Interval for the debounce time
56+
* @type {number}
57+
* @private
58+
*/
59+
this.interval_ = interval;
60+
61+
/**
62+
* "this" context for the listener
63+
* @type {Object|undefined}
64+
* @private
65+
*/
66+
this.handler_ = opt_handler;
67+
68+
/**
69+
* Cached callback function invoked after the debounce timeout completes
70+
* @type {Function}
71+
* @private
72+
*/
73+
this.callback_ = goog.bind(this.onTimer_, this);
74+
75+
/**
76+
* Indicates that the action is pending and needs to be fired.
77+
* @type {boolean}
78+
* @private
79+
*/
80+
this.shouldFire_ = false;
81+
82+
/**
83+
* Indicates the count of nested pauses currently in effect on the debouncer.
84+
* When this count is not zero, fired actions will be postponed until the
85+
* debouncer is resumed enough times to drop the pause count to zero.
86+
* @type {number}
87+
* @private
88+
*/
89+
this.pauseCount_ = 0;
90+
91+
/**
92+
* Timer for scheduling the next callback
93+
* @type {?number}
94+
* @private
95+
*/
96+
this.timer_ = null;
97+
};
98+
goog.inherits(goog.async.Debouncer, goog.Disposable);
99+
100+
101+
/**
102+
* Notifies the debouncer that the action has happened. It will debounce the
103+
* call so that the callback is only called after the last action in a sequence
104+
* of actions separated by periods less the interval parameter passed to the
105+
* constructor.
106+
*/
107+
goog.async.Debouncer.prototype.fire = function() {
108+
this.stop();
109+
this.timer_ = goog.Timer.callOnce(this.callback_, this.interval_);
110+
};
111+
112+
113+
/**
114+
* Cancels any pending action callback. The debouncer can be restarted by
115+
* calling {@link #fire}.
116+
*/
117+
goog.async.Debouncer.prototype.stop = function() {
118+
if (this.timer_) {
119+
goog.Timer.clear(this.timer_);
120+
this.timer_ = null;
121+
}
122+
this.shouldFire_ = false;
123+
};
124+
125+
126+
/**
127+
* Pauses the debouncer. All pending and future action callbacks will be delayed
128+
* until the debouncer is resumed. Pauses can be nested.
129+
*/
130+
goog.async.Debouncer.prototype.pause = function() {
131+
++this.pauseCount_;
132+
};
133+
134+
135+
/**
136+
* Resumes the debouncer. If doing so drops the pausing count to zero, pending
137+
* action callbacks will be executed as soon as possible, but still no sooner
138+
* than an interval's delay after the previous call. Future action callbacks
139+
* will be executed as normal.
140+
*/
141+
goog.async.Debouncer.prototype.resume = function() {
142+
if (!this.pauseCount_) {
143+
return;
144+
}
145+
146+
--this.pauseCount_;
147+
if (!this.pauseCount_ && this.shouldFire_) {
148+
this.doAction_();
149+
}
150+
};
151+
152+
153+
/** @override */
154+
goog.async.Debouncer.prototype.disposeInternal = function() {
155+
this.stop();
156+
goog.async.Debouncer.base(this, 'disposeInternal');
157+
};
158+
159+
160+
/**
161+
* Handler for the timer to fire the debouncer.
162+
* @private
163+
*/
164+
goog.async.Debouncer.prototype.onTimer_ = function() {
165+
this.timer_ = null;
166+
167+
if (!this.pauseCount_) {
168+
this.doAction_();
169+
} else {
170+
this.shouldFire_ = true;
171+
}
172+
};
173+
174+
175+
/**
176+
* Calls the callback.
177+
* @private
178+
*/
179+
goog.async.Debouncer.prototype.doAction_ = function() {
180+
this.shouldFire_ = false;
181+
this.listener_.call(this.handler_);
182+
};

third_party/closure/goog/async/delay.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ goog.require('goog.Timer');
4444
* @template THIS
4545
* @constructor
4646
* @struct
47-
* @suppress {checkStructDictInheritance}
4847
* @extends {goog.Disposable}
4948
* @final
5049
*/
@@ -129,6 +128,19 @@ goog.async.Delay.prototype.start = function(opt_interval) {
129128
};
130129

131130

131+
/**
132+
* Starts the delay timer if it's not already active.
133+
* @param {number=} opt_interval If specified and the timer is not already
134+
* active, overrides the object's default interval with this one (in
135+
* milliseconds).
136+
*/
137+
goog.async.Delay.prototype.startIfNotActive = function(opt_interval) {
138+
if (!this.isActive()) {
139+
this.start(opt_interval);
140+
}
141+
};
142+
143+
132144
/**
133145
* Stops the delay timer if it is active. No action is taken if the timer is not
134146
* in use.

third_party/closure/goog/async/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ goog.async.run.initializeRunner_ = function() {
5151
// on a fulfilled promise, which is specified to be async, but as fast as
5252
// possible.
5353
if (goog.global.Promise && goog.global.Promise.resolve) {
54-
var promise = goog.global.Promise.resolve();
54+
var promise = goog.global.Promise.resolve(undefined);
5555
goog.async.run.schedule_ = function() {
5656
promise.then(goog.async.run.processWorkQueue);
5757
};

0 commit comments

Comments
 (0)