From 0894eda8d8f4ee1304365720dd0c9f4e4905e00e Mon Sep 17 00:00:00 2001 From: crisbeto Date: Mon, 12 Mar 2018 23:05:31 -0400 Subject: [PATCH] refactor(icon): remove 6.0.0 deletion targets 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 0b0ac8a5b4c7..1aeca0b5ba0c 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; } /**