#

Document Object Model (DOM)

DOM (short for Document Object Model) is a cross-platform and language-independent interface that treats an HTML or XML document as a tree structure wherein each node is an object representing a part of the document. The DOM represents a document with a logical tree. Each branch of the tree ends in a node, and each node contains objects. DOM methods allow programmatic access to the tree; with them one can change the structure, style or content of a document. Nodes can have event handlers (also known as event listeners) attached to them. Once an event is triggered, the event handlers get executed.

The principal standardization of the DOM was handled by the World Wide Web Consortium (W3C), which last developed a recommendation in 2004. WHATWG took over the development of the standard, publishing it as a living document. The W3C now publishes stable snapshots of the WHATWG standard.

In HTML DOM (Document Object Model), every element is a node:

  • A document is a document node.
  • All HTML elements are element nodes.
  • All HTML attributes are attribute nodes.
  • Text inserted into HTML elements are text nodes.
  • Comments are comment nodes.
preactjs/preact
https://static.github-zh.com/github_avatars/preactjs?size=40
JavaScript 37.96 k
2 天前
https://static.github-zh.com/github_avatars/niklasvh?size=40

一个用于实现网页截图的 JavaScript 库

TypeScript 31.54 k
1 年前
https://static.github-zh.com/github_avatars/cheeriojs?size=40
TypeScript 29.74 k
13 小时前
https://static.github-zh.com/github_avatars/cure53?size=40

DOMPurify - a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. DOMPurify works with a secure default, but offers a lot of configurability and hooks. Demo:

JavaScript 15.85 k
5 天前
QwikDev/partytown
https://static.github-zh.com/github_avatars/QwikDev?size=40

Partytown 是一个 JavaScript 延迟加载库,帮助我们将资源密集型脚本迁移到Web Worker 中,与主线程分离。

TypeScript 13.5 k
6 天前
jhy/jsoup
https://static.github-zh.com/github_avatars/jhy?size=40
Java 11.24 k
11 小时前
https://static.github-zh.com/github_avatars/tsayen?size=40
JavaScript 10.69 k
1 年前
https://static.github-zh.com/github_avatars/choojs?size=40
JavaScript 6.77 k
6 年前
https://static.github-zh.com/github_avatars/bubkoo?size=40

✂️ Generates an image from a DOM node using HTML5 canvas and SVG.

TypeScript 6.68 k
3 个月前
https://static.github-zh.com/github_avatars/zeroclipboard?size=40

#前端开发#[停止维护] ZeroClipboard 库提供了一种使用不可见的 Adobe Flash movie 和 JavaScript 接口将文本复制到剪贴板的简单方法。

JavaScript 6.6 k
5 年前
phuocng/html-dom
https://static.github-zh.com/github_avatars/phuocng?size=40

Common tasks of managing HTML DOM with vanilla JavaScript. Give me 1 ⭐if it’s useful.

MDX 6.56 k
1 年前
https://static.github-zh.com/github_avatars/imba?size=40

#编程语言#Imba 是一种面向 Web App 的新编程语言,受Ruby启发,可编译成具有高性能和可读性的JavaScript。

JavaScript 6.46 k
3 天前
https://static.github-zh.com/github_avatars/zumerlab?size=40

snapDOM captures HTML elements to images with exceptional speed and accuracy.

JavaScript 6.03 k
3 天前
https://static.github-zh.com/github_avatars/Rich-Harris?size=40

Morph DOM elements from one state to another with smooth animations and transitions

JavaScript 5.45 k
9 年前
https://static.github-zh.com/github_avatars/AngleSharp?size=40

👼 The ultimate angle brackets parser library parsing HTML5, MathML, SVG and CSS to construct a DOM based on the official W3C specifications.

C# 5.39 k
2 个月前
loading...

Created by World Wide Web Consortium

发布于 October 1, 1998

Repository
whatwg/dom
Website
dom.spec.whatwg.org
Wikipedia
维基百科

相关主题

HTMLXML