Skip to content
Permalink
Browse files

Widget: Get rid of `var self`

  • Loading branch information...
jzaefferer committed Sep 12, 2011
1 parent 2a6ca3f commit 30482cd04b1fe2d5c4c1e29b624eb44828942de4
Showing with 2 additions and 2 deletions.
  1. +2 −2 ui/jquery.ui.widget.js
@@ -270,9 +270,9 @@ $.Widget.prototype = {
return this;
},
_setOptions: function( options ) {
var self = this;
var that = this;
$.each( options, function( key, value ) {
self._setOption( key, value );
that._setOption( key, value );
});

return this;

4 comments on commit 30482cd

@YSlove

This comment has been minimized.

Copy link

replied Oct 19, 2011

why? I think self is better than that. Why had been changed?

@jzaefferer

This comment has been minimized.

Copy link
Member Author

replied Oct 19, 2011

self is never undefined (points to window when not defined locally), causing some pretty ugly bugs when refactoring code. that isn't great either, we try to get rid of it as much as possible.

@gnarf

This comment has been minimized.

Copy link
Member

replied Oct 19, 2011

Is there any reason we are using a $.each here instead of for ( key in options )? The for loop will perform better, and prolly compress smaller too since this closure is totally unnecessary...

@jzaefferer

This comment has been minimized.

Copy link
Member Author

replied Oct 19, 2011

Should be fine to change that.

Please sign in to comment.
You can’t perform that action at this time.