在好例子网,分享、交流、成长!
您当前所在位置:首页js 开发实例JavaScript基础 → Professional JavaScript for Web Developers, 3rd Edition

Professional JavaScript for Web Developers, 3rd Edition

JavaScript基础

下载此实例
  • 开发语言:js
  • 实例大小:51.56M
  • 下载次数:10
  • 浏览次数:59
  • 发布时间:2023-01-17
  • 实例类别:JavaScript基础
  • 发 布 人:bovin
  • 文件格式:.pdf
  • 所需积分:3

实例介绍

【实例简介】Professional JavaScript for Web Developers, 3rd Edition

【实例截图】

【核心代码】

CONTENTS
FOREWORD xxxi
INTRODUCTION xxxiii
CHAPTER 1: WHAT IS JAVASCRIPT? 1
A Short History 2
JavaScript Implementations 3
ECMAScript 3
The Document Object Model (DOM) 6
The Browser Object Model (BOM) 9
JavaScript Versions 10
Summary 11
CHAPTER 2: JAVASCRIPT IN HTML 13
The <script> Element 13
Tag Placement 16
Deferred Scripts 16
Asynchronous Scripts 17
Changes in XHTML 18
Deprecated Syntax 20
Inline Code versus External Files 20
Document Modes 20
The <noscript> Element 22
Summary 22
CHAPTER 3: LANGUAGE BASICS 25
Syntax 25
Case-sensitivity 25
Identifi ers 26
Comments 26
Strict Mode 27
Statements 27
Keywords and Reserved Words 28
Variables 29
Data Types 31
The typeof Operator 31
xvi
CONTENTS
The Undefi ned Type 32
The Null Type 33
The Boolean Type 34
The Number Type 35
The String Type 41
The Object Type 44
Operators 45
Unary Operators 46
Bitwise Operators 49
Boolean Operators 56
Multiplicative Operators 59
Additive Operators 61
Relational Operators 63
Equality Operators 65
Conditional Operator 67
Assignment Operators 67
Comma Operator 68
Statements 69
The if Statement 69
The do-while Statement 70
The while Statement 70
The for Statement 71
The for-in Statement 72
Labeled Statements 73
The break and continue Statements 73
The with Statement 75
The switch Statement 76
Functions 78
Understanding Arguments 80
No Overloading 83
Summary 83
CHAPTER 4: VARIABLES, SCOPE, AND MEMORY 85
Primitive and Reference Values 85
Dynamic Properties 86
Copying Values 86
Argument Passing 88
Determining Type 89
Execution Context and Scope 90
Scope Chain Augmentation 92
No Block-Level Scopes 93
xvii
CONTENTS
Garbage Collection 96
Mark-and-Sweep 96
Reference Counting 97
Performance 98
Managing Memory 99
Summary 100
CHAPTER 5: REFERENCE TYPES 103
The Object Type 104
The Array Type 106
Detecting Arrays 110
Conversion Methods 110
Stack Methods 112
Queue Methods 113
Reordering Methods 114
Manipulation Methods 116
Location Methods 118
Iterative Methods 119
Reduction Methods 121
The Date Type 122
Inherited Methods 124
Date-Formatting Methods 125
Date/Time Component Methods 126
The RegExp Type 128
RegExp Instance Properties 131
RegExp Instance Methods 132
RegExp Constructor Properties 134
Pattern Limitations 136
The Function Type 136
No Overloading (Revisited) 138
Function Declarations versus Function Expressions 138
Functions as Values 139
Function Internals 141
Function Properties and Methods 143
Primitive Wrapper Types 146
The Boolean Type 148
The Number Type 149
The String Type 151
Singleton Built-in Objects 161
The Global Object 162
The Math Object 166
Summary 170
D ownload from Wow! eBook <www.wowebook.com>
xviii
CONTENTS
CHAPTER 6: OBJECT-ORIENTED PROGRAMMING 173
Understanding Objects 173
Types of Properties 174
Defi ning Multiple Properties 178
Reading Property Attributes 179
Object Creation 180
The Factory Pattern 180
The Constructor Pattern 181
The Prototype Pattern 184
Combination Constructor/Prototype Pattern 197
Dynamic Prototype Pattern 198
Parasitic Constructor Pattern 199
Durable Constructor Pattern 200
Inheritance 201
Prototype Chaining 202
Constructor Stealing 207
Combination Inheritance 209
Prototypal Inheritance 210
Parasitic Inheritance 211
Parasitic Combination Inheritance 212
Summary 215
CHAPTER 7: FUNCTION EXPRESSIONS 217
Recursion 220
Closures 221
Closures and Variables 224
The this Object 225
Memory Leaks 227
Mimicking Block Scope 228
Private Variables 231
Static Private Variables 232
The Module Pattern 234
The Module-Augmentation Pattern 236
Summary 237
CHAPTER 8: THE BROWSER OBJECT MODEL 239
The window Object 239
The Global Scope 240
Window Relationships and Frames 241
Window Position 244
xix
CONTENTS
Window Size 245
Navigating and Opening Windows 247
Intervals and Timeouts 251
System Dialogs 253
The location Object 255
Query String Arguments 256
Manipulating the Location 257
The Navigator Object 259
Detecting Plug-ins 262
Registering Handlers 264
The screen Object 265
The history Object 267
Summary 268
CHAPTER 9: CLIENT DETECTION 271
Capability Detection 271
Safer Capability Detection 273
Capability Detection Is Not Browser Detection 274
Quirks Detection 275
User-Agent Detection 276
History 277
Working with User-Agent Detection 286
The Complete Script 303
Usage 306
Summary 306
CHAPTER 10: THE DOCUMENT OBJECT MODEL 309
Hierarchy of Nodes 310
The Node Type 310
The Document Type 316
The Element Type 326
The Text Type 337
The Comment Type 341
The CDATASection Type 342
The DocumentType Type 343
The DocumentFragment Type 344
The Attr Type 345
Working with the DOM 346
Dynamic Scripts 346
Dynamic Styles 348
xx
CONTENTS
Manipulating Tables 350
Using NodeLists 353
Summary 354
CHAPTER 11: DOM EXTENSIONS 357
Selectors API 357
The querySelector() Method 358
The querySelectorAll() Method 358
The matchesSelector() Method 359
Element Traversal 360
HTML5 361
Class-Related Additions 361
Focus Management 364
Changes to HTMLDocument 364
Character Set Properties 366
Custom Data Attributes 366
Markup Insertion 367
The scrollIntoView() Method 372
Proprietary Extensions 372
Document Mode 373
The children Property 374
The contains() Method 374
Markup Insertion 376
Scrolling 379
Summary 379
CHAPTER 12: DOM LEVELS 2 AND 3 381
DOM Changes 382
XML Namespaces 382
Other Changes 386
Styles 390
Accessing Element Styles 391
Working with Style Sheets 396
Element Dimensions 401
Traversals 408
NodeIterator 410
TreeWalker 413
Ranges 415
Ranges in the DOM 415
Ranges in Internet Explorer 8 and Earlier 424
Summary 428
xxi
CONTENTS
CHAPTER 13: EVENTS 431
Event Flow 432
Event Bubbling 432
Event Capturing 433
DOM Event Flow 433
Event Handlers 434
HTML Event Handlers 434
DOM Level 0 Event Handlers 437
DOM Level 2 Event Handlers 438
Internet Explorer Event Handlers 439
Cross-Browser Event Handlers 441
The Event Object 442
The DOM Event Object 442
The Internet Explorer Event Object 447
Cross-Browser Event Object 449
Event Types 451
UI Events 452
Focus Events 458
Mouse and Wheel Events 459
Keyboard and Text Events 471
Composition Events 478
Mutation Events 479
HTML5 Events 482
Device Events 490
Touch and Gesture Events 494
Memory and Performance 498
Event Delegation 498
Removing Event Handlers 500
Simulating Events 502
DOM Event Simulation 502
Internet Explorer Event Simulation 508
Summary 509
CHAPTER 14: SCRIPTING FORMS 511
Form Basics 511
Submitting Forms 512
Resetting Forms 513
Form Fields 514
Scripting Text Boxes 520
Text Selection 521
xxii
CONTENTS
Input Filtering 524
Automatic Tab Forward 528
HTML5 Constraint Validation API 530
Scripting Select Boxes 534
Options Selection 536
Adding Options 537
Removing Options 538
Moving and Reordering Options 539
Form Serialization 540
Rich Text Editing 542
Using contenteditable 543
Interacting with Rich Text 543
Rich Text Selections 547
Rich Text in Forms 549
Summary 549
CHAPTER 15: GRAPHICS WITH CANVAS 551
Basic Usage 551
The 2D Context 553
Fills and Strokes 553
Drawing Rectangles 553
Drawing Paths 556
Drawing Text 557
Transformations 559
Drawing Images 563
Shadows 564
Gradients 565
Patterns 567
Working with Image Data 567
Compositing 569
WebGL 571
Typed Arrays 571
The WebGL Context 576
Support 588
Summary 588
CHAPTER 16: HTML5 SCRIPTING 591
Cross-Document Messaging 591
Native Drag and Drop 593
Drag-and-Drop Events 593
xxiii
CONTENTS
Custom Drop Targets 594
The dataTransfer Object 595
DropEff ect and eff ectAllowed 596
Draggability 597
Additional Members 598
Media Elements 598
Properties 599
Events 601
Custom Media Players 602
Codec Support Detection 603
The Audio Type 604
History State Management 605
Summary 606
CHAPTER 17: ERROR HANDLING AND DEBUGGING 607
Browser Error Reporting 607
Internet Explorer 608
Firefox 609
Safari 610
Opera 612
Chrome 613
Error Handling 614
The try-catch Statement 615
Throwing Errors 619
The error Event 622
Error-handling Strategies 623
Identify Where Errors Might Occur 623
Distinguishing between Fatal and Nonfatal Errors 628
Log Errors to the Server 629
Debugging Techniques 630
Logging Messages to a Console 631
Logging Messages to the Page 633
Throwing Errors 634
Common Internet Explorer Errors 635
Operation Aborted 635
Invalid Character 637
Member Not Found 637
Unknown Runtime Error 638
Syntax Error 638
The System Cannot Locate the Resource Specifi ed 639
Summary 639
xxiv
CONTENTS
CHAPTER 18: XML IN JAVASCRIPT 641
XML DOM Support in Browsers 641
DOM Level 2 Core 641
The DOMParser Type 642
The XMLSerializer Type 644
XML in Internet Explorer 8 and Earlier 644
Cross-Browser XML Processing 649
XPath Support in Browsers 651
DOM Level 3 XPath 651
XPath in Internet Explorer 656
Cross-Browser XPath 657
XSLT Support in Browsers 660
XSLT in Internet Explorer 660
The XSLTProcessor Type 665
Cross-Browser XSLT 667
Summary 668
CHAPTER 19: ECMASCRIPT FOR XML 671
E4X Types 671
The XML Type 672
The XMLList Type 673
The Namespace Type 674
The QName Type 675
General Usage 676
Accessing Attributes 678
Other Node Types 679
Querying 681
XML Construction and Manipulation 682
Parsing and Serialization Options 685
Namespaces 686
Other Changes 688
Enabling Full E4X 689
Summary 689
CHAPTER 20: JSON 691
Syntax 691
Simple Values 692
Objects 692
Arrays 693
Parsing and Serialization 694
xxv
CONTENTS
The JSON Object 695
Serialization Options 696
Parsing Options 699
Summary 700
CHAPTER 21: AJAX AND COMET 701
The XMLHttpRequest Object 702
XHR Usage 703
HTTP Headers 706
GET Requests 707
POST Requests 708
XMLHttpRequest Level 2 710
The FormData Type 710
Timeouts 711
The overrideMimeType() Method 711
Progress Events 712
The load Event 712
The progress Event 713
Cross-Origin Resource Sharing 714
CORS in Internet Explorer 714
CORS in Other Browsers 716
Prefl ighted Requests 717
Credentialed Requests 718
Cross-Browser CORS 718
Alternate Cross-Domain Techniques 719
Image Pings 719
Comet 721
Server-Sent Events 723
Web Sockets 725
SSE versus Web Sockets 727
Security 728
Summary 729
CHAPTER 22: ADVANCED TECHNIQUES 731
Advanced Functions 731
Safe Type Detection 731
Scope-Safe Constructors 733
Lazy Loading Functions 736
Function Binding 738
Function Currying 741
xxvi
CONTENTS
Tamper-Proof Objects 743
Nonextensible Objects 744
Sealed Objects 744
Frozen Objects 745
Advanced Timers 746
Repeating Timers 748
Yielding Processes 750
Function Throttling 752
Custom Events 755
Drag and Drop 758
Fixing Drag Functionality 760
Adding Custom Events 762
Summary 764
CHAPTER 23: OFFLINE APPLICATIONS AND CLIENT-SIDE
STORAGE 765
Offl ine Detection 765
Application Cache 766
Data Storage 768
Cookies 768
Internet Explorer User Data 778
Web Storage 780
IndexedDB 786
Summary 799
CHAPTER 24: BEST PRACTICES 801
Maintainability 801
What Is Maintainable Code? 802
Code Conventions 802
Loose Coupling 805
Programming Practices 809
Performance 814
Be Scope-Aware 814
Choose the Right Approach 816
Minimize Statement Count 821
Optimize DOM Interactions 824
Deployment 827
Build Process 827
Validation 829
Compression 830
Summary 833
xxvii
CONTENTS
CHAPTER 25: EMERGING APIS 835
RequestAnimationFrame() 835
Early Animation Loops 836
Problems with Intervals 836
mozRequestAnimationFrame 837
webkitRequestAnimationFrame and msRequestAnimationFrame 838
Page Visibility API 839
Geolocation API 841
File API 843
The FileReader Type 844
Partial Reads 846
Object URLs 847
Drag-and-Drop File Reading 848
File Upload with XHR 849
Web Timing 851
Web Workers 852
Using a Worker 852
Worker Global Scope 853
Including Other Scripts 855
The Future of Web Workers 855
Summary 856
APPENDIX A: ECMASCRIPT HARMONY 857
General Changes 857
Constants 858
Block-Level and Other Scopes 858
Functions 859
Rest and Spread Arguments 859
Default Argument Values 860
Generators 861
Arrays and Other Structures 861
Iterators 862
Array Comprehensions 863
Destructuring Assignments 864
New Object Types 865
Proxy Objects 865
Proxy Functions 868
Map and Set 868
WeakMap 869
StructType 869
xxviii
CONTENTS
ArrayType 870
Classes 871
Private Members 872
Getters/Setters 872
Inheritance 873
Modules 874
External Modules 875
APPENDIX B: STRICT MODE 877
Opting-in 877
Variables 878
Objects 878
Functions 879
eval() 880
eval and arguments 881
Coercion of this 882
Other Changes 882
APPENDIX C: JAVASCRIPT LIBRARIES 885
General Libraries 885
Yahoo! User Interface Library (YUI) 885
Prototype 886
The Dojo Toolkit 886
MooTools 886
jQuery 886
MochiKit 886
Underscore.js 887
Internet Applications 887
Backbone.js 887
Rico 887
qooxdoo 887
Animation and Eff ects 888
script.aculo.us 888
moo.fx 888
Lightbox 888
Cryptography 888
JavaScript MD5 889
JavaScrypt 889
xxix
CONTENTS
APPENDIX D: JAVASCRIPT TOOLS 891
Validators 891
JSLint 891
JSHint 892
JavaScript Lint 892
Minifi ers 892
JSMin 892
Dojo ShrinkSafe 892
YUI Compressor 893
Unit Testing 893
JsUnit 893
YUI Test 893
Dojo Object Harness (DOH) 894
qUnit 894
Documentation Generators 894
JsDoc Toolkit 894
YUI Doc 894
AjaxDoc 895
Secure Execution Environments 895
ADsafe 895
Caja 895
INDEX 897

实例下载地址

Professional JavaScript for Web Developers, 3rd Edition

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警