Minor style update to gr-linked-text
Change-Id: I15c47e28d5f17f723fd16b9c47c7b250ecab9e30
diff --git a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text.ts b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text.ts
index 4a7fd6d..9adb8ae 100644
--- a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text.ts
+++ b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text.ts
@@ -19,6 +19,7 @@
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
import {LitElement, css, html, PropertyValues} from 'lit';
import {customElement, property} from 'lit/decorators';
+import {assertIsDefined} from '../../../utils/common-util';
declare global {
interface HTMLElementTagNameMap {
@@ -85,7 +86,7 @@
// into its DOM-tree as it controls the DOM-tree that it generates.
// Therefore, to get around this we create a single element that we slot into
// the Lit-owned DOM. This element will not be part of this LitElement as
- // it's slotted in and thus can be modified on the fly by _handleParseResult.
+ // it's slotted in and thus can be modified on the fly by handleParseResult.
override firstUpdated(_changedProperties: PropertyValues): void {
this.outputElement = document.createElement('span');
this.outputElement.id = 'output';
@@ -109,16 +110,18 @@
*/
_contentOrConfigChanged() {
if (!this.config) {
- this.outputElement!.textContent = this.content;
+ assertIsDefined(this.outputElement);
+ this.outputElement.textContent = this.content;
return;
}
const config = GerritNav.mapCommentlinks(this.config);
- this.outputElement!.textContent = '';
+ assertIsDefined(this.outputElement);
+ this.outputElement.textContent = '';
const parser = new GrLinkTextParser(
config,
(text: string | null, href: string | null, fragment?: DocumentFragment) =>
- this._handleParseResult(text, href, fragment),
+ this.handleParseResult(text, href, fragment),
this.removeZeroWidthSpace
);
parser.parse(this.content);
@@ -147,12 +150,13 @@
* - To attach an arbitrary fragment: when called with only the `fragment`
* argument, the fragment should be attached to the resulting DOM as is.
*/
- private _handleParseResult(
+ private handleParseResult(
text: string | null,
href: string | null,
fragment?: DocumentFragment
) {
- const output = this.outputElement!;
+ assertIsDefined(this.outputElement);
+ const output = this.outputElement;
if (href) {
const a = document.createElement('a');
a.setAttribute('href', href);