Table of contents
Part One Introduction
Chapter 1 Starting from Scratch
1.1 Why choose JavaScript?
1.1.1 User preference--B/S mode
1.1.2 When to use JavaScript
1.1.3 Some misunderstandings about JavaScript
1.1.3.1 The relationship between JavaScript and Java
1.1.3.2 Lisp in C clothing
1.1.3.3 Thinking about JavaScript
1.1.3.4 Is JavaScript designed for amateurs?
1.1.3.5 Is JavaScript object-oriented
1.1.3.6 Other misunderstandings
1.1.4 Be alert! Script Temptation
1.1.5 Complexity hidden under simple appearance
1.1.6 The confusing choice-the icing on the cake or the timely help Part One Introduction
Chapter 1 Starting from Scratch
1.1 Why choose JavaScript?
1.1.1 User preference--B/S mode
1.1.2 When to use JavaScript
1.1.3 Some misunderstandings about JavaScript
1.1.3.1 The relationship between JavaScript and Java
1.1.3.2 Lisp in C clothing
1.1.3.3 Thinking about JavaScript
1.1.3.4 Is JavaScript designed for amateurs?
1.1.3.5 Is JavaScript object-oriented
1.1.3.6 Other misunderstandings
1.1.4 Be alert! Script Temptation
1.1.5 Complexity hidden under simple appearance
1.1.6 Confusing choice--the icing on the cake or the timely help
1.1.7 Back to the question
1.2 Application scope of JavaScript
1.2.1 Client-side JavaScript
1.2.2 Server-side JavaScript
1.2.3 JavaScript in other environments
1.3 JavaScript version
1.3.1 JavaScript version in the browser
1.3.2 Other versions
1.4 Some features worth noting
1.4.1 Little trick--magical magic code
1.4.2 Serving clients--classic Hello World! Another JavaScript implementation
1.4.3 Data interaction--a powerful function of JavaScript
1.4.4 JavaScript’s apparent taboos and how to break through them
1.5 Security and execution efficiency
1.5.1 Data security--forever a sensitive topic
1.5.2 Actual combat! Attack and Defense
1.5.3 No carelessness - always pay attention to performance
1.6 An example--calculator written in JavaScript
1.6.1 Start with requirements analysis--What is a calculator?
1.6.2 System design--how to implement a calculator?
1.6.3 System implementation--the final implementation of the calculator
1.6.4 Continuous improvement--iterative software development process
1.7 Some suggestions for learning and using JavaScript
1.7.1 Think like a programmer--the four realms of programmers
1.7.2 Cherish your code
1.7.3 Learn to debug in the environment
1.7.4 Be wary of small flaws
1.7.5 Think before practice - don’t write code easily
1.7.6 Always look back - even sages cannot completely predict the future
1.8 About the rest of the book
Chapter 2 JavaScript in the Browser
2.1 Executable content embedded in web pages
2.1.1 Where to load JavaScript code
2.1.2 About the Script tag of the code
2.1.3 When will my code be executed - JavaScript code in different execution periods
2.1.4 Borrowingism--Introducing external JavaScript files
2.2 Pleasing special effects
2.2.1 Life lies in movement--The effect of DHTML
2.2.2 Change your style - the power of CSS
2.2.3 Using JavaScript to manipulate DOM--an example of a draggable window
2.3 Use JavaScript to interact with users
2.3.1 Create a pop-up help and progress bar
2.3.2 Wrong entry
2.4 Avoiding script traps
2.4.1 Reality is not always perfect
2.4.2 Don’t completely believe what you see
2.5 Summary
Chapter 3 Development Environment and Debugging Methods
3.1 What can I use to write scripts--a text editor suitable for writing JavaScript
3.2 Support from browser
3.2.1 Mainstream browsers
3.2.2 Non-mainstream browsers
3.3 Integrated development environment
3.3.1 What is an integrated development environment
3.3.2 Do I need an integrated development environment
3.3.3 Integrated development environment suitable for JavaScript
3.4 Debugging tools--a powerful tool to improve development efficiency
3.4.1 What is debugging
3.4.2 Original debugging method - debugging using output statements, "reflection" mechanism and debugging objects
3.4.3 Debugging tools suitable for JavaScript
3.5 Locating code and call stack
3.5.1 Step by Step--Single step and breakpoint
3.5.2 Monitor memory
3.5.3 Trace the source of the problem--view the call stack
3.5.4 Encountered trouble--Why can’t I trace the code
3.6 Browser catching exception
3.6.1 Exception handling mechanism-an example of try/catch/finally pattern
3.6.2 Types of exceptions
3.6.3 When should exceptions be "eaten"
3.7 Summary
Part 2 JavaScript Core
Chapter 4 Language Structure
4.1 Basic grammar of JavaScript
4.1.1 Character set
4.1.2 Case sensitivity
4.1.3 Delimiter
4.1.4 Words, sentences and paragraphs
4.1.5 Semicolon
4.1.6 Mark
4.1.7 Comments
4.1.8 Reserved words
4.2 Constants and variables
4.2.1 Constants and variables
4.2.2 Variable identifier
4.2.3 Variable type
4.2.4 Declaration of variables
4.2.5 Scope of variables
4.3 Expressions and operators
4.3.1 Expression
4.3.2 Operator overview
4.3.3 Arithmetic operators
4.3.4 Relational operators
4.3.5 Logical operators
4.3.6 Bit operators
4.3.7 Assignment operator
4.3.8 Other operators
4.3.8.1 Conditional operator
4.3.8.2 Comma operator
4.3.8.3 Object operators
4.3.8.4 Type operators
4.3.8.5 void operator
4.3.8.6 Function call operator
4.4 Control statements
4.4.1 Expression statement
4.4.2 Statement block
4.4.3 Conditional statements
4.4.4 Loop statement
4.4.5 Jump statement
4.4.6 Exception handling statements
4.4.7 Other statements
4.4.7.1 var statement
4.4.7.2 function statement
4.4.7.3 with statement
4.4.7.4 Empty statement
4.5 Summary
Chapter 5 Data Type
5.1 Basic data types
5.1.1 Value
5.1.2 String--an example of string-related operations
5.1.3 Boolean
5.2 Arrays and objects
5.2.1 Array
5.2.2 Object--an example of a constructor
5.3 Function type--an example of function and closure
5.4 Magical null and undefined
5.4.1 null
5.4.2 undefined--unique type
5.5 Regular expression
5.5.1 Regular expression constants
5.5.2 Regular expression object
5.6 Value types and reference types
5.6.1 What are values and value references
5.6.2 Using values and using references
5.6.3 Conversion between values and references: boxing and unboxing
5.7 Type identification and type conversion
5.7.1 Runtime type recognition--two examples of running type recognition
5.7.2 Automatic conversion of types and examples
5.7.3 Forced type conversion and its examples
5.7.4 Advanced usage--an example of custom type conversion
5.8 Beware of numerical traps
5.8.1 Confusion--precision problem of floating point numbers
5.8.2 Error correction and examples
5.9 Summary
Chapter 6 Function
6.1 Function definition and function call
6.1.1 Function definition
6.1.1.1 Declarative function definitions and function expressions and their examples
6.1.1.2 The secret of JavaScript functions - magic code
6.1.2 Function call
6.2 Function parameters
6.2.1 Formal Participant Actual Parameters
6.2.2 Arguments object
6.2.2.1 An example of using Arguments object to detect formal parameters
6.2.2.2 An example of using the Arguments object to receive any number of parameters
6.2.2.3 An example of using Arguments object to simulate function overloading
6.2.3 Parameter type matching--an example of using arguments to implement function overloading mechanism
6.3 Callers and owners of functions
6.3.1 Caller of function
6.3.2 Owner of function--an example of specifying an owner for a function
6.3.3 Dynamic call--foreign owner
6.4 Function constants and closures
6.4.1 Anonymous functions
6.4.2 Function reference
6.4.3 Function parameters and function return values and their examples
6.4.4 Advanced usage--closure as local domain and delayed evaluation
6.5 Advanced abstraction--Function type and function template
6.5.1 Dynamically creating functions--an example of using Function to implement Lambda operator
6.5.2 Pattern--Function factory and its instances
6.6 Summary
Chapter 7 Object
7.1 What is an object
7.2 Object properties and methods
7.2.1 Built-in properties of objects
7.2.2 Adding and deleting attributes to objects
7.2.3 Reflection mechanism--enumeration object properties
7.3 Object construction
7.3.1 Constructor--an example of a double-precision floating-point number wrapper class
7.3.2 Default construction and copy construction
7.3.3 Object constant
7.4 Object destruction and storage unit recycling
7.5 JavaScript’s built-in objects
7.5.1 Math object
7.5.2 Date object--create a simple calendar
7.5.3 Error object
7.5.4 Other built-in objects
7.5.5 Special objects--global objects and calling objects
7.6 Summary
Chapter 8 Collection
8.1 Arrays and array elements
8.1.1 Array construction
8.1.2 Array constant
8.1.3 Array elements
8.2 Array objects and methods
8.2.1 Find elements
8.2.2 Adding and deleting elements
8.2.3 Set operations and examples
8.2.3.1 join() method
8.2.3.2 reverse() method
8.2.3.3 sort() method
8.2.3.4 concat() method
8.2.3.5 slice() method
8.2.3.6 splice() method
8.2.3.7 toSgring() method and toLocaleString() method
8.3 Hash table
8.3.1 What is a hash table
8.3.2 Construction of hash table
8.3.3 Implement a simple HashTable type
8.4 Advanced usage--set operations and closures
8.5 Summary
Chapter 9 String
9.1 String construction
9.1.1 String constant
9.1.2 Escape sequences
9.1.3 String constructor
9.2 Use of strings
9.2.1 Comparing strings
9.2.2 Extracting and retrieving substrings
9.2.3 Concatenate and split strings
9.2.4 Pattern matching of strings--an example of string format verification
9.2.5 Other methods
9.3 Strings and character arrays
9.4 String and text processing--JavaScript chess record reader (1)
9.4.1 Requirements Analysis--What are chess records and chess record readers
9.4.2 System design--String description of chess records and chessboard data
9.4.3 System implementation--parsing and processing chess records
9.4.4 Complete chess record reader
9.5 Summary
Chapter 10 Regular Expressions
10.1 What is a regular expression
10.1.1 The concept of regular expression
10.1.2 Regular expressions in JavaScript
10.2 Rules of regular expressions
10.2.1 Literal character
10.2.2 Character classes and Boolean operations
10.2.3 Repeat
10.2.4 Selection, grouping and referencing
10.2.5 Specify matching position
10.2.6 Flags—Rules for Advanced Pattern Matching
10.3 Pattern matching
10.3.1 String methods and examples for pattern matching
10.3.2 RegExp method for pattern matching
10.3.2.1 An example of using the exec() method to obtain the birthday from the ID number
10.3.2.2 An example of using the test() method to traverse a string
10.4 About regular expression packaging objects
10.4.1 RegExp object - using regular expressions to implement full-text retrieval
10.4.2 Instance properties of RegExp
10.5 Powerful regular expressions
10.5.1 Analyzing parts of regular expressions
10.5.2 An example--powerful online editor
10.5.3 Constructing a new grammar--an example of implementing the JSVM2 parser in JSVM
10.6 Advanced usage
10.7 Processing text with regular expressions
10.7.1 Create a pricing formula editor
10.7.1.1 Requirements Analysis--What is the Pricing Formula Editor
10.7.1.2 System implementation--implementation of pricing formula editor
10.7.2 Create a synchronous scrolling lyrics player
10.7.2.1 Requirements Analysis--What is a synchronous scrolling lyrics player
10.7.2.2 System design and implementation--processing LRC lyrics
10.8 Summary
Part 3 Browser and DOM
Chapter 11 Browser Object
11.1 Window object--the most basic browser object
11.1.1 Window object overview
11.1.2 Life cycle of Window object
11.1.3 Properties and methods of Window object
11.1.4 An example of a multi-window application
11.2 Document object - represents the content of the browser window document
11.2.1 Document object overview
11.2.2 Dynamically generated documents
11.2.3 Basic information of Document object
11.2.4 Appearance properties of Document object
11.2.5 Document sub-object interface
11.2.5.1 An example of traversing Anchors objects
11.2.5.2 An example of an upside-down image
11.3 Dialog box and status bar
11.3.1 Create a simple dialog box
11.3.2 Other types of dialog boxes
11.3.2.1 Simulating dialog boxes--examples of creating a window dialog box and a blocked dialog box
11.3.2.2 showModalDialog and showModelessDialog--not W3C or ECMAScrip standard
11.3.3 Status bar
11.4 Framework--upper Window object
11.4.1 Multi-framework application
11.4.2 Relationship between frameworks
11.4.3 Naming of the framework
11.4.4 JavaScript in subframes
11.4.5 Application of framework--multi-tab display
11.4.5.1 What is a tab
11.4.5.2 Implementation of tabs--Create a page containing tabs
11.5 Forms and form objects
11.5.1 Form object and its examples
11.5.2 Define form elements
11.5.3 Client form validation and examples
11.5.4 Create a universal client form validation component
11.6 Other built-in objects
11.6.1 Navigator object--representative of overall browser information
11.6.2 Screen object--provides information about the display resolution and the number of available colors
11.6.3 Location object - represents the URL of the document displayed in the current window
11.6.4 History object--an interesting object
11.7 Summary
Chapter 12 Document Object Model
12.1 What is DOM
12.1.1 Representing documents as trees
12.1.2 Tree nodes
12.1.3 Common properties and methods of DOM objects
12.1.4 The relationship between HTML structure and DOM objects--using JavaScript to operate HTML documents through DOM
12.2 DOM and browser implementation
12.2.1 About DOM HTML API
12.2.2 Levels and characteristics of DOM
12.2.3 DOM consistency
12.2.4 Differences--Browser DOM dialect
12.3 A set of "boxes"--DOM elements
12.3.1 Nested “boxes”
12.3.2 Classification of “boxes” and “box” contents
12.4 Create and delete nodes
12.4.1 Construct a new node
12.4.2 Flat expansion--directly created through document elements
12.4.3 Reclaim space--delete unused nodes
12.5 Access and manipulate DOM nodes
12.5.1 Open each box--traverse nodes
12.5.2 Clarify the hierarchical relationship--father, son and brother
12.5.3 How to search for a specific node
12.5.4 Clone node--an example of using cloneNode() to copy a table
12.5.5 Mobile nodes and their examples
12.5.6 Tips on adding new rows and sorting
12.6 Reading and writing data--adding, modifying and deleting attributes
12.7 Appearance and Behavior
12.7.1 DOM style attributes
12.7.2 Control the display and hiding of DOM elements
12.7.3 Changing color and size--a simple and interesting example
12.7.4 Change position--Create text that rotates around a circle
12.7.5 Editing controls and their examples
12.7.6 Changing styles and their examples
12.7.7 Changing Behavior
12.8 XML DOM
12.8.1 What is XML DOM
12.8.2 How to use XML DOM--an example of using XML to implement a multi-level associated drop-down selection box
12.9 Summary
Chapter 13 Event Handling
13.1 What is an event
13.1.1 Message and event response
13.1.2 Browser event-driven mechanism
13.2 Basic event handling
13.2.1 Events and event types
13.2.2 Binding of events
13.2.3 Directly calling the event processing function
13.2.4 Return value of event handling function
13.2.5 Event response with parameters and examples
13.2.6 “this” keyword
13.3 Standard event model
13.3.1 Bubbles and Capture--Browser Event Propagation
13.3.2 Registration of event handling functions
13.3.3 Register an object as an event handler
13.3.4 Event modules and event types
13.3.5 About Event interface
13.3.5.1 Properties and methods of Event interface
13.3.5.2 Properties of UIEvent interface
13.3.5.3 Properties of MouseEvent interface
13.3.5.4 MutationEvent interface
13.3.6 Mixed event model
13.3.7 Synthetic events
13.4 Browser event processing model implementation
13.4.1 Internet Explorer event model
13.4.1.1 About IE event registration
13.4.1.2 Properties of IE Event object
13.4.1.3 Event bubbling in IE
13.4.2 Netscape 4 event model
13.4.2.1 Event capture and examples in Netscape 4
13.4.2.2 Properties of Netscape 4 Event object
13.5 Callbacks and user-defined events
13.5.1 Event processing pattern--an example of implementing a simple event processing pattern
13.5.2 Definition of user event interface
13.5.3 Event proxy and event registration--an example of implementing a standard event interface
13.5.4 Standard mode--event dispatch and reception
13.6 An example--enhanced data table
13.6.1 What is an enhanced data table
13.6.2 An example of fixing the table header using double table nesting
13.6.3 Implementation of variable column width
13.6.4 Mark row--present a background color that is different from other rows
13.6.5 Tips--Add code to style sheet
13.7 Summary
Chapter 14 Cascading Style Sheets
14.1 What is cascading style sheet
14.1.1 CSS styles and style sheets
14.1.2 Standardization of CSS
14.1.3 CSS supported by browsers
14.2 JavaScript and CSS
14.2.1 The relationship between CSS and DOM
14.2.2 The relationship between CSS and IE
14.2.3 Browser CSS compatibility
14.3 Control CSS to change page style
14.3.1 Implementing the separation of structure and presentation and its examples
14.3.2 Use JwaScript and CSS to realize real-time replacement of multiple styles of the page
14.4 Summary
Chapter 15 Scripting of Data Storage
15.1 What is a cookie
15.1.1 Browser and client cookies
15.1.2 Cookie attributes
15.2 Client access to cookies
15.2.1 Cookie storage
15.2.2 Cookie reading
15.3 Cookie restrictions
15.4 Cookie example--make greetings warmer
15.5 Encapsulation of cookie objects
15.6 What is userData
15.6.1 Browser and client userData
15.6.2 Declaration of userData
15.6.3 UserData attributes and methods
15.7 Client access to userData
15.7.1 Storage and reading of userData
15.7.2 Security of userData
15.8 Limitations of userData
15.9 Comparison between userData and cookie
15.10 userData example--an example of using userData to save form data on the client
15.11 Summary
Part 4 Data Interaction
Chapter 16 Synchronization and Asynchronous
16.1 What is synchronization and asynchronousness
16.2 Timeout setting and time interval
16.3 Timer use--listening and interception
16.3.1 Standard mode--monitor and its examples
16.3.2 Issues that should be paid attention to when using timers
16.4 An example--beautiful Web clock
16.4.1 What is a Web Clock?
16.4.2 The simplest web clock
16.4.3 Design of Web Clock
16.4.4 Complete Web clock source code
16.5 Summary
Chapter 17 XML DOM and XML HTTP
17.1 What is XML DOM object
17.1.1 Introduction to XML DOM
17.1.2 XML DOM interface supported by browsers
17.1.2.1 XML DOM standard interface
17.1.2.2 IE’s XML DOM component
17.1.2.3 Manipulating XML documents--an example of using MSXML to manipulate XML documents
17.2 Version compatibility of XML DOM--Cross-browser application of XML DOM
17.3 XML DOM error handling
17.3.1 ParseError object for handling error messages
17.3.2 Documents containing error messages
17.4 XML DOM manipulation of XML documents
17.4.1 Access Node
17.4.2 Create new node
17.4.3 Moving and modifying nodes and their examples
17.4.4 Reading and writing node attributes and reading and writing data
17.4.5 Save document
17.5 An example--JavaScript chess record reader (2)
17.5.1 Use XML to describe chess records
17.5.2 Convert XML chess records to SGF chess records
17.6 What is an XML HTTP object
17.6.1 Introduction to XML HTTP objects
17.6.2 XML HTTP objects supported by browsers
17.7 Sending requests via XML HTTP
17.7.1 Establishing a connection
17.7.2 Send request
17.8 Reading and setting HTTP headers
17.8.1 What are HTTP headers
17.8.2 Reading and setting HTTP headers
17.9 Server response
17.9.1 Synchronous and asynchronous responses and their examples
17.9.2 ResponseText and ResponseXML containing response text content
17.10 Summary
Chapter 18 Introduction to Ajax
18.1 What is Ajax
18.1.1 Ajax is not mysterious
18.1.2 Ajax application scenarios
18.1.3 Competitors of Ajax—Other Alternative Technologies
18.2 A preliminary exploration of Ajax--my first Ajax program
18.2.1 Start with a regular application - a simple real-time chat room
18.2.2 Annoying page refresh
18.2.3 No-refresh solution--Improved chat room
18.2.4 Asynchronous work--solution to lag
18.3 Analysis of Ajax principles
18.3.1 XML HTTP real-time communication and a simple example of encapsulating the AjaxProxy object
18.3.2 Dynamic display of data--an important feature of Ajax to improve interactive experience
18.3.3 Leverage the power of XML
18.3.4 Binding everything with JavaScript
18.3.5 Standards behind applications
18.4 Ajax example--real-time chat tool
18.4.1 What is a real-time chat tool
18.4.2 Requirements analysis--Key points for implementing the real-time chat function
18.4.3 System implementation--implementation of real-time chat function
18.4.4 Summary
18.5 Summary
Chapter 19 Standards and Compatibility
19.1 Standardization Organization
19.1.1 W3C and DOM standards
19.1.2 ECMA and JavaScript standards
19.1.3 Internet standards
19.2 Platform and browser compatibility
19.2.1 Least common denominator method
19.2.2 Defensive Coding
19.2.3 Client Detector
19.2.4 Feature detection
19.2.5 Implementing standards
19.2.6 Moderate shutdown
19.3 Language version compatibility
19.3.1 language attribute
19.3.2 Version Test
19.4 How to implement cross-browser applications
19.4.1 Trade-offs--Delimiting the scope of support
19.4.2 Basic module design--independent compatibility detection
19.4.3 Divide run levels
19.4.4 Give the right information—don’t make your code silent
19.4.5 Adequate application testing--the "compatibility devil" will always "kick your dog" when you are not paying attention
19.4.6 Proximity standard and proximity principle
19.5 Looking to the future
19.6 Summary
Chapter 20 Information Security
20.1 User’s private information
20.2 Prohibited and Restricted Operations
20.2.1 Restricted attributes
20.2.2 Restricted operations
20.2.3 Script security level
20.2.4 Script debugging
20.3 Beware of attackers behind the scenes
20.3.1 Attack methods
20.3.2 Hidden data flow
20.3.3 Page camouflage
20.3.4 Finding clues
20.3.5 Prevention methods
20.3.5.1 Encryption of transmitted data
20.3.5.2 Hiding source code from users
20.4 Same origin policy
20.4.1 What is the same-origin policy
20.4.2 Advantages and Disadvantages of Same Origin Policy
20.4.3 Break through the same-origin strategy
20.5 Security Zone and Signature Script
20.5.1 Configurable security policy solution
20.5.2 Internet Explorer’s Safe Zone
20.5.3 Netscape’s signature script
20.6 Security of the code itself--encryption and obfuscation
20.6.1 Why Encryption and Obfuscation
20.6.2 Client-side encryption technology and examples
20.6.3 Principle of code obfuscation
20.6.4 JavaScript code obfuscation tool--an example of code obfuscation algorithm
20.6.5 Combination of encryption and obfuscation
20.7 Summary
Part 5 Beyond JavaScript
Chapter 21 Object-oriented
21.1 What is object-oriented
21.1.1 Classes and Objects
21.1.2 Public and private – encapsulation of attributes
21.1.3 Types of properties and methods
21.2 Magical prototype
21.2.1 What is prototype
21.2.2 Tips on using prototype
21.2.2.1 Add properties to prototype objects
21.2.2.2 Point object with default value
21.2.2.3 Delete operation restores object attributes to default values
21.2.2.4 Use prototype to cleverly design getters
21.2.2.5 The delete operation restores the visibility of prototype attributes
21.2.2.6 Using prototype to create a large number of copies
21.2.2.7 Use prototype to define static methods
21.2.3 The essence of prototype and its examples
21.2.4 The value and limitations of prototype
21.3 Inheritance and polymorphism
21.3.1 What is inheritance
21.3.2 Methods to implement inheritance
21.3.2.1 Construction inheritance method and its examples
21.3.2.2 Prototypal inheritance and its examples
21.3.2.3 Instance inheritance method and its examples
21.3.2.4 Copy inheritance method and its examples
21.3.2.5 Comparison of several inheritance methods
21.3.2.6 Mixed inheritance and its examples
21.3.3 Single inheritance and multiple inheritance
21.3.4 Interface and its implementation
21.3.5 Polymorphism and its implementation
21.4 Construction and destruction
21.4.1 Constructor
21.4.2 Multiple construction
21.4.3 Destruction
21.5 Mystery! "this" maze
21.5.1 Countless traps--the troubling mystery of "this"
21.5.1.1 Use of this pronoun
21.5.1.2 this “trap”
21.5.1.3 Asynchronous problem of this pronoun
21.5.2 Substituting advantages and disadvantages--bad usage habits
21.5.3 Asynchronous call--Who touched my "this"
21.5.4 Uncovering the truth--The nature of "this" in JavaScript
21.5.5 No more difficulty--Use closure to correct "this" reference
21.6 Packaging objects
21.6.1 Distinguish between values and references
21.6.2 Packing and unboxing
21.7 Metaclass, class template
21.7.1 What is a metaclass
21.7.2 Metaclass--the class that constructs the class
21.7.3 Why use metaclass
21.7.4 Class Factory
21.7.4.1 What is a class factory
21.7.4.2 Why establish a class factory
21.8 Who is the Creator
21.8.1 Principles that apply to everything
21.8.2 The ultimate in abstraction--an example of abstract pattern
21.8.3 Return to nature, homologous architecture
21.9 Summary
Chapter 22 Closures and Functional Programming
22.1 Dynamic languages and closures
22.1.1 Dynamic Language
22.1.2 Syntax Domain and Execution Domain
22.1.3 JavaScript closures - an example that reflects the essence of closures
22.2 Characteristics and forms of closure
22.2.1 The interior of closure--the realm of autonomy
22.2.2 Accessing the external environment--an example of using closures to change the external environment
22.2.3 Closures and object-oriented
22.2.4 Other forms of closure
22.3 Situations where closure is not suitable
22.4 Functional Programming
22.4.1 What is functional programming
22.4.1.1 Functions are of type 1
22.4.1.2 Closures and functional programming
22.4.1.3 Currying-an interesting concept
22.4.1.4 Delayed evaluation and continuation--an example of Fibonacci infinite sequence
22.4.2 Functional programming, formulation and mathematical models--an example of a parabolic equation
22.4.3 Advantages of functional programming
22.4.3.1 Advantages of unit testing
22.4.3.2 Debugging Advantages
22.4.3.3 Advantages of parallelism
22.4.3.4 Advantages of hot code deployment
22.4.3.5 Machine-assisted reasoning and optimization
22.4.4 Disadvantages of functional programming
22.4.4.1 Side effects of closures
22.4.4.2 Recursive form
22.4.4.3 Side effects of delayed evaluation
22.5 Closures and object-oriented
22.5.1 Private domain
22.5.2 Namespace management
22.5.3 Friends - a very interesting concept
22.6 Python-style JavaScript code
22.6.1 Minimum code
22.6.2 Lightweight reuse
22.6.2.1 JSON
22.6.2.2 Functional
22.6.2.3 Iteration function--an example of Array iteration function
22.6.3 Module management and its examples
22.7 Summary
Chapter 23 Module Level Management
23.1 Modular management
23.1.1 Modularization--Code reuse
23.1.2 JavaScript module management
23.2 Open-closed principle and interface-oriented
23.2.1 Open and closed principle
23.2.2 Interface-oriented
23.3 Name space management
23.3.1 What is a namespace
23.3.2 Why use namespace
23.3.3 JavaScript namespace management
23.4 Calling dependencies
23.4.1 Module dependencies
23.4.2 Management of module dependencies
23.5 Use code to manage code
23.5.1 Management of runtime environment
23.5.2 Managed code--a simple managed code "container"
23.5.3 A complete code management container
23.6 Summary
Chapter 24 Dynamic Construction
24.1 Let the code write the code
24.1.1 Dynamic parsing of scripts
24.1.2 Grammar extension--Create your own language
24.2 “Invented” syntax
24.2.1 Regular expressions and syntax analysis and examples
24.2.2 A simple grammar parser implementation
24.2.2.1 What is JavaScript 2.0 syntax
24.2.2.2 Implementation of some key features of JavaScript 2.0 syntax
24.3 Implement your own dialect--LispScript
24.3.1 From JavaScript to Lisp
24.3.2 Initial work--general JavaScript code
24.3.3 Axioms, expressions
24.3.4 Seven basic postulates of functional programming
24.3.4.1 “Reference” postulate
24.3.4.2 “Atomic” postulate
24.3.4.3 “Equal value” postulate
24.3.4.4 "Table header" postulate
24.3.4.5 “Remainder table” postulate
24.3.4.6 “sum table” postulate
24.3.4.7 “Conditional” Postulate
24.3.5 Function Grammar
24.3.6 Defining new functions using LispScript
24.3.7 A surprise--_eval
24.3.8 Other extensions
24.3.9 Summary
24.3.10 Runtime environment and code container - look at the actual performance of the "newly invented" LispScript
24.4 Summary
Chapter 25 Execution Efficiency
25.1 Why should we discuss execution efficiency
25.1.1 Complaints from customers – How slow can JavaScript be
25.1.2 Whose fault is the code slowing down
25.2 The price of closure
25.2.1 Performance issues of excessive encapsulation
25.2.2 Advantages and Disadvantages of Information Hiding
25.2.3 Cost of constructing objects
25.3 Flowing Fire in the Box
25.3.1 DOM memory overhead
25.3.2 Browser memory management
25.3.3 See a fact clearly - the existence of memory leaks
25.3.4 Note--Close your "box" in time
25.3.5 Clarification of some misunderstandings
25.3.5.1 Script dynamically creates DOM causing memory leak
25.3.5.2 Closures cause memory leaks
25.4 Dynamics--Devils and Angels
25.4.1 Performance analysis of dynamic parsing--an efficiency test of dynamic characteristics
25.4.2 Development efficiency and execution efficiency--an eternal difficult choice
25.4.3 Beauty and Applicability--Learn to withstand the temptation of the devil
25.4.4 Act as an angel in the eyes of customers
25.5 Let the code dance
25.5.1 Simplicity is beautiful--slimming the code
25.5.2 The most perfect application is not to use
25.5.3 High abstraction is to simplify the problem
25.5.4 Logic and expression are equally important
25.5.5 Keep the code rigorous
25.5.6 Beautiful writing style-makes readers happy
25.6 Summary
Chapter 26 Application Framework
26.1 Application Framework Overview
26.1.1 What is an application framework
26.1.2 Components of the application framework
26.1.2.1 Class Library
26.1.2.2 Core module
26.1.2.3 Environment configuration
26.1.2.4 User Manual
26.2 Why design an application framework
26.2.1 Scope of application framework
26.2.2 Advantages and Disadvantages of Application Framework
26.3 How to design the application framework
26.3.1 Grasp the design goal
26.3.2 Design Guidelines for Application Framework
26.3.3 What kind of application framework is a mature application framework
26.3.4 Application framework design method
26.3.5 Actual combat! Design a simple application framework
26.3.5.1 Self-describing
26.3.5.2 Basic interface and semantic code
26.3.5.3 Prototype extension of core objects
26.3.5.4 Simple method
26.3.5.5 Namespace
26.3.5.6 Standards and cross-browser support
26.3.5.7 Event model--Silverna's event model
26.3.5.8 Application Mode
26.3.5.9 Provide Ajax components
26.3.5.10 Memory Management and Others
26.4 Practical application of the framework--Widgets developed on the Silverna 2.0 framework
26.5 Existing application framework
26.5.1 Prototype
26.5.2 JQuery
26.5.3 Dojo
26.5.4 JSVM
26.5.5 Other frameworks
26.5.5.1 Bindows (established in 2003)
26.5.5.2 BackBase (established in 2003)
26.5.5.3 DOJO (under development, established in September 2004)
26.5.5.4 Open Rico (under development, founded in May 2005, based on an early proprietary framework)
26.5.5.5 qooxdoo (under development, established in May 2005)
26.5.5.6 Tibet (under development, created in June 2005)
26.5.5.7 AJFORM (created in June 2005)
26.6 Summary
All resources on this website are contributed and published by netizens, or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this website are for learning and reference only. Please do not use them for commercial purposes, otherwise you will be responsible for all consequences incurred! If there is any infringement, please contact us to delete and remove it. Contact information: admin@php.cn