commit 939e1332fdabf5a6c5b413d06af1936d77eaa112
parent facced454fa740c56bda0c8666e6984009bae4f2
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Mon, 22 Dec 2025 14:53:27 +0000
Bug 1962920 - [devtools] Stop reporting 'clear' as inactive on <br> elements. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D277241
Diffstat:
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/devtools/server/actors/utils/inactive-property-helper.js b/devtools/server/actors/utils/inactive-property-helper.js
@@ -400,7 +400,11 @@ class InactivePropertyHelper {
// clear property used on non-floating elements.
{
invalidProperties: ["clear"],
- when: () => !this.isBlockLevel(),
+ when: () =>
+ !this.isBlockLevel() &&
+ // The br element is a special case and allows clear for backwards compatibility to make its clear attribute work.
+ // https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3
+ this.localName != "br",
fixId: "inactive-css-not-block-fix",
msgId: "inactive-css-not-block",
},
diff --git a/devtools/server/tests/chrome/inactive-property-helper/float.mjs b/devtools/server/tests/chrome/inactive-property-helper/float.mjs
@@ -92,6 +92,13 @@ export default [
isActive: true,
},
{
+ info: "clear is valid on br elements",
+ property: "clear",
+ tagName: "br",
+ rules: ["br { clear: left; }"],
+ isActive: true,
+ },
+ {
info: "clear is invalid on non-block-level elements",
property: "clear",
tagName: "span",