w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.5k stars 660 forks source link

[css-fonts-3][css-fonts-4] Is `CSSFontFaceRule.style` missing `[SameObject,PutForwards=cssText]`? #10842

Closed cdoublev closed 1 month ago

cdoublev commented 1 month ago

All CSS*Rule.style attributes except CSSFontFace.style are defined with [SameObject,PutForwards=cssText]:

Is it intentional?

The practical implication, in current Chrome/FF version:

const sheet = new CSSStyleSheet()

sheet.replaceSync('style {} @font-face {}')

const style = sheet.cssRules[0]
const font = sheet.cssRules[1]

style.style = 'color: green'
style.cssText; // style { color: green }
font.style = 'font-style: italic'
font.cssText; // @font-face {}
svgeesus commented 1 month ago

I don't know but I spot @emilio as the editor of those other specs so look forward to an explanation

emilio commented 1 month ago

Yeah, I don't think it's intentional, we should probably be consistent. That said, in Gecko at least font-face descriptors aren't mutable, see https://bugzilla.mozilla.org/show_bug.cgi?id=443978...

svgeesus commented 1 month ago

@cdoublev please feel free to send a PR to make this interface consistent with the others.