| Code-Review | +1 |
key: 'jslog',Nit: I mimicked that we do for other components and adding the `jslogContext` directly as the `jslogContextString` should work correctly.
tabindex="0">Google</devtools-link>Can we check if the tabindex is 0 and not set it at all. That is handled by the component.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Nit: I mimicked that we do for other components and adding the `jslogContext` directly as the `jslogContextString` should work correctly.
Done
Can we check if the tabindex is 0 and not set it at all. That is handled by the component.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
5 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: scripts/eslint_rules/lib/no-imperative-dom-api/x-link.ts
Insertions: 7, Deletions: 6.
@@ -33,13 +33,14 @@
domFragment.classList.push(className);
}
const jslogContext = node.arguments[4];
- const jslogContextString = jslogContext ? sourceCode.getText(jslogContext) : '';
- domFragment.attributes.push({
- key: 'jslog',
- value: `\${VisualLogging.link(${jslogContextString}).track({click: true, keydown: 'Enter|Space'})}`
- });
+ if (jslogContext && !isIdentifier(jslogContext, 'undefined')) {
+ domFragment.bindings.push({
+ key: 'jslogContext',
+ value: jslogContext,
+ });
+ }
const tabIndex = node.arguments[5];
- if (tabIndex) {
+ if (tabIndex && (tabIndex.type !== 'Literal' || tabIndex.value !== 0)) {
domFragment.attributes.push({
key: 'tabindex',
value: tabIndex,
```
```
The name of the file: scripts/eslint_rules/tests/no-imperative-dom-api.test.ts
Insertions: 3, Deletions: 6.
@@ -1408,7 +1408,7 @@
this.contentElement.appendChild(
UI.XLink.XLink.create('https://google.com', 'Google', 'some-class', undefined, 'some-context', 0));
this.contentElement.appendChild(
- UI.XLink.XLink.create('https://chromium.org', 'Chromium'));
+ UI.XLink.XLink.create('https://chromium.org', 'Chromium', undefined, undefined, undefined, 1));
}
}`,
output: `
@@ -1416,11 +1416,8 @@
export const DEFAULT_VIEW = (input, _output, target) => {
render(html\`
<div>
- <devtools-link class="some-class" href="https://google.com"
- jslog=\${VisualLogging.link('some-context').track({click: true, keydown: 'Enter|Space'})}
- tabindex="0">Google</devtools-link>
- <devtools-link href="https://chromium.org"
- jslog=\${VisualLogging.link().track({click: true, keydown: 'Enter|Space'})}>Chromium</devtools-link>
+ <devtools-link class="some-class" href="https://google.com" .jslogContext=\${'some-context'}>Google</devtools-link>
+ <devtools-link href="https://chromium.org" tabindex="1">Chromium</devtools-link>
</div>\`,
target, {host: input});
};
```
Support XLink in the imperative API lint rule
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |