Skip to content

Commit 80148be

Browse files
committed
revert(mat-icon): this reverts two files from commit 79e4d28
1 parent f0c7a25 commit 80148be

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

src/material/icon/icon-registry.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class MatIconRegistry implements OnDestroy {
175175
options?: IconOptions): this {
176176
const cleanLiteral = this._sanitizer.sanitize(SecurityContext.HTML, literal);
177177

178-
if (!cleanLiteral && (typeof ngDevMode === 'undefined' || ngDevMode)) {
178+
if (!cleanLiteral) {
179179
throw getMatIconFailedToSanitizeLiteralError(literal);
180180
}
181181

@@ -217,7 +217,7 @@ export class MatIconRegistry implements OnDestroy {
217217
options?: IconOptions): this {
218218
const cleanLiteral = this._sanitizer.sanitize(SecurityContext.HTML, literal);
219219

220-
if (!cleanLiteral && (typeof ngDevMode === 'undefined' || ngDevMode)) {
220+
if (!cleanLiteral) {
221221
throw getMatIconFailedToSanitizeLiteralError(literal);
222222
}
223223

@@ -381,11 +381,11 @@ export class MatIconRegistry implements OnDestroy {
381381
return forkJoin(iconSetFetchRequests).pipe(map(() => {
382382
const foundIcon = this._extractIconWithNameFromAnySet(name, iconSetConfigs);
383383

384-
if (!foundIcon && (typeof ngDevMode === 'undefined' || ngDevMode)) {
384+
if (!foundIcon) {
385385
throw getMatIconNameNotFoundError(name);
386386
}
387387

388-
return foundIcon!;
388+
return foundIcon;
389389
}));
390390
}
391391

@@ -491,7 +491,7 @@ export class MatIconRegistry implements OnDestroy {
491491
div.innerHTML = str;
492492
const svg = div.querySelector('svg') as SVGElement;
493493

494-
if (!svg && (typeof ngDevMode === 'undefined' || ngDevMode)) {
494+
if (!svg) {
495495
throw Error('<svg> tag not found');
496496
}
497497

@@ -552,31 +552,31 @@ export class MatIconRegistry implements OnDestroy {
552552
throw getMatIconNoHttpProviderError();
553553
}
554554

555-
if (safeUrl == null && (typeof ngDevMode === 'undefined' || ngDevMode)) {
555+
if (safeUrl == null) {
556556
throw Error(`Cannot fetch icon from URL "${safeUrl}".`);
557557
}
558558

559559
const url = this._sanitizer.sanitize(SecurityContext.RESOURCE_URL, safeUrl);
560560

561-
if (!url && (typeof ngDevMode === 'undefined' || ngDevMode)) {
562-
throw getMatIconFailedToSanitizeUrlError(safeUrl!);
561+
if (!url) {
562+
throw getMatIconFailedToSanitizeUrlError(safeUrl);
563563
}
564564

565565
// Store in-progress fetches to avoid sending a duplicate request for a URL when there is
566566
// already a request in progress for that URL. It's necessary to call share() on the
567567
// Observable returned by http.get() so that multiple subscribers don't cause multiple XHRs.
568-
const inProgressFetch = this._inProgressUrlFetches.get(url!);
568+
const inProgressFetch = this._inProgressUrlFetches.get(url);
569569

570570
if (inProgressFetch) {
571571
return inProgressFetch;
572572
}
573573

574-
const req = this._httpClient.get(url!, {responseType: 'text', withCredentials}).pipe(
575-
finalize(() => this._inProgressUrlFetches.delete(url!)),
574+
const req = this._httpClient.get(url, {responseType: 'text', withCredentials}).pipe(
575+
finalize(() => this._inProgressUrlFetches.delete(url)),
576576
share(),
577577
);
578578

579-
this._inProgressUrlFetches.set(url!, req);
579+
this._inProgressUrlFetches.set(url, req);
580580
return req;
581581
}
582582

src/material/icon/icon.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,7 @@ export class MatIcon extends _MatIconMixinBase implements OnChanges, OnInit, Aft
222222
switch (parts.length) {
223223
case 1: return ['', parts[0]]; // Use default namespace.
224224
case 2: return <[string, string]>parts;
225-
default:
226-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
227-
throw Error(`Invalid icon name: "${iconName}"`);
228-
}
229-
return ['', ''];
225+
default: throw Error(`Invalid icon name: "${iconName}"`);
230226
}
231227
}
232228

0 commit comments

Comments
 (0)