mozilla / standards-positions

https://mozilla.github.io/standards-positions/
Mozilla Public License 2.0
635 stars 69 forks source link

CSS Nesting: The Nested Declarations Rule #1048

Closed andruud closed 1 week ago

andruud commented 2 months ago

Request for Mozilla Position on an Emerging Web Specification

Other information

See also:

emilio commented 2 months ago

I think the insertRule special-case is wrong, as per discussion... Parse declarations ~never fails (spec wise), it just returns an empty declaration list, so something like insertRule("yadayada") would not throw, just create an empty CSSNestedDeclarations object...

Easiest fix would be to check if the declaration list is not empty or so, though it seems that'd cause some other weird behavior like unknown-property: foo throwing, but unknown-property: foo; color: red working (and having a single declaration). I guess it's not too bad tho...

With that tweak or something along those lines resolved on by the CSSWG, this looks acceptable to me (kinda reluctantly).

I still think it's a really weird set-up, but given the discussions and that this is still better than the status quo, I guess positive is fine? Thanks for pushing this forward :)

andruud commented 2 months ago

I think the insertRule special-case is wrong

Yes, thanks, that was a mistake from my side.

(For the benefit of other people reading):

Easiest fix would be to check if the declaration list is not empty or so

Done: https://github.com/w3c/csswg-drafts/pull/10519

Filed https://github.com/w3c/csswg-drafts/issues/10520 to get a stamp for the above change, or to see if we should do something else instead.

emilio commented 1 month ago

Given all the above is resolved this looks good to me (still reluctantly since I think @nest / @group was a simpler solution but...) :)

zcorpan commented 1 month ago

@emilio positive?

emilio commented 1 week ago

Yes