Skip to content

Commit

Permalink
Bug 1881486 - [devtools] Don't linkify empty attributes. r=devtools-r…
Browse files Browse the repository at this point in the history
…eviewers,ochameau.

Differential Revision: https://phabricator.services.mozilla.com/D202452
  • Loading branch information
nchevobbe committed Feb 27, 2024
1 parent 528d050 commit a948bc7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ const TEST_DATA = [
attributeName: "aria-describedby",
links: [{ id: "describedby01", valid: false }, { id: "describedbyshadow" }],
},
{
selector: "#empty-attributes",
attributeName: "aria-activedescendant",
links: [],
},
{
selector: "#empty-attributes",
attributeName: "aria-details",
links: [],
},
];

add_task(async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,7 @@
<div id="owns02">#owns02</div>

<test-component></test-component>

<div id="empty-attributes" aria-activedescendant=" " aria-details=" "></div>
</body>
</html>
2 changes: 1 addition & 1 deletion devtools/client/inspector/markup/views/element-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ ElementEditor.prototype = {

// Create links in the attribute value, and truncate long attribute values if needed.
for (const token of parsedLinksData) {
if (token.type === "string") {
if (token.type === "string" || token.value?.trim() === "") {
attributeValueEl.appendChild(
this.doc.createTextNode(this._truncateAttributeValue(token.value))
);
Expand Down

0 comments on commit a948bc7

Please sign in to comment.