From 734b8b8c133b8ee8196bbf2e78d5611e14507e71 Mon Sep 17 00:00:00 2001 From: esagawe Date: Mon, 19 Sep 2016 00:58:19 +0200 Subject: [PATCH] fix(compiler): [attribute~=value] selector (#11696) Change the seperator regular expression to ignore tildes which are followed by an equal sign. Closes #9644 --- modules/@angular/compiler/src/shadow_css.ts | 2 +- modules/@angular/compiler/test/shadow_css_spec.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/@angular/compiler/src/shadow_css.ts b/modules/@angular/compiler/src/shadow_css.ts index 6d29a69711..03ab00b165 100644 --- a/modules/@angular/compiler/src/shadow_css.ts +++ b/modules/@angular/compiler/src/shadow_css.ts @@ -426,7 +426,7 @@ export class ShadowCss { return scopedP; }; - const sep = /( |>|\+|~)\s*/g; + const sep = /( |>|\+|~(?!=))\s*/g; const scopeAfter = selector.indexOf(_polyfillHostNoCombinator); let scoped = ''; diff --git a/modules/@angular/compiler/test/shadow_css_spec.ts b/modules/@angular/compiler/test/shadow_css_spec.ts index 51f3e45d17..4298e7a18b 100644 --- a/modules/@angular/compiler/test/shadow_css_spec.ts +++ b/modules/@angular/compiler/test/shadow_css_spec.ts @@ -91,6 +91,7 @@ export function main() { expect(s('one[attr$="value"] {}', 'a')).toEqual('one[attr$="value"][a] {}'); expect(s('one[attr*="value"] {}', 'a')).toEqual('one[attr*="value"][a] {}'); expect(s('one[attr|="value"] {}', 'a')).toEqual('one[attr|="value"][a] {}'); + expect(s('one[attr~="value"] {}', 'a')).toEqual('one[attr~="value"][a] {}'); expect(s('one[attr] {}', 'a')).toEqual('one[attr][a] {}'); expect(s('[is="one"] {}', 'a')).toEqual('[is="one"][a] {}'); });