Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-introduction of improved CSS selectors specificity fix #3344

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/lib/style-properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@
var parts = cssText.split(';');
for (var i=0, p; i<parts.length; i++) {
p = parts[i];
if (p.match(this.rx.MIXIN_MATCH) || p.match(this.rx.VAR_MATCH)) {
customCssText += p + ';\n';
}
customCssText += p + ';\n';
}
return customCssText;
},
Expand Down Expand Up @@ -277,7 +275,7 @@
var parts = selector.split(',');
for (var i=0, l=parts.length, p; (i<l) && (p=parts[i]); i++) {
parts[i] = p.match(hostRx) ?
p.replace(hostSelector, hostSelector + scope) :
p.replace(hostSelector, scope) :
scope + ' ' + p;
}
rule.selector = parts.join(',');
Expand Down
4 changes: 2 additions & 2 deletions test/unit/styling-cross-scope-var.html
Original file line number Diff line number Diff line change
Expand Up @@ -700,11 +700,11 @@
assertComputed(styled.$.endTerm, '19px');
});

// skip for now, until #3326 is fixed
test.skip('custom style class overrides css variable', function() {
test('custom style class overrides css variable', function() {
var d = document.createElement('x-variable-override');
d.classList.add('variable-override');
document.body.appendChild(d);
Polymer.dom.flush();
assertComputed(d, '10px');
});

Expand Down
8 changes: 8 additions & 0 deletions test/unit/styling-scoped.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@
test('specificity of ::content > :not(template) selector', function() {
assertComputed(document.querySelector('[is=x-specificity-nested]'), '10px');
});

test('overwriting mixin properties', function() {
var root = document.querySelector('x-overriding');
assertComputed(root.querySelector('.red'), '1px');
assertComputed(root.querySelector('.green'), '2px');
assertComputed(root.querySelector('.red-2'), '1px');
assertComputed(root.querySelector('.blue'), '3px');
});
});

test('svg classes are dynamically scoped correctly', function() {
Expand Down