refactor(css-selector): export createSelector method (#4580)

needed for NativeScript Angular's animation driver
This commit is contained in:
Stanimira Vlaeva
2017-07-20 18:02:01 +03:00
committed by GitHub
parent a17cd1169c
commit 43b21ce7e7
3 changed files with 5 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ export interface Declaration {
value: string;
}
export class SelectorCore {
export interface SelectorCore {
/**
* Dynamic selectors depend on attributes and pseudo classes.
*/
@@ -74,3 +74,5 @@ export class SelectorsMatch<T extends Node> {
}
export function fromAstNodes(astRules: parser.Node[]): RuleSet[];
export function createSelector(sel: string): SelectorCore;

View File

@@ -408,7 +408,7 @@ function createDeclaration(decl: cssParser.Declaration): any {
return { property: decl.property.toLowerCase(), value: decl.value };
}
function createSelector(sel: string): SimpleSelector | SimpleSelectorSequence | Selector {
export function createSelector(sel: string): SimpleSelector | SimpleSelectorSequence | Selector {
try {
let ast = selectorParser.parse(sel);
if (ast.length === 0) {

View File

@@ -419,9 +419,8 @@ function isKeyframe(node: CssNode): node is KeyframesDefinition {
return node.type === "keyframes";
}
class InlineSelector extends SelectorCore {
class InlineSelector implements SelectorCore {
constructor(ruleSet: RuleSet) {
super();
this.ruleset = ruleSet;
}