Code Monkey home page Code Monkey logo

Comments (7)

jgv avatar jgv commented on June 19, 2024

self is not a reserved keyword. see https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words

from front-end-development-guidelines.

taitems avatar taitems commented on June 19, 2024

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.

ehynds avatar ehynds commented on June 19, 2024

+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.

taitems avatar taitems commented on June 19, 2024

Thank you for this, re-opening the issue for consideration.

from front-end-development-guidelines.

jgv avatar jgv commented on June 19, 2024

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.

tbranyen avatar tbranyen commented on June 19, 2024

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.

taitems avatar taitems commented on June 19, 2024

Fixed locally, pending commit.

from front-end-development-guidelines.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.