Skip to content

Commit

Permalink
lib/svgo/jsAPI: add eachAttr() optional context param
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsweet committed Nov 17, 2012
1 parent 9d43b49 commit 53dad61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/svgo/js2svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ var Converter = INHERIT(/** @lends Nodes.prototype */{
attr.value +
this.config.attrEnd;

}.bind(this));
}, this);

return attrs;

Expand Down
7 changes: 4 additions & 3 deletions lib/svgo/jsAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ module.exports = INHERIT(/** @lends Nodes.prototype */{
/**
* Iterates over all attributes.
*
* @param {Function} callback
* @param {Function} callback callback
* @param {Object} [context] callback context
*
* @return {Boolean} false if there are no any attributes
*/
eachAttr: function(callback) {
eachAttr: function(callback, context) {

if (!this.hasAttr()) return false;

for (var name in this.attrs) {
callback(this.attrs[name]);
callback.call(context, this.attrs[name]);
}

},
Expand Down

0 comments on commit 53dad61

Please sign in to comment.