feat(shadow_css): add encapsulation support for CSS @supports at-rule
Closes #7944
This commit is contained in:
parent
b2e0946696
commit
cb84cbf545
@ -332,7 +332,7 @@ export class ShadowCss {
|
|||||||
if (rule.selector[0] != '@' || rule.selector.startsWith('@page')) {
|
if (rule.selector[0] != '@' || rule.selector.startsWith('@page')) {
|
||||||
selector =
|
selector =
|
||||||
this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
|
this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
|
||||||
} else if (rule.selector.startsWith('@media')) {
|
} else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports')) {
|
||||||
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
||||||
}
|
}
|
||||||
return new CssRule(selector, content);
|
return new CssRule(selector, content);
|
||||||
|
@ -60,6 +60,12 @@ export function main() {
|
|||||||
expect(s(css, 'a')).toEqual(expected);
|
expect(s(css, 'a')).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should handle support rules', () => {
|
||||||
|
var css = '@supports (display: flex) {section {display: flex;}}';
|
||||||
|
var expected = '@supports (display:flex) {section[a] {display:flex;}}';
|
||||||
|
expect(s(css, 'a')).toEqual(expected);
|
||||||
|
});
|
||||||
|
|
||||||
// Check that the browser supports unprefixed CSS animation
|
// Check that the browser supports unprefixed CSS animation
|
||||||
it('should handle keyframes rules', () => {
|
it('should handle keyframes rules', () => {
|
||||||
var css = '@keyframes foo {0% {transform:translate(-50%) scaleX(0);}}';
|
var css = '@keyframes foo {0% {transform:translate(-50%) scaleX(0);}}';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user