Open cbchouinard opened 9 years ago
I totally agree. I'm a bit concerned that this won't be doable in a backwards compatible manner for any 2.0 code already written :scream:
It seems that the issue is just with selecting elements "within" virtuals, which was not possible/used before. So this should be backward compatible
What I meant is, if I wrote some code today that used the workaround like this:
"container" {
width: == ::window[width] / 3;
height: == ::window[height];
center: == ::window[center];
^ .square {
size: == 100;
left: == ^[x];
cy: == ^[cy];
}
}
What would happen after we make changes? I think ^
would be referencing the wrong scope.
Oh, i got it. I think I'd make it not affect ^ because that would also break hosting. I'd only make DOM queries use virtual's scope instead of virtual itself.
I added this feature on 2.1.x:
"col-6" {
@h |(.box.bar)|;
}
"col-3" {
@h |(.box.foo)|;
}
works now. Though it's less efficient than the other way around, since it creates 2 dom observers instead of 1 (because of two edges). It does not affect scoping otherwise than it post-processes scope element and converts virtual to the element it is attached too. I think it should mean that you can refer to other local virtuals within virtual rulesets.
It would be nice if we could not consider the virtual when using selectors. The following will scope the selector
.square
to the virtual which of course doesn't contain anything.We can get it to work right now by using the parent pseudo but it would be nice to do this automatically: