Selection API
Required for rich text editors, annotation tools, and any feature that reads or manipulates text selection. The Selection/Range model is how browsers track cursor position in contenteditable regions.
What It Defines
Defines the Selection and Range interfaces for programmatic text selection. Selection represents the user's highlighted text (window.getSelection()), Range represents a contiguous document fragment. Supports anchor/focus nodes, collapse, extend, and containsNode.
Canonical (Normative)
Convenient (Practical)
Publishes web platform specs including CSS, accessibility, security policies, Service Workers, Web App Manifest, and many browser APIs. Also maintains some versioned HTML/DOM specs.
Related Specs
Every frontend framework (React, Vue, Svelte) ultimately produces DOM operations. Understanding the event model and tree structure prevents subtle bugs.
Required for building rich text editors (Notion, Google Docs, ProseMirror, Tiptap). The beforeinput event with inputType lets you intercept and customize every editing operation before it happens.