diff --git a/editor/libeditor/HTMLStyleEditor.cpp b/editor/libeditor/HTMLStyleEditor.cpp
index 32b89458f92b..b6b1aeaccf94 100644
--- a/editor/libeditor/HTMLStyleEditor.cpp
+++ b/editor/libeditor/HTMLStyleEditor.cpp
@@ -2347,8 +2347,7 @@ Result HTMLEditor::ClearStyleAt(
*unwrappedSplitNodeResult.GetPreviousContent(),
{EmptyCheckOption::TreatSingleBRElementAsVisible,
EmptyCheckOption::TreatListItemAsVisible,
- EmptyCheckOption::TreatTableCellAsVisible,
- EmptyCheckOption::TreatNonEditableContentAsInvisible})) {
+ EmptyCheckOption::TreatTableCellAsVisible})) {
AutoTrackDOMPoint trackPointToPutCaret(RangeUpdaterRef(), &pointToPutCaret);
// Delete previous node if it's empty.
// MOZ_KnownLive(unwrappedSplitNodeResult.GetPreviousContent()):
@@ -2430,8 +2429,7 @@ Result HTMLEditor::ClearStyleAt(
if (HTMLEditUtils::IsEmptyNode(
*unwrappedSplitResultAtStartOfNextNode.GetNextContent(),
{EmptyCheckOption::TreatListItemAsVisible,
- EmptyCheckOption::TreatTableCellAsVisible,
- EmptyCheckOption::TreatNonEditableContentAsInvisible},
+ EmptyCheckOption::TreatTableCellAsVisible},
&seenBR)) {
if (seenBR && !brElement) {
brElement = HTMLEditUtils::GetFirstBRElement(
@@ -2530,8 +2528,7 @@ Result HTMLEditor::ClearStyleAt(
*unwrappedSplitResultAtStartOfNextNode.GetNextContent(),
{EmptyCheckOption::TreatSingleBRElementAsVisible,
EmptyCheckOption::TreatListItemAsVisible,
- EmptyCheckOption::TreatTableCellAsVisible,
- EmptyCheckOption::TreatNonEditableContentAsInvisible})) {
+ EmptyCheckOption::TreatTableCellAsVisible})) {
// MOZ_KnownLive because the result is grabbed by
// unwrappedSplitResultAtStartOfNextNode.
nsresult rv = DeleteNodeWithTransaction(MOZ_KnownLive(
@@ -2550,16 +2547,14 @@ Result HTMLEditor::ClearStyleAt(
else if (HTMLEditUtils::IsEmptyNode(
*unwrappedSplitResultAtStartOfNextNode.GetNextContent(),
{EmptyCheckOption::TreatListItemAsVisible,
- EmptyCheckOption::TreatTableCellAsVisible,
- EmptyCheckOption::TreatNonEditableContentAsInvisible})) {
+ EmptyCheckOption::TreatTableCellAsVisible})) {
AutoTArray, 4> emptyInlineContainerElements;
HTMLEditUtils::CollectEmptyInlineContainerDescendants(
*unwrappedSplitResultAtStartOfNextNode.GetNextContentAs(),
emptyInlineContainerElements,
{EmptyCheckOption::TreatSingleBRElementAsVisible,
EmptyCheckOption::TreatListItemAsVisible,
- EmptyCheckOption::TreatTableCellAsVisible,
- EmptyCheckOption::TreatNonEditableContentAsInvisible},
+ EmptyCheckOption::TreatTableCellAsVisible},
BlockInlineCheck::UseComputedDisplayOutsideStyle);
for (const OwningNonNull& emptyInlineContainerElement :
emptyInlineContainerElements) {
diff --git a/testing/web-platform/tests/editing/data/inserthtml.js b/testing/web-platform/tests/editing/data/inserthtml.js
index 841f5493c90e..350f0a15569c 100644
--- a/testing/web-platform/tests/editing/data/inserthtml.js
+++ b/testing/web-platform/tests/editing/data/inserthtml.js
@@ -590,4 +590,17 @@ var browserTests = [
"",
[true],
{"inserthtml":[false,false,"",false,false,""]}],
+
+// Do not delete non-editable when clearing the original style
+["[X]abcdef
",
+ [["inserthtml","Z"]],
+ "Zabcdef
",
+ [true],
+ {}],
+["abc[Y]def
",
+ [["inserthtml","Z"]],
+ ["abcZdef
",
+ "abcZdef
"],
+ [true],
+ {}],
]