Skip to content

Commit 09ec0b8

Browse files
johnjbartonjleyba
authored andcommitted
Refactor goog.array.ArrayLike -> IArrayLike.
As suggested by the Closure library team, goog.array.ArrayLike is obsolete, IArrayLike should replace it to encourage better typechecking. See also https://docs.google.com/document/d/1eNpI_02NYb8K-x014Jo8iO6wjlpQQttDO3mVYZUXVtQ Fixes #1771 Signed-off-by: Jason Leyba <[email protected]>
1 parent aa924a8 commit 09ec0b8

File tree

16 files changed

+29
-29
lines changed

16 files changed

+29
-29
lines changed

javascript/atoms/inject.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ bot.inject.wrapValue = function(value) {
110110
return value.toString();
111111

112112
case 'array':
113-
return goog.array.map(/**@type {goog.array.ArrayLike}*/ (value),
113+
return goog.array.map(/**@type {IArrayLike}*/ (value),
114114
bot.inject.wrapValue);
115115

116116
case 'object':
@@ -141,7 +141,7 @@ bot.inject.wrapValue = function(value) {
141141
}
142142

143143
if (goog.isArrayLike(value)) {
144-
return goog.array.map(/**@type {goog.array.ArrayLike}*/ (value),
144+
return goog.array.map(/**@type {IArrayLike}*/ (value),
145145
bot.inject.wrapValue);
146146
}
147147

@@ -165,7 +165,7 @@ bot.inject.wrapValue = function(value) {
165165
*/
166166
bot.inject.unwrapValue = function(value, opt_doc) {
167167
if (goog.isArray(value)) {
168-
return goog.array.map(/**@type {goog.array.ArrayLike}*/ (value),
168+
return goog.array.map(/**@type {IArrayLike}*/ (value),
169169
function(v) { return bot.inject.unwrapValue(v, opt_doc); });
170170
} else if (goog.isObject(value)) {
171171
if (typeof value == 'function') {

javascript/atoms/locators/classname.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ bot.locators.className.single = function(target, root) {
8080
* @param {string} target The class name to search for.
8181
* @param {!(Document|Element)} root The document or element to perform the
8282
* search under.
83-
* @return {!goog.array.ArrayLike} All matching elements, or an empty list.
83+
* @return {!IArrayLike} All matching elements, or an empty list.
8484
*/
8585
bot.locators.className.many = function(target, root) {
8686
if (!target) {

javascript/atoms/locators/css.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ bot.locators.css.single = function(target, root) {
7070
* @param {string} target The selector to search for.
7171
* @param {!(Document|Element)} root The document or element to perform the
7272
* search under.
73-
* @return {!goog.array.ArrayLike} All matching elements, or an empty list.
73+
* @return {!IArrayLike} All matching elements, or an empty list.
7474
*/
7575
bot.locators.css.many = function(target, root) {
7676
if (!goog.isFunction(root['querySelectorAll']) &&

javascript/atoms/locators/id.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ bot.locators.id.single = function(target, root) {
7171
* @param {string} target The id to search for.
7272
* @param {!(Document|Element)} root The document or element to perform the
7373
* search under.
74-
* @return {!goog.array.ArrayLike} All matching elements, or an empty list.
74+
* @return {!IArrayLike} All matching elements, or an empty list.
7575
*/
7676
bot.locators.id.many = function(target, root) {
7777
if (!target) {

javascript/atoms/locators/link_text.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ bot.locators.linkText.single_ = function(target, root, opt_isPartial) {
6363
* search under.
6464
* @param {boolean} opt_isPartial Whether the link text needs to be matched
6565
* only partially.
66-
* @return {goog.array.ArrayLike} All matching elements, or an empty list.
66+
* @return {IArrayLike} All matching elements, or an empty list.
6767
* @private
6868
*/
6969
bot.locators.linkText.many_ = function(target, root, opt_isPartial) {
@@ -102,7 +102,7 @@ bot.locators.linkText.single = function(target, root) {
102102
* @param {string} target The link text to search for.
103103
* @param {!(Document|Element)} root The document or element to perform the
104104
* search under.
105-
* @return {goog.array.ArrayLike} All matching elements, or an empty list.
105+
* @return {IArrayLike} All matching elements, or an empty list.
106106
*/
107107
bot.locators.linkText.many = function(target, root) {
108108
return bot.locators.linkText.many_(target, root, false);
@@ -127,7 +127,7 @@ bot.locators.partialLinkText.single = function(target, root) {
127127
* @param {string} target The link text to search for.
128128
* @param {!(Document|Element)} root The document or element to perform the
129129
* search under.
130-
* @return {goog.array.ArrayLike} All matching elements, or an empty list.
130+
* @return {IArrayLike} All matching elements, or an empty list.
131131
*/
132132
bot.locators.partialLinkText.many = function(target, root) {
133133
return bot.locators.linkText.many_(target, root, true);

javascript/atoms/locators/locators.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ goog.require('bot.locators.name');
3131
goog.require('bot.locators.partialLinkText');
3232
goog.require('bot.locators.tagName');
3333
goog.require('bot.locators.xpath');
34-
goog.require('goog.array'); // for the goog.array.ArrayLike typedef
34+
goog.require('goog.array'); // for the IArrayLike typedef
3535
goog.require('goog.object');
3636

3737

3838
/**
3939
* @typedef {{single:function(string,!(Document|Element)):Element,
40-
* many:function(string,!(Document|Element)):!goog.array.ArrayLike}}
40+
* many:function(string,!(Document|Element)):!IArrayLike}}
4141
*/
4242
bot.locators.strategy;
4343

@@ -142,7 +142,7 @@ bot.locators.findElement = function(target, opt_root) {
142142
* @param {!Object} target The selector to search for.
143143
* @param {(Document|Element)=} opt_root The node from which to start the
144144
* search. If not specified, will use {@code document} as the root.
145-
* @return {!goog.array.ArrayLike.<Element>} All matching elements found in the
145+
* @return {!IArrayLike.<Element>} All matching elements found in the
146146
* DOM.
147147
*/
148148
bot.locators.findElements = function(target, opt_root) {

javascript/atoms/locators/name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bot.locators.name.single = function(target, root) {
4747
* @param {string} target The name to search for.
4848
* @param {!(Document|Element)} root The document or element to perform the
4949
* search under.
50-
* @return {!goog.array.ArrayLike} All matching elements, or an empty list.
50+
* @return {!IArrayLike} All matching elements, or an empty list.
5151
*/
5252
bot.locators.name.many = function(target, root) {
5353
var dom = goog.dom.getDomHelper(root);

javascript/atoms/locators/tag_name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bot.locators.tagName.single = function(target, root) {
4444
* @param {string} target The tag name to search for.
4545
* @param {!(Document|Element)} root The document or element to perform the
4646
* search under.
47-
* @return {goog.array.ArrayLike} All matching elements, or an empty list.
47+
* @return {IArrayLike} All matching elements, or an empty list.
4848
*/
4949
bot.locators.tagName.many = function(target, root) {
5050
if (target === "") {

javascript/atoms/locators/xpath.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ bot.locators.xpath.single = function(target, root) {
222222
* @param {string} target The xpath to search for.
223223
* @param {!(Document|Element)} root The document or element to perform the
224224
* search under.
225-
* @return {!goog.array.ArrayLike} All matching elements, or an empty list.
225+
* @return {!IArrayLike} All matching elements, or an empty list.
226226
*/
227227
bot.locators.xpath.many = function(target, root) {
228228

@@ -250,5 +250,5 @@ bot.locators.xpath.many = function(target, root) {
250250
goog.array.forEach(nodes, function(n) {
251251
bot.locators.xpath.checkElement_(n, target);
252252
});
253-
return /** @type {!goog.array.ArrayLike} */ (nodes);
253+
return /** @type {!IArrayLike} */ (nodes);
254254
};

javascript/safari-driver/inject/commands/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ safaridriver.inject.commands.getPageSource = function() {
108108
/**
109109
* Defines an element locating command.
110110
* @param {function(!Object, (Document|Element)=):
111-
* (Element|!goog.array.ArrayLike.<Element>)} locatorFn The locator function
111+
* (Element|!IArrayLike.<Element>)} locatorFn The locator function
112112
* that should be used.
113113
* @return {function(!safaridriver.Command): !bot.response.ResponseObject} The
114114
* locator command function.

0 commit comments

Comments
 (0)