DOM Scripting: Web Design with JavaScript and the Document Object Model (2nd Edition) cover

DOM Scripting: Web Design with JavaScript and the Document Object Model (2nd Edition)

Rating 4.3
Chapters
13
Series
Turing Programming Series · Web Development
ISBN
9787115249999

Tags

Summary

This book is the Chinese translation of the second edition of DOM Scripting: Web Design with JavaScript and the Document Object Model, co-authored by longtime web standards advocate Jeremy Keith and web developer Jeffrey Sambells. The book proceeds by first explaining the principles clearly and then putting them into practice: it opens with a review of the history of JavaScript and the DOM, tracing the browser wars and the development of standards; it then explains JavaScript fundamentals in plain language (statements, variables, data types, arrays and objects, conditionals and loops, functions) and systematically introduces the DOM node model—element nodes, text nodes, attribute nodes—along with common methods for getting elements and reading and writing attributes. Building on this, the book advances step by step through a JavaScript image gallery case study, from the initial simple implementation to a complete separation of structure and behavior: it covers a set of core front-end development principles including graceful degradation, progressive enhancement, backward compatibility, object detection, and performance optimization, and demonstrates how to dynamically create markup, enrich document content, read and write styles via CSS-DOM, and create controllable animation with timers. The second edition also adds discussion of HTML5 (Canvas, audio and video, new form features) and JavaScript libraries such as jQuery, and the final chapter ties together the book's knowledge through a complete site project. The book is modest in length but excels at explaining why code is written the way it is, and it is a well-regarded introductory classic among Chinese front-end readers.

Editor's review

市面上讲JavaScript的书很多,但多数一上来就堆API,读者抄完示例仍不知道为什么要那样写。这本书难得地把“原则”放在“技巧”前面:平稳退化、渐进增强、行为与结构分离、对象检测——这些今天看来理所当然的观念,在书中都是用一个个具体案例“逼”出来的。 作者Jeremy Keith是Web标准运动的老兵,行文带着英式的克制与幽默,讲图片库、讲动画都像在讲故事,代码短小、可以直接跑起来,读起来不会有啃规范的挫败感。第二版补充了HTML5与jQuery的内容,虽然成书较早、部分API与如今的主流框架已有距离,但它训练的是“理解DOM与浏览器如何协作”的底层思维,这部分不会过时。 对于刚接触前端、或者从框架入门想回头补基础的读者,这是一本投入产出比很高的书:两周左右能读完,却能帮你建立一套沿用多年的判断标准。

Who it's for

A good fit for

  • 刚接触前端、希望系统理解DOM与事件机制的自学者
  • 从框架或工具链入门、想回头补齐原生JavaScript基础的人
  • 高校Web开发课程的学生,可作为教材之外的实践读物
  • 需要给团队新人做前端入门的带教者与培训讲师

Not a good fit for

  • 希望学习现代框架(React、Vue)与工程化构建的读者
  • 需要覆盖ES6+新语法与最新浏览器API的进阶开发者
  • 寻找可直接用于生产环境完整案例与项目模板的人

Reading tips

  1. 先把第2—3章的语法与DOM基础读透,再进入后面的案例,不要在第一章就跳过
  2. 每个案例都亲手敲一遍代码,并故意删掉几行看看退化效果,体会“平稳退化”的含义
  3. 读到第5章“最佳实践”时可回头重读前面代码,用新原则审视自己最初的写法
  4. HTML5与JavaScript库两章可作为延伸阅读,配合当前浏览器与官方文档对照理解

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Chapter 1 A Brief History of JavaScript
  2. Chapter 2 JavaScript Syntax
  3. Chapter 3 The DOM
  4. Chapter 4 Case Study: JavaScript Image Gallery
  5. Chapter 5 Best Practices
  6. Chapter 6 Case Study: An Improved Image Gallery
  7. Chapter 7 Dynamically Creating Markup
  8. Chapter 8 Enriching Document Content
  9. Chapter 9 CSS-DOM
  10. Chapter 10 Animation with JavaScript
  11. Chapter 11 HTML5
  12. Chapter 12 A Comprehensive Example
  13. Appendix JavaScript Libraries

FAQ

这本书适合零基础学编程的人吗?
它假定读者了解HTML与CSS的基本写法,但对JavaScript本身不做前提要求。书中从语句、变量讲起,因此有网页制作基础、没写过脚本的读者也能跟上;完全没有HTML概念则需先补基础。
第2版和第1版有什么区别?
第2版由Jeremy Keith与Jeffrey Sambells合作改写,补充了HTML5相关章节(Canvas、音视频、表单新特性)以及对jQuery等JavaScript库的讨论,案例与代码也更完整,目前流传最广的是第2版。
书中内容现在会不会过时?
书成于2011年前后,示例使用当时的写法,未涉及ES6以后的语法与主流框架;但DOM节点模型、事件处理、渐进增强等核心内容仍然有效,适合打基础,进阶仍需补充现代资料。
这本书能替代《JavaScript高级程序设计》吗?
不能互相替代。本书篇幅更小、侧重DOM操作与开发原则,适合入门第一本;《JavaScript高级程序设计》覆盖面更广、更深,二者常被读者按“先本书、后红宝书”的顺序阅读。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category