Skip to content

Commit ca58556

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
Adds 'role' as an allowed attribute in the no-imperative-dom-api eslint rule.
Bug: 407751147 Change-Id: I3c28a34dfc4c354a5cf1756797f24c8158ea1270 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6440212 Auto-Submit: Danil Somsikov <dsv@chromium.org> Reviewed-by: Philip Pfaffe <pfaffe@chromium.org> Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
1 parent f645790 commit ca58556

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

scripts/eslint_rules/lib/no-imperative-dom-api/dom-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export const domApi = {
2727
return true;
2828
}
2929
if (isIdentifier(property, [
30-
'alt', 'draggable', 'height', 'hidden', 'href', 'id', 'name', 'placeholder', 'rel', 'scope', 'slot',
31-
'spellcheck', 'src', 'tabindex', 'title', 'type', 'value', 'width'
30+
'alt', 'draggable', 'height', 'hidden', 'href', 'id', 'name', 'placeholder', 'rel', 'role', 'scope',
31+
'slot', 'spellcheck', 'src', 'tabindex', 'title', 'type', 'value', 'width'
3232
])) {
3333
domFragment.attributes.push({key: property.name.toLowerCase(), value: propertyValue});
3434
return true;

scripts/eslint_rules/tests/no-imperative-dom-api.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ class SomeWidget extends UI.Widget.Widget {
473473
anchor.href = 'https://www.google.com';
474474
anchor.innerText = 'some-text';
475475
anchor.dataset.someKey = 'some-value';
476+
anchor.role = 'some-role';
476477
this.contentElement.insertBefore(anchor, input);
477478
478479
const img = document.createElement('img');
@@ -495,7 +496,7 @@ class SomeWidget extends UI.Widget.Widget {
495496
export const DEFAULT_VIEW = (input, _output, target) => {
496497
render(html\`
497498
<div>
498-
<a href="https://www.google.com" data-some-key="some-value">some-text</a>
499+
<a href="https://www.google.com" data-some-key="some-value" role="some-role">some-text</a>
499500
<img src="https://www.google.com/some-image.png" alt="some-alt" draggable="true" height="100"
500501
hidden="hidden" href="https://www.google.com" id="some-id" name="some-name" rel="some-rel"
501502
scope="some-scope"></img>

0 commit comments

Comments
 (0)