RepositoryJavaScript
JS

jsdom/jsdom

A JavaScript implementation of various web standards, for use with Node.js

21.8kstars
1.8kforks
217issues
1views

Thành tựu nổi bật

Những danh hiệu mới nhất của dự án

1
TINIX TRENDING·Chủ đề: jsdom

#1 Repository Của Tuần

1
TINIX TRENDING·Chủ đề: dom-apis

#1 Repository Của Tuần

1
TINIX TRENDING·Chủ đề: dom-apis

#1 Repository Của Tuần

🧪 jsdom: Mô phỏng trình duyệt trong Node.js để test và scrape web

Một thư viện JavaScript thuần sạch cài đặt các chuẩn WHATWG DOM và HTML, giúp bạn chạy mã web như thể đang ở trình duyệt — hoàn toàn trong môi trường Node.js.

jsdom là một phần mềm thuần JavaScript cài đặt nhiều chuẩn web nổi bật như DOM và HTML theo tiêu chuẩn WHATWG, dùng cho Node.js. Mục tiêu chính là mô phỏng một phần nhỏ của trình duyệt đủ để hữ:: sử dụng cho việc kiểm thử và thu thập dữ liệu từ các ứng dụng web thực tế.

✨ Điểm nổi bật

  • Hỗ trợ chuẩn WHATWG: Cài đặt các API DOM và HTML chuẩn, tương thích với hành vi của trình duyệt thực.
  • Dùng JSDOM để tạo cửa sổ ảo: Truyền chuỗi HTML vào hàm khởi tạo, nhận đối tượng window để tương tác như trong trình duyệt.
  • Tùy chỉnh chi tiết: Hỗ trợ cài đặt url, referrer, contentType, includeNodeLocations, storageQuota để kiểm soát hành vi phân tích và lưu trữ.
  • Thực thi script an toàn: Có thể bật runScripts: "dangerously" để chạy mã JavaScript bên trong trang, nhưng cần cẩn trọng với mã độc.
  • Phân tích cú pháp giống trình duyệt: Tự động thêm thẻ <html>, <head>, <body> như trình duyệt thực khi phân tích HTML.
  • Hỗ trợ tải tài nguyên bên ngoài: Cho phép tải script hoặc tài nguyên khác qua tùy chọn resources: "usable".

💡 Vì sao đáng chú ý

Không giống các công cụ mô phỏng trình duyệt nặng nề, jsdom tập trung vào một tập hợp nhỏ các API DOM cần thiết, nhưng đủ mạnh để kiểm thử logic JavaScript và xử lý HTML. Đây là lựa chọn lý tưởng khi bạn cần kiểm tra cách ứng dụng phản hồi với DOM mà không cần khởi động trình duyệt thực sự.


#jsdom #NodeJS #WebStandards #DOM #Testing

Similar Projects

Discover other similar projects and AI models.

RepositoryC++
electron/electron

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

124.3k
Dec 2, 2026
RepositoryJavaScript
twbs/bootstrap

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

175.1k
Dec 1, 2026
RepositoryTypeScript
freeCodeCamp/freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.

459.9k
Dec 2, 2026
Repository
getify/You-Dont-Know-JS

A book series (2 published editions) on the JS language.

184.8k
Oct 31, 2026
RepositoryJavaScript
Chalarangelo/30-seconds-of-code

Coding articles to level up your development skills

129.6k
Nov 17, 2026
RepositoryJavaScript
nodejs/node

Node.js JavaScript runtime ✨🐢🚀✨

124.1k
Nov 30, 2026
RepositoryJavaScript
microsoft/Web-Dev-For-Beginners

24 Lessons, 12 Weeks, Get Started as a Web Developer

97.2k
Dec 1, 2026
RepositoryJavaScript
react/react

The library for web and native user interfaces.

253.0k
Nov 30, 2026
RepositoryJavaScript
trekhleb/javascript-algorithms

📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

196.8k
Jul 26, 2026