JavaScript The Good Parts Crockford 2008 by the creator of the JSLint tool is a

Javascript the good parts crockford 2008 by the

This preview shows page 250 - 252 out of 517 pages.

JavaScript: The Good Parts ( Crockford 2008 ), by the creator of the JSLint tool, is a highly opinionated, intellectually rigorous exposition of JavaScript, focusing uncompromisingly on the disciplined use of its good features while candidly exposing the pitfalls of its design flaws. This book is “must” reading if you plan to write entire JavaScript apps comparable to Google Docs. The ProgrammableWeb site lists hundreds of service APIs, both RESTful and non-RESTful and serving both XML and JSON data, that you may find useful for SPAs and mashups. Some are completely open and require no authentication; others require a developer key which may be free or non-free. E. Castledine and C. Sharkie. jQuery: Novice to Ninja, 2nd Edition - New Kicks and Tricks . SitePoint Books, 2012. D. Crockford. JavaScript: The Good Parts . O’Reilly Media, 2008. P. Seibel. Coders at Work: Reflections on the Craft of Programming . Apress, 2009. ISBN 1430219483. 6.12 Suggested Projects Project 6.1. A disadvantage of prototype inheritance is that all object attributes (properties) are public. (Recall that in Ruby, no attributes are public: getter and setter methods, defined either explicitly or using attr_accessor , are the only way to access attributes from outside the class.) However, we can take advantage of closures to get private attributes. Create a simple constructor for User objects that accepts a username and password, and provides a checkPassword method tells whether a supplied password is correct but disallows inspecting the actual password. This “accessors only” idiom is used throughout jQuery. (Hint: the constructor should return an object one of whose properties is a function that exploits JavaScript closures to “remember” the password initially supplied to the constructor. The returned object should not have a property that holds the password.) Project 6.2. In the example used in Section 6.5 , suppose you couldn’t modify the server code to add the adult CSS class to rows in the movies table. How might you identify the rows to be hidden using only client-side JavaScript? Project 6.3.
Image of page 250
Write JavaScript to create cascading menus for day, month, and year that allow the entry of valid dates only. For example, if February is selected as the month, the Day menu should only go from 1–28, unless the Year menu indicates a leap year, in which case the Day menu should go from 1–29, and so on. As a bonus, wrap your JavaScript in a Rails helper that results in date menus with the same menu names and option tags as the Rails’ built-in helpers, making your JavaScript menus a drop-in replacement. Note: it’s important that the menus also work in non-JavaScript-enabled browsers; in that case, the menus should statically display 1–31 for the days of the month. Project 6.4. Create the AJAX code necessary to create cascading menus based on a has_many association. That is, given Rails models A and B where A has_many Bs, the first menu in the pair should list the A choices, and when one is selected, retrieve the corresponding B choices and populate the B menu.
Image of page 251
Image of page 252

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors