Merge pull request #1538 from twpayne/vector-api-this

[vector-api] Use opt_this for this arguments
This commit is contained in:
Tom Payne
2014-01-15 06:24:03 -08:00
16 changed files with 93 additions and 95 deletions

View File

@@ -115,12 +115,12 @@ ol.Collection.prototype.extend = function(arr) {
* @param {function(this: S, T, number, Array.<T>): *} f The function to call
* for every element. This function takes 3 arguments (the element, the
* index and the array). The return value is ignored.
* @param {S=} opt_obj The object to be used as the value of 'this' within f.
* @param {S=} opt_this The object to use as `this` in `f`.
* @template T,S
* @todo stability experimental
*/
ol.Collection.prototype.forEach = function(f, opt_obj) {
goog.array.forEach(this.array_, f, opt_obj);
ol.Collection.prototype.forEach = function(f, opt_this) {
goog.array.forEach(this.array_, f, opt_this);
};

View File

@@ -1274,13 +1274,13 @@ ol.Map.prototype.updateSize = function() {
/**
* @param {function(this: T)} f Function.
* @param {T=} opt_obj Object.
* @param {T=} opt_this The object to use as `this` in `f`.
* @template T
*/
ol.Map.prototype.withFrozenRendering = function(f, opt_obj) {
ol.Map.prototype.withFrozenRendering = function(f, opt_this) {
this.freezeRendering();
try {
f.call(opt_obj);
f.call(opt_this);
} finally {
this.unfreezeRendering();
}

View File

@@ -25,13 +25,12 @@ goog.inherits(ol.Observable, goog.events.EventTarget);
* Listen for a certain type of event.
* @param {string|Array.<string>} type The event type or array of event types.
* @param {function(?): ?} listener The listener function.
* @param {Object=} opt_scope Object is whose scope to call
* the listener.
* @param {Object=} opt_this The object to use as `this` in `listener`.
* @return {goog.events.Key} Unique key for the listener.
* @todo stability experimental
*/
ol.Observable.prototype.on = function(type, listener, opt_scope) {
return goog.events.listen(this, type, listener, false, opt_scope);
ol.Observable.prototype.on = function(type, listener, opt_this) {
return goog.events.listen(this, type, listener, false, opt_this);
};
@@ -39,13 +38,12 @@ ol.Observable.prototype.on = function(type, listener, opt_scope) {
* Listen once for a certain type of event.
* @param {string|Array.<string>} type The event type or array of event types.
* @param {function(?): ?} listener The listener function.
* @param {Object=} opt_scope Object is whose scope to call
* the listener.
* @param {Object=} opt_this The object to use as `this` in `listener`.
* @return {goog.events.Key} Unique key for the listener.
* @todo stability experimental
*/
ol.Observable.prototype.once = function(type, listener, opt_scope) {
return goog.events.listenOnce(this, type, listener, false, opt_scope);
ol.Observable.prototype.once = function(type, listener, opt_this) {
return goog.events.listenOnce(this, type, listener, false, opt_this);
};
@@ -53,12 +51,11 @@ ol.Observable.prototype.once = function(type, listener, opt_scope) {
* Unlisten for a certain type of event.
* @param {string|Array.<string>} type The event type or array of event types.
* @param {function(?): ?} listener The listener function.
* @param {Object=} opt_scope Object is whose scope to call
* the listener.
* @param {Object=} opt_this The object to use as `this` in `listener`.
* @todo stability experimental
*/
ol.Observable.prototype.un = function(type, listener, opt_scope) {
goog.events.unlisten(this, type, listener, false, opt_scope);
ol.Observable.prototype.un = function(type, listener, opt_this) {
goog.events.unlisten(this, type, listener, false, opt_this);
};

View File

@@ -45,7 +45,7 @@ goog.inherits(ol.renderer.canvas.ImageLayer, ol.renderer.canvas.Layer);
* @inheritDoc
*/
ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtPixel =
function(coordinate, frameState, callback, opt_obj) {
function(coordinate, frameState, callback, opt_this) {
var layer = this.getLayer();
var source = layer.getSource();
goog.asserts.assertInstanceof(source, ol.source.Image);
@@ -58,7 +58,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtPixel =
* @return {?} Callback result.
*/
function(feature) {
return callback.call(opt_obj, feature, this);
return callback.call(opt_this, feature, this);
});
};

View File

@@ -89,7 +89,7 @@ ol.renderer.canvas.VectorLayer.prototype.composeFrame =
* @inheritDoc
*/
ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtPixel =
function(coordinate, frameState, callback, opt_obj) {
function(coordinate, frameState, callback, opt_this) {
if (goog.isNull(this.replayGroup_)) {
return undefined;
} else {
@@ -109,7 +109,7 @@ ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtPixel =
function(geometry, data) {
var feature = /** @type {ol.Feature} */ (data);
goog.asserts.assert(goog.isDef(feature));
return callback.call(opt_obj, feature, layer);
return callback.call(opt_this, feature, layer);
});
}
};

View File

@@ -50,7 +50,7 @@ goog.inherits(ol.renderer.dom.ImageLayer, ol.renderer.dom.Layer);
* @inheritDoc
*/
ol.renderer.dom.ImageLayer.prototype.forEachFeatureAtPixel =
function(coordinate, frameState, callback, opt_obj) {
function(coordinate, frameState, callback, opt_this) {
var layer = this.getLayer();
var source = layer.getSource();
goog.asserts.assertInstanceof(source, ol.source.Image);
@@ -63,7 +63,7 @@ ol.renderer.dom.ImageLayer.prototype.forEachFeatureAtPixel =
* @return {?} Callback result.
*/
function(feature) {
return callback.call(opt_obj, feature, this);
return callback.call(opt_this, feature, this);
});
};

View File

@@ -49,7 +49,7 @@ goog.inherits(ol.renderer.Layer, goog.Disposable);
* @param {ol.FrameState} frameState Frame state.
* @param {function(this: S, ol.Feature, ol.layer.Layer): T} callback Feature
* callback.
* @param {S=} opt_obj Scope.
* @param {S=} opt_this Object to use as `this` in `callback`.
* @return {T|undefined} Callback result.
* @template S,T
*/
@@ -249,13 +249,13 @@ ol.renderer.Layer.prototype.snapCenterToPixel =
* @param {number} currentZ Current Z.
* @param {number} preload Load low resolution tiles up to 'preload' levels.
* @param {function(this: T, ol.Tile)=} opt_tileCallback Tile callback.
* @param {T=} opt_obj Object.
* @param {T=} opt_this Object to use as `this` in `opt_tileCallback`.
* @protected
* @template T
*/
ol.renderer.Layer.prototype.manageTilePyramid = function(
frameState, tileSource, tileGrid, projection, extent, currentZ, preload,
opt_tileCallback, opt_obj) {
opt_tileCallback, opt_this) {
var tileSourceKey = goog.getUid(tileSource).toString();
if (!(tileSourceKey in frameState.wantedTiles)) {
frameState.wantedTiles[tileSourceKey] = {};
@@ -279,7 +279,7 @@ ol.renderer.Layer.prototype.manageTilePyramid = function(
}
}
if (goog.isDef(opt_tileCallback)) {
opt_tileCallback.call(opt_obj, tile);
opt_tileCallback.call(opt_this, tile);
}
} else {
tileSource.useTile(z, x, y);

View File

@@ -76,7 +76,7 @@ ol.renderer.webgl.ImageLayer.prototype.createTexture_ = function(image) {
* @inheritDoc
*/
ol.renderer.webgl.ImageLayer.prototype.forEachFeatureAtPixel =
function(coordinate, frameState, callback, opt_obj) {
function(coordinate, frameState, callback, opt_this) {
var layer = this.getLayer();
var source = layer.getSource();
goog.asserts.assertInstanceof(source, ol.source.Image);
@@ -89,7 +89,7 @@ ol.renderer.webgl.ImageLayer.prototype.forEachFeatureAtPixel =
* @return {?} Callback result.
*/
function(feature) {
return callback.call(opt_obj, feature, this);
return callback.call(opt_this, feature, this);
});
};

View File

@@ -140,30 +140,30 @@ ol.source.Vector.prototype.clear = function() {
/**
* @param {function(this: T, ol.Feature): S} f Callback.
* @param {T=} opt_obj The object to be used as the value of 'this' within f.
* @param {T=} opt_this The object to use as `this` in `f`.
* @return {S|undefined}
* @template T,S
*/
ol.source.Vector.prototype.forEachFeature = function(f, opt_obj) {
return this.rBush_.forEach(f, opt_obj);
ol.source.Vector.prototype.forEachFeature = function(f, opt_this) {
return this.rBush_.forEach(f, opt_this);
};
/**
* @param {ol.Coordinate} coordinate Coordinate.
* @param {function(this: T, ol.Feature): S} f Callback.
* @param {T=} opt_obj The object to be used as the value of 'this' within f.
* @param {T=} opt_this The object to use as `this` in `f`.
* @return {S|undefined}
* @template T,S
*/
ol.source.Vector.prototype.forEachFeatureAtCoordinate =
function(coordinate, f, opt_obj) {
function(coordinate, f, opt_this) {
var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]];
return this.forEachFeatureInExtent(extent, function(feature) {
var geometry = feature.getGeometry();
goog.asserts.assert(!goog.isNull(geometry));
if (geometry.containsCoordinate(coordinate)) {
return f.call(opt_obj, feature);
return f.call(opt_this, feature);
} else {
return undefined;
}
@@ -174,13 +174,13 @@ ol.source.Vector.prototype.forEachFeatureAtCoordinate =
/**
* @param {ol.Extent} extent Extent.
* @param {function(this: T, ol.Feature): S} f Callback.
* @param {T=} opt_obj The object to be used as the value of 'this' within f.
* @param {T=} opt_this The object to use as `this` in `f`.
* @return {S|undefined}
* @template T,S
*/
ol.source.Vector.prototype.forEachFeatureInExtent =
function(extent, f, opt_obj) {
return this.rBush_.forEachInExtent(extent, f, opt_obj);
function(extent, f, opt_this) {
return this.rBush_.forEachInExtent(extent, f, opt_this);
};

View File

@@ -126,12 +126,12 @@ ol.structs.Buffer.prototype.addDirtySet = function(dirtySet) {
/**
* @param {function(this: T, number, number)} f Callback.
* @param {T=} opt_obj The object to be used as the value of 'this' within f.
* @param {T=} opt_this The object to use as `this` in `f`.
* @template T
*/
ol.structs.Buffer.prototype.forEachRange = function(f, opt_obj) {
ol.structs.Buffer.prototype.forEachRange = function(f, opt_this) {
if (this.arr_.length !== 0) {
this.freeSet_.forEachRangeInverted(0, this.arr_.length, f, opt_obj);
this.freeSet_.forEachRangeInverted(0, this.arr_.length, f, opt_this);
}
};

View File

@@ -126,15 +126,15 @@ ol.structs.IntegerSet.prototype.findRange = function(minSize) {
/**
* Calls f with each integer range.
* @param {function(this: T, number, number)} f Callback.
* @param {T=} opt_obj The object to be used as the value of 'this' within f.
* @param {T=} opt_this The object to use as `this` in `f`.
* @template T
*/
ol.structs.IntegerSet.prototype.forEachRange = function(f, opt_obj) {
ol.structs.IntegerSet.prototype.forEachRange = function(f, opt_this) {
var arr = this.arr_;
var n = arr.length;
var i;
for (i = 0; i < n; i += 2) {
f.call(opt_obj, arr[i], arr[i + 1]);
f.call(opt_this, arr[i], arr[i + 1]);
}
};
@@ -144,26 +144,26 @@ ol.structs.IntegerSet.prototype.forEachRange = function(f, opt_obj) {
* @param {number} start Start.
* @param {number} stop Stop.
* @param {function(this: T, number, number)} f Callback.
* @param {T=} opt_obj The object to be used as the value of 'this' within f.
* @param {T=} opt_this The object to use as `this` in `f`.
* @template T
*/
ol.structs.IntegerSet.prototype.forEachRangeInverted =
function(start, stop, f, opt_obj) {
function(start, stop, f, opt_this) {
goog.asserts.assert(start < stop);
var arr = this.arr_;
var n = arr.length;
if (n === 0) {
f.call(opt_obj, start, stop);
f.call(opt_this, start, stop);
} else {
if (start < arr[0]) {
f.call(opt_obj, start, arr[0]);
f.call(opt_this, start, arr[0]);
}
var i;
for (i = 1; i < n - 1; i += 2) {
f.call(opt_obj, arr[i], arr[i + 1]);
f.call(opt_this, arr[i], arr[i + 1]);
}
if (arr[n - 1] < stop) {
f.call(opt_obj, arr[n - 1], stop);
f.call(opt_this, arr[n - 1], stop);
}
}
};

View File

@@ -102,13 +102,13 @@ ol.structs.LRUCache.prototype.containsKey = function(key) {
* to call for every entry from the oldest to the newer. This function takes
* 3 arguments (the entry value, the entry key and the LRUCache object).
* The return value is ignored.
* @param {S=} opt_obj The object to be used as the value of 'this' within f.
* @param {S=} opt_this The object to use as `this` in `f`.
* @template S
*/
ol.structs.LRUCache.prototype.forEach = function(f, opt_obj) {
ol.structs.LRUCache.prototype.forEach = function(f, opt_this) {
var entry = this.oldest_;
while (!goog.isNull(entry)) {
f.call(opt_obj, entry.value_, entry.key_, this);
f.call(opt_this, entry.value_, entry.key_, this);
entry = entry.newer;
}
};

View File

@@ -361,20 +361,20 @@ ol.structs.RBush.prototype.condense_ = function(path) {
* Calls a callback function with each node in the tree. Inside the callback,
* no tree modifications (insert, update, remove) can be made.
* @param {function(this: S, T): *} callback Callback.
* @param {S=} opt_obj Scope.
* @param {S=} opt_this The object to use as `this` in `callback`.
* @return {*} Callback return value.
* @template S
*/
ol.structs.RBush.prototype.forEach = function(callback, opt_obj) {
ol.structs.RBush.prototype.forEach = function(callback, opt_this) {
if (goog.DEBUG) {
++this.readers_;
try {
return this.forEach_(this.root_, callback, opt_obj);
return this.forEach_(this.root_, callback, opt_this);
} finally {
--this.readers_;
}
} else {
return this.forEach_(this.root_, callback, opt_obj);
return this.forEach_(this.root_, callback, opt_this);
}
};
@@ -382,12 +382,12 @@ ol.structs.RBush.prototype.forEach = function(callback, opt_obj) {
/**
* @param {ol.structs.RBushNode.<T>} node Node.
* @param {function(this: S, T): *} callback Callback.
* @param {S=} opt_obj Scope.
* @param {S=} opt_this The object to use as `this` in `callback`.
* @private
* @return {*} Callback return value.
* @template S
*/
ol.structs.RBush.prototype.forEach_ = function(node, callback, opt_obj) {
ol.structs.RBush.prototype.forEach_ = function(node, callback, opt_this) {
goog.asserts.assert(!node.isLeaf());
/** @type {Array.<ol.structs.RBushNode.<T>>} */
var toVisit = [node];
@@ -397,7 +397,7 @@ ol.structs.RBush.prototype.forEach_ = function(node, callback, opt_obj) {
children = node.children;
if (node.height == 1) {
for (i = 0, ii = children.length; i < ii; ++i) {
result = callback.call(opt_obj, children[i].value);
result = callback.call(opt_this, children[i].value);
if (result) {
return result;
}
@@ -414,21 +414,21 @@ ol.structs.RBush.prototype.forEach_ = function(node, callback, opt_obj) {
* callback, no tree modifications (insert, update, remove) can be made.
* @param {ol.Extent} extent Extent.
* @param {function(this: S, T): *} callback Callback.
* @param {S=} opt_obj Scope.
* @param {S=} opt_this The object to use as `this` in `callback`.
* @return {*} Callback return value.
* @template S
*/
ol.structs.RBush.prototype.forEachInExtent =
function(extent, callback, opt_obj) {
function(extent, callback, opt_this) {
if (goog.DEBUG) {
++this.readers_;
try {
return this.forEachInExtent_(extent, callback, opt_obj);
return this.forEachInExtent_(extent, callback, opt_this);
} finally {
--this.readers_;
}
} else {
return this.forEachInExtent_(extent, callback, opt_obj);
return this.forEachInExtent_(extent, callback, opt_this);
}
};
@@ -436,13 +436,13 @@ ol.structs.RBush.prototype.forEachInExtent =
/**
* @param {ol.Extent} extent Extent.
* @param {function(this: S, T): *} callback Callback.
* @param {S=} opt_obj Scope.
* @param {S=} opt_this The object to use as `this` in `callback`.
* @private
* @return {*} Callback return value.
* @template S
*/
ol.structs.RBush.prototype.forEachInExtent_ =
function(extent, callback, opt_obj) {
function(extent, callback, opt_this) {
/** @type {Array.<ol.structs.RBushNode.<T>>} */
var toVisit = [this.root_];
var result;
@@ -450,12 +450,12 @@ ol.structs.RBush.prototype.forEachInExtent_ =
var node = toVisit.pop();
if (ol.extent.intersects(extent, node.extent)) {
if (node.isLeaf()) {
result = callback.call(opt_obj, node.value);
result = callback.call(opt_this, node.value);
if (result) {
return result;
}
} else if (ol.extent.containsExtent(extent, node.extent)) {
result = this.forEach_(node, callback, opt_obj);
result = this.forEach_(node, callback, opt_this);
if (result) {
return result;
}
@@ -470,16 +470,16 @@ ol.structs.RBush.prototype.forEachInExtent_ =
/**
* @param {function(this: S, ol.structs.RBushNode.<T>): *} callback Callback.
* @param {S=} opt_obj Scope.
* @param {S=} opt_this The object to use as `this` in `callback`.
* @return {*} Callback return value.
* @template S
*/
ol.structs.RBush.prototype.forEachNode = function(callback, opt_obj) {
ol.structs.RBush.prototype.forEachNode = function(callback, opt_this) {
/** @type {Array.<ol.structs.RBushNode.<T>>} */
var toVisit = [this.root_];
while (toVisit.length > 0) {
var node = toVisit.pop();
var result = callback.call(opt_obj, node);
var result = callback.call(opt_this, node);
if (result) {
return result;
}

View File

@@ -115,18 +115,18 @@ ol.tilegrid.TileGrid.prototype.createTileCoordTransform = goog.abstractMethod;
/**
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {function(this: T, number, ol.TileRange): boolean} callback Callback.
* @param {T=} opt_obj Object.
* @param {T=} opt_this The object to use as `this` in `callback`.
* @param {ol.TileRange=} opt_tileRange Temporary ol.TileRange object.
* @param {ol.Extent=} opt_extent Temporary ol.Extent object.
* @return {boolean} Callback succeeded.
* @template T
*/
ol.tilegrid.TileGrid.prototype.forEachTileCoordParentTileRange =
function(tileCoord, callback, opt_obj, opt_tileRange, opt_extent) {
function(tileCoord, callback, opt_this, opt_tileRange, opt_extent) {
var tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent);
var z = tileCoord.z - 1;
while (z >= this.minZoom) {
if (callback.call(opt_obj, z,
if (callback.call(opt_this, z,
this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange))) {
return true;
}

View File

@@ -114,14 +114,14 @@ ol.tilegrid.XYZ.prototype.getTileCoordChildTileRange =
* @inheritDoc
*/
ol.tilegrid.XYZ.prototype.forEachTileCoordParentTileRange =
function(tileCoord, callback, opt_obj, opt_tileRange) {
function(tileCoord, callback, opt_this, opt_tileRange) {
var tileRange = ol.TileRange.createOrUpdate(
0, tileCoord.x, 0, tileCoord.y, opt_tileRange);
var z;
for (z = tileCoord.z - 1; z >= this.minZoom; --z) {
tileRange.minX = tileRange.maxX >>= 1;
tileRange.minY = tileRange.maxY >>= 1;
if (callback.call(opt_obj, z, tileRange)) {
if (callback.call(opt_this, z, tileRange)) {
return true;
}
}

View File

@@ -51,18 +51,18 @@ ol.xml.getAllTextContent_ = function(node, normalizeWhitespace, accumulator) {
/**
* @param {function(this: T, Node, Array.<*>): (Array.<*>|undefined)}
* valueReader Value reader.
* @param {T=} opt_obj Scope.
* @param {T=} opt_this The object to use as `this` in `valueReader`.
* @return {ol.xml.Parser} Parser.
* @template T
*/
ol.xml.makeArrayExtender = function(valueReader, opt_obj) {
ol.xml.makeArrayExtender = function(valueReader, opt_this) {
return (
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
*/
function(node, objectStack) {
var value = valueReader.call(opt_obj, node, objectStack);
var value = valueReader.call(opt_this, node, objectStack);
if (goog.isDef(value)) {
goog.asserts.assert(goog.isArray(value));
var array = /** @type {Array.<*>} */
@@ -76,18 +76,18 @@ ol.xml.makeArrayExtender = function(valueReader, opt_obj) {
/**
* @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.
* @param {T=} opt_obj Scope.
* @param {T=} opt_this The object to use as `this` in `valueReader`.
* @return {ol.xml.Parser} Parser.
* @template T
*/
ol.xml.makeArrayPusher = function(valueReader, opt_obj) {
ol.xml.makeArrayPusher = function(valueReader, opt_this) {
return (
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
*/
function(node, objectStack) {
var value = valueReader.call(opt_obj, node, objectStack);
var value = valueReader.call(opt_this, node, objectStack);
if (goog.isDef(value)) {
var array = objectStack[objectStack.length - 1];
goog.asserts.assert(goog.isArray(array));
@@ -99,18 +99,18 @@ ol.xml.makeArrayPusher = function(valueReader, opt_obj) {
/**
* @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.
* @param {T=} opt_obj Scope.
* @param {T=} opt_this The object to use as `this` in `valueReader`.
* @return {ol.xml.Parser} Parser.
* @template T
*/
ol.xml.makeReplacer = function(valueReader, opt_obj) {
ol.xml.makeReplacer = function(valueReader, opt_this) {
return (
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
*/
function(node, objectStack) {
var value = valueReader.call(opt_obj, node, objectStack);
var value = valueReader.call(opt_this, node, objectStack);
if (goog.isDef(value)) {
objectStack[objectStack.length - 1] = value;
}
@@ -121,11 +121,12 @@ ol.xml.makeReplacer = function(valueReader, opt_obj) {
/**
* @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.
* @param {string=} opt_property Property.
* @param {T=} opt_obj Scope.
* @param {T=} opt_this The object to use as `this` in `valueReader`.
* @return {ol.xml.Parser} Parser.
* @template T
*/
ol.xml.makeObjectPropertySetter = function(valueReader, opt_property, opt_obj) {
ol.xml.makeObjectPropertySetter =
function(valueReader, opt_property, opt_this) {
goog.asserts.assert(goog.isDef(valueReader));
return (
/**
@@ -133,7 +134,7 @@ ol.xml.makeObjectPropertySetter = function(valueReader, opt_property, opt_obj) {
* @param {Array.<*>} objectStack Object stack.
*/
function(node, objectStack) {
var value = valueReader.call(opt_obj, node, objectStack);
var value = valueReader.call(opt_this, node, objectStack);
if (goog.isDef(value)) {
var object = /** @type {Object} */
(objectStack[objectStack.length - 1]);
@@ -169,16 +170,16 @@ ol.xml.makeParsersNS = function(namespaceURIs, parsers, opt_parsersNS) {
* Parsers by namespace.
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {*=} opt_obj Scope.
* @param {*=} opt_this The object to use as `this`.
*/
ol.xml.parse = function(parsersNS, node, objectStack, opt_obj) {
ol.xml.parse = function(parsersNS, node, objectStack, opt_this) {
var n;
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
var parsers = parsersNS[n.namespaceURI];
if (goog.isDef(parsers)) {
var parser = parsers[n.localName];
if (goog.isDef(parser)) {
parser.call(opt_obj, n, objectStack);
parser.call(opt_this, n, objectStack);
}
}
}
@@ -191,12 +192,12 @@ ol.xml.parse = function(parsersNS, node, objectStack, opt_obj) {
* Parsers by namespace.
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {*=} opt_obj Scope.
* @param {*=} opt_this The object to use as `this`.
* @return {T|undefined} Object.
* @template T
*/
ol.xml.pushAndParse = function(object, parsersNS, node, objectStack, opt_obj) {
ol.xml.pushAndParse = function(object, parsersNS, node, objectStack, opt_this) {
objectStack.push(object);
ol.xml.parse(parsersNS, node, objectStack, opt_obj);
ol.xml.parse(parsersNS, node, objectStack, opt_this);
return objectStack.pop();
};