# html2canvas-pro Architecture ## Overview html2canvas-pro is a pure TypeScript DOM-to-Canvas rendering engine. It takes a live DOM element and produces an `` that visually matches it — no external dependencies. ``` DOM Clone → CSS Parse → Layout → Stacking Context → Canvas Render ``` ## Rendering Pipeline ### Phase 1: DOM Cloning (`src/dom/`) `DocumentCloner` (`document-cloner.ts`) deep-clones the source DOM tree into a hidden ``. This is necessary because: 1. **getComputedStyle** returns resolved values — the clone must exist in a real document. 2. **Cross-origin isolation** — the iframe `about:blank` origin prevents taint. 3. **CSS resolution** — inline `