How webreflection/linkedom works
Main Components
a. Core DOM Implementation Layer
• Interface Components (interface/)
• HTML Elements (html/)
• DOM Core (dom/)
• XML/SVG Support (xml/, svg/)
b. Module Systems Layer
• ESM Implementation
• CJS Implementation
• Types Support
c. Parser Components
• DOMParser Implementation
• HTML Parser
• XML Parser
• JSDON Serializer/Deserializer
┌─────────────────────────────────────────────────────────┐
• Client Application │
• ┘
• ↓
┌─────────────────────────────────────────────────────────┐
• Public API Layer │
• ┬──────────────────────────┬────────────────┤
• DOMParser │ parseHTML │ parseJSON │
• ┴──────────────────────────┴────────────────┘
• ↓
┌─────────────────────────────────────────────────────────┐
• Core DOM Implementation │
• ┬──────────┬───────────┬──────────┬───────────┤
• Interface │ HTML │ DOM │ XML │ SVG │
• Layer │Elements │ Core │ Support │ Support │
• ┴──────────┴───────────┴──────────┴───────────┘
• ↓
┌─────────────────────────────────────────────────────────┐
• Shared Components │
• ┬──────────┬───────────┬──────────┬───────────┤
• Mixins │ Utils │ Cache │ JSDON │ Constants │
• ┴──────────┴───────────┴──────────┴───────────┘
Key Elements to Highlight
• Node relationships (parent-child connections)
• Module system support (ESM/CJS)
• Parser flow (HTML/XML → DOM nodes)
• Serialization/Deserialization paths
Important Relationships
• Document → Node hierarchy
• Element inheritance chain
• Parser → DOM node creation flow
• Cache system (optional component)
• JSDON serialization paths
Implementation Details
[Node Structure Detail]
┌─────────────────┐
• Node │
• ┤
• ← Previous Link │
• → Next Link │
• ↑ Parent Link │
• ┘
Additional Notes
• Version information
• Cached vs. non-cached variants
• Performance-critical paths
• Module resolution paths
• The lightweight nature of the implementation
• The triple-linked list architecture
• The separation between core DOM functionality and parsing
• The multiple module system support
• The optimization paths for both cached and non-cached versions