GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Self is a reserved keyword, use _self instead.
As per: http://news.ycombinator.com/item?id=2519614
Yep, I didn't think so. I remembered seeing it used throughout the jQuery code too.
Do a ctrl + f > "var self =" ...
+1 on at least renaming it.
self isn't a reserved word but it is a native property of the window object in firefox/webkit. If you're referring to self and had forgotten to var scope it, it'll actually refer to the window object, which can make debugging difficult. It's for this reason that jQuery UI is pushing to rename instances of var self = this; (see http://bugs.jqueryui.com/ticket/5404/ )
var self = this;
Thank you for this, re-opening the issue for consideration.
while self is not a reserved keyword, @ehynds makes a good point. You could possibly go for something like _self unless that conflicts with Underscore.js naming conventions.
These front-end guidelines should not be promoting leaking globals at all. It would be the same as saying you cannot use the word frames in your code since it conflicts with a property on the window object. _self looks ugly and is unnecessary.
Perhaps just discuss the fact that self is a property on the window object and if you leak it globally it will override... and that you shouldn't be leaking a word to describe something internal anyways.
My 2 cents.
Fixed locally, pending commit.