fix(compiler): [attribute~=value] selector (#11696)

Change the seperator regular expression to ignore tildes which are followed by an equal sign.

Closes #9644
This commit is contained in:
esagawe 2016-09-19 00:58:19 +02:00 committed by Alex Eagle
parent 54b41f57be
commit 734b8b8c13
2 changed files with 2 additions and 1 deletions

View File

@ -426,7 +426,7 @@ export class ShadowCss {
return scopedP; return scopedP;
}; };
const sep = /( |>|\+|~)\s*/g; const sep = /( |>|\+|~(?!=))\s*/g;
const scopeAfter = selector.indexOf(_polyfillHostNoCombinator); const scopeAfter = selector.indexOf(_polyfillHostNoCombinator);
let scoped = ''; let scoped = '';

View File

@ -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|="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('one[attr] {}', 'a')).toEqual('one[attr][a] {}');
expect(s('[is="one"] {}', 'a')).toEqual('[is="one"][a] {}'); expect(s('[is="one"] {}', 'a')).toEqual('[is="one"][a] {}');
}); });