From d565a126ae35d9a7032ff4978d8c9653052e4239 Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Wed, 6 Aug 2014 11:29:01 -0400 Subject: [PATCH] Allow :not() selector for the content select attribute Fixes #485 --- src/ShadowRenderer.js | 3 ++- test/js/test.js | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/ShadowRenderer.js b/src/ShadowRenderer.js index 42732b6..81b8764 100644 --- a/src/ShadowRenderer.js +++ b/src/ShadowRenderer.js @@ -538,7 +538,8 @@ // ClassSelector // IDSelector // AttributeSelector - var selectorStartCharRe = /^[*.#[a-zA-Z_|]/; + // negation + var selectorStartCharRe = /^(:not\()?[*.#[a-zA-Z_|]/; function matches(node, contentElement) { var select = contentElement.getAttribute('select'); diff --git a/test/js/test.js b/test/js/test.js index 31f2608..18244b8 100644 --- a/test/js/test.js +++ b/test/js/test.js @@ -193,6 +193,29 @@ suite('Shadow DOM', function() { ''); }); + suite('Not selector', function() { + testRender('Type', + '', + '', + ''); + testRender('ID', + '', + '', + ''); + testRender('Class', + '', + '', + ''); + testRender('Attribute', + '', + '', + ''); + testRender('Attribute Value', + '', + '', + ''); + }); + }); suite('Nested shadow hosts', function() {