케이스 ce-0045-insertHTML-breaks-structure-ko · 시나리오 scenario-insertHTML-behavior

insertHTML이 DOM 구조와 서식을 손상시킴

OS: Windows 11 기기: Desktop or Laptop Any 브라우저: Chrome 120.0 키보드: US 초안
insertHTMLdomformattingchrome

현상

document.execCommand('insertHTML', ...)를 사용하여 contenteditable 영역에 HTML 콘텐츠를 삽입할 때 DOM 구조가 손상되거나 예상치 못하게 재서식될 수 있습니다. 중첩된 요소가 평탄화되거나 재구성될 수 있습니다.

재현 예시

  1. contenteditable div를 만듭니다.
  2. 그 안에서 위치를 선택합니다.
  3. document.execCommand('insertHTML', false, '<p><strong>Bold text</strong></p>')를 사용합니다.
  4. 결과 DOM 구조를 검사합니다.

관찰된 동작

  • Windows의 Chrome에서 insertHTML이 DOM 구조를 손상시킬 수 있습니다.
  • 중첩된 요소가 평탄화되거나 재구성될 수 있습니다.
  • 서식이 손실되거나 예상치 못하게 변경될 수 있습니다.

예상 동작

  • insertHTML은 제공된 HTML 구조를 보존해야 합니다.
  • 중첩된 요소는 중첩 상태를 유지해야 합니다.
  • 서식이 유지되어야 합니다.

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: Windows 11
Device: Desktop or Laptop Any
Browser: Chrome 120.0
Keyboard: US
Your environment
Sample HTML:
Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.