- From: Khushal Sagar via GitHub <sysbot+gh@w3.org>
- Date: Tue, 25 Jun 2024 21:31:45 +0000
- To: public-css-archive@w3.org
@flackr pointed out that `@property` declarations behave as per spec, i.e., declarations in the outer scope are visible in inner scope. Here is an example: https://jsbin.com/xoqebek/edit?html,output (credits to @flackr).
```
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="host">
<template shadowrootmode="open">
<div class=outer>I'm in the shadow DOM using outer names</div>
<div class=inner>I'm in the shadow DOM using inner names</div>
<style>
@property --inner-property {
syntax: "<color>";
inherits: false;
initial-value: green;
}
@keyframes inner-anim {
from { opacity: 1;}
to { opacity: 0;}
}
.outer {
animation: outer-anim 1s infinite;
color: var(--outer-property);
}
.inner {
animation: inner-anim 1s infinite;
color: var(--inner-property);
}
</style>
</template>
</div>
<style>
@keyframes outer-anim {
from { opacity: 1;}
to { opacity: 0;}
}
@property --outer-property {
syntax: "<color>";
inherits: false;
initial-value: green;
}
#outer {
animation: outer-anim 1s infinite;
color: var(--outer-property);
}
#outer-inner {
animation: inner-anim 1s infinite;
--inner-property: jfaowiej; /* not a valid color so will be discarded if property registration is used. */
color: var(--inner-property);
}
</style>
<div id="outer">I'm in outer DOM using outer names</div>
<div id="outer-inner">I'm in outer DOM using inner names</div>
</body>
```
--
GitHub Notification of comment by khushalsagar
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10304#issuecomment-2190004779 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 25 June 2024 21:31:46 UTC