Skip to content

Commit

Permalink
refactor(language-service): Remove unused function 'createElementCssS…
Browse files Browse the repository at this point in the history
…elector' (#33383)

It's no longer used and needed.

PR Close #33383
  • Loading branch information
kyliau authored and AndrewKushnir committed Oct 24, 2019
1 parent 93a0b1b commit 4c4217c
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions packages/language-service/src/completions.ts
Expand Up @@ -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';
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 4c4217c

Please sign in to comment.