From 4c4217c5b75a06965046dbf2a5ae38a0a915215a Mon Sep 17 00:00:00 2001 From: Keen Yee Liau Date: Thu, 24 Oct 2019 12:06:58 -0700 Subject: [PATCH] refactor(language-service): Remove unused function 'createElementCssSelector' (#33383) It's no longer used and needed. PR Close #33383 --- packages/language-service/src/completions.ts | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/packages/language-service/src/completions.ts b/packages/language-service/src/completions.ts index 696b3e1b49..af31f9eaa7 100644 --- a/packages/language-service/src/completions.ts +++ b/packages/language-service/src/completions.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {AST, AstPath, Attribute, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, CssSelector, Element, ElementAst, ImplicitReceiver, NAMED_ENTITIES, Node as HtmlAst, NullTemplateVisitor, ParseSpan, PropertyRead, SelectorMatcher, TagContentType, Text, findNode, getHtmlTagDefinition, splitNsName} from '@angular/compiler'; +import {AST, AstPath, Attribute, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, Element, ElementAst, ImplicitReceiver, NAMED_ENTITIES, Node as HtmlAst, NullTemplateVisitor, ParseSpan, PropertyRead, TagContentType, Text, findNode, getHtmlTagDefinition} from '@angular/compiler'; import {getExpressionScope} from '@angular/compiler-cli/src/language_services'; import {AstResult} from './common'; @@ -421,24 +421,6 @@ function getSourceText(template: ng.TemplateSource, span: ng.Span): string { } const templateAttr = /^(\w+:)?(template$|^\*)/; -function createElementCssSelector(element: Element): CssSelector { - const cssSelector = new CssSelector(); - const elNameNoNs = splitNsName(element.name)[1]; - - cssSelector.setElement(elNameNoNs); - - for (const attr of element.attrs) { - if (!attr.name.match(templateAttr)) { - const [_, attrNameNoNs] = splitNsName(attr.name); - cssSelector.addAttribute(attrNameNoNs, attr.value); - if (attr.name.toLowerCase() === 'class') { - const classes = attr.value.split(/s+/g); - classes.forEach(className => cssSelector.addClassName(className)); - } - } - } - return cssSelector; -} function lowerName(name: string): string { return name && (name[0].toLowerCase() + name.substr(1));