Chisle
코딩 에이전트 플러그인, 20개 실시간 작업에서 기본 모델 52% 활용, 간결한 페르소나와 출력 압축 제공
메이커가 쓴 소개는 위의 한 줄이 전부입니다. 더 자세한 내용은 저장소 README에서 읽을 수 있습니다. 저장소 README ↗
README 전체를 불러오는 중입니다.
README 전문 보기 ↗Mock the DOM for server-side DOM state and in tests.
Pseudo DOM recreates the browser DOM API (following the MDN documentation) so DOM-dependent code can run in Node - in tests, without a real or headless browser. It is written in TypeScript and ships its type definitions.
npm install pseudo-dom
const { installGlobal, logElement } = require('pseudo-dom')
installGlobal(globalThis) // document, Node, Element, ... now exist, as in a browser
const button = document.createElement('button')
button.className = 'go'
button.textContent = 'Go'
button.addEventListener('click', () => { button.textContent = 'Went' })
document.body.appendChild(button)
button.click()
console.log(document.body.innerHTML) // <button class="go">Went</button>
console.log(document.querySelector('button.go') === button) // true
logElement(document.body) // an indented view of the markup
installGlobal() does nothing when a real DOM is already there (a browser, or a jsdom test environment), so it is safe
to call everywhere.
classList, a real live style and dataset, children, and DOM-style mutation
(append, before, remove, replaceWith, ...)value and checkedinnerHTML / outerHTML / insertAdjacentHTML parse and serialize real HTMLquerySelector / querySelectorAll with real CSS selectors, getElementById, matches, closestcreateElement, createTextNode, and generateDocument() to get a window-like object with
document already on itcloneNode, isEqualNode, compareDocumentPosition, containssimulate.click(element) and simulate.keyPress(element, key) send the events a real user
action sendsinstallGlobal() makes code written against real DOM globals run unmodified in NodeThere is no layout engine or CSS cascade: what would need one (sizes, bounding boxes, ...) is settable directly.
A pre-built bundle is included (browser/pseudo-dom.js, .min.js - also served directly via
unpkg or jsDelivr) and exposes the same
functions as a global:
<script src="https://unpkg.com/pseudo-dom"></script>
<script>
pseudoDom.installGlobal(window)
</script>
The guide, and the reference for every class, function and type, is at
joshuaheagle.com/projects/pseudo-dom/docs. It is
generated from the TypeScript source, and each module is a folder of src/:
| Module | What it holds |
|---|---|
services | The classes which do the work: nodes, elements, documents, events |
interfaces | The shape of each DOM object (PseudoNode, PseudoElement, ...) |
classes | PseudoHTMLDocument, PseudoNodeList, ... |
factories | generateDocument, installGlobal, logElement, createEvent, and the parsing and query helpers |
functions | Small helpers such as getElementById and focus tracking |
simulate | click and keyPress, which send what a real user action sends |
npm install
npm test # the tests
npm run typecheck # the types
npm run build # dist/, browser/ and docs/
npm run docs # only the documentation