-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Object-Oriented JavaScript
This first part of the chapter discusses some patterns that reflect JavaScript's unique features. Some patterns aim to help you with organizing your code (such as namespace patterns), others are related to improving performance (such as lazy definitions and init-time branching), and some make up for missing features such as privately scoped properties. The patterns discussed in this section include:
Separating behavior
Namespaces
Init-time branching
Lazy definition
Configuration objects
Private variables and methods
Privileged methods
Private functions as public methods
Self-executable functions
Chaining
JSON
As discussed previously, the three building blocks of a web page are:
Content (HTML)
Presentation (CSS)
Behavior (JavaScript)
HTML is the content of the web page; the actual text. The content should be marked up using the smallest amount of HTML tags that sufficiently describe the semantic meaning of that content. For example, if you're working on a navigation...
Change the font size
Change margin width
Change background colour