From 43b21ce7e79e5c46594484b21fff434db613d751 Mon Sep 17 00:00:00 2001 From: Stanimira Vlaeva Date: Thu, 20 Jul 2017 18:02:01 +0300 Subject: [PATCH] refactor(css-selector): export createSelector method (#4580) needed for NativeScript Angular's animation driver --- tns-core-modules/ui/styling/css-selector/css-selector.d.ts | 4 +++- tns-core-modules/ui/styling/css-selector/css-selector.ts | 2 +- tns-core-modules/ui/styling/style-scope.ts | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tns-core-modules/ui/styling/css-selector/css-selector.d.ts b/tns-core-modules/ui/styling/css-selector/css-selector.d.ts index 1ab340549..080e1c930 100644 --- a/tns-core-modules/ui/styling/css-selector/css-selector.d.ts +++ b/tns-core-modules/ui/styling/css-selector/css-selector.d.ts @@ -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 { } export function fromAstNodes(astRules: parser.Node[]): RuleSet[]; + +export function createSelector(sel: string): SelectorCore; diff --git a/tns-core-modules/ui/styling/css-selector/css-selector.ts b/tns-core-modules/ui/styling/css-selector/css-selector.ts index 7ce0f80a0..743f37c61 100644 --- a/tns-core-modules/ui/styling/css-selector/css-selector.ts +++ b/tns-core-modules/ui/styling/css-selector/css-selector.ts @@ -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) { diff --git a/tns-core-modules/ui/styling/style-scope.ts b/tns-core-modules/ui/styling/style-scope.ts index b90c062f9..e2743bd60 100644 --- a/tns-core-modules/ui/styling/style-scope.ts +++ b/tns-core-modules/ui/styling/style-scope.ts @@ -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; }