Comments (7)
self is not a reserved keyword. see https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words
from front-end-development-guidelines.
Yep, I didn't think so. I remembered seeing it used throughout the jQuery code too.
http://code.jquery.com/jquery-1.6.js
Do a ctrl + f > "var self =" ...
Closing :)
from front-end-development-guidelines.
+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/ )
from front-end-development-guidelines.
Thank you for this, re-opening the issue for consideration.
from front-end-development-guidelines.
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.
from front-end-development-guidelines.
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.
from front-end-development-guidelines.
Fixed locally, pending commit.
from front-end-development-guidelines.
Related Issues (20)
- Add Section: Commenting CSS Blocks HOT 1
- Change "ambiguous" to "redundant" HOT 1
- Section: Loop Performance - Cache Array Length; global variable. HOT 4
- Site Needs to be Accessible without JavaScript Enabled
- Some tips HOT 3
- Caching Selector Results section code example HOT 2
- W3C markup validation HOT 6
- Some people are very fond of their C style strings (single quotes)... HOT 1
- Queue - a profoundly British word HOT 1
- css shorthand, camelCasing and POSH HOT 3
- parseInt is not octal/binary by default HOT 2
- Isn't it spelled "Degradation"? With an "a"? HOT 1
- CamelCase in JS variables HOT 1
- width:auto does work HOT 2
- Add Section - Creating Unique IDs without Timestamps
- Add Section - When to Float, When to Position
- Add Section - Understanding the Box Model
- Strings: single vs double quotes HOT 1
- Pagespeed & Loadtimes
- Accessibility alt text HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from front-end-development-guidelines.