Skip to content

contenteditable="false" 浏览器特性 #7

Description

@Jess-2021

contenteditable="false" 的元素被浏览器视为不可编辑的原子节点。浏览器的原生 Selection/Range API 对这类节点有特殊处理:

  • 无法从该元素内部发起选区(mousedown 不会在其内部创建 selection anchor)
  • 拖动经过时,选区的 Range 会跳过该节点,而不是包含它
  • 浏览器将其视为一个整体"岛屿",selectstart / selectionchange 事件的行为和普通文本节点不同

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions