Skip to content

Commit 108e9d4

Browse files
authored
Merge pull request #117 from dev-five-git/selector-issue
Selector issue
2 parents 1c88dc8 + 322e49b commit 108e9d4

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

.changeset/tiny-wasps-matter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/wasm": patch
3+
---
4+
5+
Fix attribute selector issue

libs/css/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static DOUBLE_SEPARATOR: Lazy<HashSet<&str>> = Lazy::new(|| {
174174
});
175175

176176
pub fn get_selector_separator(key: &str) -> SelectorSeparator {
177-
if key.starts_with(":") || key.is_empty() {
177+
if key.starts_with(":") || key.is_empty() || key.starts_with("[") {
178178
SelectorSeparator::None
179179
} else if DOUBLE_SEPARATOR.contains(key) {
180180
SelectorSeparator::Double

libs/sheet/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,17 @@ mod tests {
437437
false,
438438
);
439439
assert_debug_snapshot!(sheet.create_css());
440+
441+
let mut sheet = StyleSheet::default();
442+
sheet.add_property(
443+
"test",
444+
"bg",
445+
0,
446+
"red",
447+
Some(&"&[disabled='true']".into()),
448+
false,
449+
);
450+
assert_debug_snapshot!(sheet.create_css());
440451
}
441452

442453
#[test]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
source: libs/sheet/src/lib.rs
3+
expression: sheet.create_css()
4+
---
5+
".test[disabled='true']{background:red}"

0 commit comments

Comments
 (0)