Skip to content

Commit 4c4217c

Browse files
Keen Yee LiauAndrewKushnir
Keen Yee Liau
authored andcommitted
refactor(language-service): Remove unused function 'createElementCssSelector' (angular#33383)
It's no longer used and needed. PR Close angular#33383
1 parent 93a0b1b commit 4c4217c

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

packages/language-service/src/completions.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
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';
9+
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';
1010
import {getExpressionScope} from '@angular/compiler-cli/src/language_services';
1111

1212
import {AstResult} from './common';
@@ -421,24 +421,6 @@ function getSourceText(template: ng.TemplateSource, span: ng.Span): string {
421421
}
422422

423423
const templateAttr = /^(\w+:)?(template$|^\*)/;
424-
function createElementCssSelector(element: Element): CssSelector {
425-
const cssSelector = new CssSelector();
426-
const elNameNoNs = splitNsName(element.name)[1];
427-
428-
cssSelector.setElement(elNameNoNs);
429-
430-
for (const attr of element.attrs) {
431-
if (!attr.name.match(templateAttr)) {
432-
const [_, attrNameNoNs] = splitNsName(attr.name);
433-
cssSelector.addAttribute(attrNameNoNs, attr.value);
434-
if (attr.name.toLowerCase() === 'class') {
435-
const classes = attr.value.split(/s+/g);
436-
classes.forEach(className => cssSelector.addClassName(className));
437-
}
438-
}
439-
}
440-
return cssSelector;
441-
}
442424

443425
function lowerName(name: string): string {
444426
return name && (name[0].toLowerCase() + name.substr(1));

0 commit comments

Comments
 (0)