Bug 1860929 [wpt PR 42735] - [EditContext] Disable execCommand and related APIs,...
commita0487c56cea3b7c748b142c4df374804224ef031
authorBlink WPT Bot <blink-w3c-test-autoroller@chromium.org>
Wed, 8 Nov 2023 08:29:02 +0000 (8 08:29 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Sun, 19 Nov 2023 15:18:57 +0000 (19 15:18 +0000)
treed316ca5dc5e549000335920fbc2405aae826a208
parente2dde5871f40ca068d6a6783e793391728fe31a1
Bug 1860929 [wpt PR 42735] - [EditContext] Disable execCommand and related APIs, a=testonly

Automatic update from web-platform-tests
[EditContext] Disable execCommand and related APIs (#42735)

document.execCommand and related commands (queryCommandValue,
queryCommandState, queryCommandEnabled, queryCommandIndeterm) do not
work in a way that makes sense with EditContext. They do not fire
beforeinput, which EditContext depends on, and they modify the DOM
directly rather than going through EditContext, which will cause the
editor view implemented in the DOM to become out of sync with the
editor model whose state is in the EditContext.

Furthermore execCommand is deprecated and non-interoperable in many
cases.

Given these factors, in this CL make execCommand a no-op when
an EditContext-based Editing Host has focus, and make all the
related query commands return false/null values. This change is
limited to command types that are conditionally enabled based on
whether an Editing Host has focus. Command types that are
unconditionally enabled (such as "copy") are not affected.

See also https://github.com/w3c/edit-context/issues/71

Bug: 999184
Change-Id: I91cc5c3d043715c0753e800f2fae2cd8fe7870d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4975435
Reviewed-by: Koji Ishii <kojii@chromium.org>
Reviewed-by: Anupam Snigdha <snianu@microsoft.com>
Commit-Queue: Dan Clark <daniec@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1216453}

Co-authored-by: Dan Clark <daniec@microsoft.com>
--

wpt-commits: 446246f09d12fdd32d183c6562bee178b2c6b7f0
wpt-pr: 42735
testing/web-platform/tests/editing/edit-context/edit-context-execCommand.tentative.https.html [new file with mode: 0644]