-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
details bind:open
should count as [open]
for styling
#3281
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
Comments
I had assumed there was some precedent for handling this with other bindings, but thinking about it more, I'm not sure what bindings those would be. We might just need a weird one-off check for this when determining whether an element can match a selector. |
diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts
index ef54f789..e70b2986 100644
--- a/src/compiler/compile/css/Selector.ts
+++ b/src/compiler/compile/css/Selector.ts
@@ -219,6 +219,8 @@ function attribute_matches(node: Node, name: string, expected_value: string, ope
const spread = node.attributes.find(attr => attr.type === 'Spread');
if (spread) return true;
+ if (name === 'open' && node.bindings.some((binding: Node) => binding.name === 'open')) return true;
+
const attr = node.attributes.find((attr: Node) => attr.name === name);
if (!attr) return false;
if (attr.is_true) return operator === null; This seems to do it. I don't know whether there is a more elegant way. It might make sense to always also search diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts
index ef54f789..0d4ea82b 100644
--- a/src/compiler/compile/css/Selector.ts
+++ b/src/compiler/compile/css/Selector.ts
@@ -219,6 +219,8 @@ function attribute_matches(node: Node, name: string, expected_value: string, ope
const spread = node.attributes.find(attr => attr.type === 'Spread');
if (spread) return true;
+ if (node.bindings.some((binding: Node) => binding.name === name)) return true;
+
const attr = node.attributes.find((attr: Node) => attr.name === name);
if (!attr) return false;
if (attr.is_true) return operator === null; |
use bindings when matching attribute selector against element
details[open]
is getting removed because the compiler doesn't think that<details bind:open>
indicates anopen
attribute that might be present.The text was updated successfully, but these errors were encountered: