Permalink
Browse files

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

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

Closes #9644
  • Loading branch information...
esagawe authored and alexeagle committed Sep 18, 2016
1 parent 54b41f5 commit 734b8b8c133b8ee8196bbf2e78d5611e14507e71
@@ -426,7 +426,7 @@ export class ShadowCss {
return scopedP;
};
- const sep = /( |>|\+|~)\s*/g;
+ const sep = /( |>|\+|~(?!=))\s*/g;
const scopeAfter = selector.indexOf(_polyfillHostNoCombinator);
let scoped = '';
@@ -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] {}');
});

0 comments on commit 734b8b8

Please sign in to comment.