
Maintainable JavaScript
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Other editions
Additional editions

Content
- Intro
- Table of Contents
- Introduction
- Preface
- Conventions Used in This Book
- Using Code Examples
- Safari® Books Online
- How to Contact Us
- Part I. Style Guidelines
- Chapter 1. Basic Formatting
- Indentation Levels
- Statement Termination
- Line Length
- Line Breaking
- Blank Lines
- Naming
- Variables and Functions
- Constants
- Constructors
- Literal Values
- Strings
- Numbers
- Null
- Undefined
- Object Literals
- Array Literals
- Chapter 2. Comments
- Single-Line Comments
- Multiline Comments
- Using Comments
- Difficult-to-Understand Code
- Potential Author Errors
- Browser-Specific Hacks
- Documentation Comments
- Chapter 3. Statements and Expressions
- Brace Alignment
- Block Statement Spacing
- The switch Statement
- Indentation
- Falling Through
- default
- The with Statement
- The for Loop
- The for-in Loop
- Chapter 4. Variables, Functions, and Operators
- Variable Declarations
- Function Declarations
- Function Call Spacing
- Immediate Function Invocation
- Strict Mode
- Equality
- eval()
- Primitive Wrapper Types
- Part II. Programming Practices
- Chapter 5. Loose Coupling of UI Layers
- What Is Loose Coupling?
- Keep JavaScript Out of CSS
- Keep CSS Out of JavaScript
- Keep JavaScript Out of HTML
- Keep HTML Out of JavaScript
- Alternative #1: Load from the Server
- Alternative #2: Simple Client-Side Templates
- Alternative #3: Complex Client-Side Templates
- Chapter 6. Avoid Globals
- The Problems with Globals
- Naming Collisions
- Code Fragility
- Difficulty Testing
- Accidental Globals
- Avoiding Accidental Globals
- The One-Global Approach
- Namespaces
- Modules
- YUI modules
- Asynchronous Module Definition (AMD) Modules
- The Zero-Global Approach
- Chapter 7. Event Handling
- Classic Usage
- Rule #1: Separate Application Logic
- Rule #2: Don't Pass the Event Object Around
- Chapter 8. Avoid Null Comparisons
- Detecting Primitive Values
- Detecting Reference Values
- Detecting Functions
- Detecting Arrays
- Detecting Properties
- Chapter 9. Separate Configuration Data from Code
- What Is Configuration Data?
- Externalizing Configuration Data
- Storing Configuration Data
- Chapter 10. Throw Your Own Errors
- The Nature of Errors
- Throwing Errors in JavaScript
- Advantages of Throwing Errors
- When to Throw Errors
- The try-catch Statement
- Throw or try-catch?
- Error Types
- Chapter 11. Don't Modify Objects You Don't Own
- What Do You Own?
- The Rules
- Don't Override Methods
- Don't Add New Methods
- Don't Remove Methods
- Better Approaches
- Object-Based Inheritance
- Type-Based Inheritance
- The Facade Pattern
- A Note on Polyfills
- Preventing Modification
- Chapter 12. Browser Detection
- User-Agent Detection
- Feature Detection
- Avoid Feature Inference
- Avoid Browser Inference
- What Should You Use?
- Part III. Automation
- Chapter 13. File and Directory Structure
- Best Practices
- Basic Layout
- Chapter 14. Ant
- Installation
- The Build File
- Running the Build
- Target Dependencies
- Properties
- Buildr
- Chapter 15. Validation
- Finding Files
- The Task
- Improving the Target
- Other Improvements
- Buildr Task
- Chapter 16. Concatenation and Baking
- The Task
- Line Endings
- Headers and Footers
- Baking Files
- Chapter 17. Minification and Compression
- Minification
- Minifying with YUI Compressor
- Minifying with Closure Compiler
- Minifying with UglifyJS
- Compression
- Runtime Compression
- Build-Time Compression
- Chapter 18. Documentation
- JSDoc Toolkit
- YUI Doc
- Chapter 19. Automated Testing
- YUI Test Selenium Driver
- Setting Up a Selenium Server
- Setting Up YUI Test Selenium Driver
- Using the YUI Test Selenium Driver
- The Ant Target
- Yeti
- PhantomJS
- Installation and Usage
- The Ant Target
- JsTestDriver
- Installation and Usage
- The Ant Target
- Chapter 20. Putting It Together
- Missing Pieces
- Planning the Build
- The Development Build
- The Integration Build
- The Release Build
- Using a CI System
- Jenkins
- Other CI Systems
- Appendix A. JavaScript Style Guide
- Indentation
- Line Length
- Primitive Literals
- Operator Spacing
- Parentheses Spacing
- Object Literals
- Comments
- Single-Line Comments
- Multiline Comments
- Comment Annotations
- Variable Declarations
- Function Declarations
- Naming
- Strict Mode
- Assignments
- Equality Operators
- Ternary Operator
- Statements
- Simple Statements
- return Statement
- Compound Statements
- if Statement
- for Statement
- while Statement
- do Statement
- switch Statement
- try Statement
- White Space
- Things to Avoid
- Appendix B. JavaScript Tools
- Build Tools
- Documentation Generators
- Linting Tools
- Minification Tools
- Testing Tools
- Index
System requirements
File format: PDF
Copy-Protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our eBook Help page.