From e8af5aed39db4cccbb53aaf6db35fdb74f3b6acb Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Wed, 14 Mar 2018 19:14:49 -0400 Subject: [PATCH] refactor(icon): remove 6.0.0 deletion targets (#10389) Removes the `material/icon` deletion targets for 6.0.0. BREAKING CHANGES: * The `_document` parameter in the `MatIconRegistry` constructor is now required. --- src/lib/icon/icon-registry.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/lib/icon/icon-registry.ts b/src/lib/icon/icon-registry.ts index 0b0ac8a5b4c..1aeca0b5ba0 100644 --- a/src/lib/icon/icon-registry.ts +++ b/src/lib/icon/icon-registry.ts @@ -110,8 +110,7 @@ export class MatIconRegistry { constructor( @Optional() private _httpClient: HttpClient, private _sanitizer: DomSanitizer, - @Optional() @Inject(DOCUMENT) document?: any) { - // TODO(crisbeto): make _document required next major release. + @Optional() @Inject(DOCUMENT) document: any) { this._document = document; } @@ -427,17 +426,15 @@ export class MatIconRegistry { * Creates a DOM element from the given SVG string. */ private _svgElementFromString(str: string): SVGElement { - if (this._document || typeof document !== 'undefined') { - const div = (this._document || document).createElement('DIV'); - div.innerHTML = str; - const svg = div.querySelector('svg') as SVGElement; - if (!svg) { - throw Error(' tag not found'); - } - return svg; + const div = this._document.createElement('DIV'); + div.innerHTML = str; + const svg = div.querySelector('svg') as SVGElement; + + if (!svg) { + throw Error(' tag not found'); } - throw new Error('MatIconRegistry could not resolve document.'); + return svg; } /**