- From: Simon Pieters <simonp@opera.com>
- Date: Fri, 28 Jun 2013 00:14:11 +0200
- To: "www-style list" <www-style@w3.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
On Thu, 27 Jun 2013 23:54:18 +0200, Tab Atkins Jr. <jackalmage@gmail.com> wrote: > When representing an at-rule that contains a set of specialized > properties, what's the right idiom for the IDL? > > CSSPageRule currently exposes a .style attribute which holds all the > properties. CSSFontFaceRule just exposes the properties directly as > attributes on the at-rule object (as does CSSCounterStyleRule, but > that's because I just copied @font-face). > > I think that using .style makes sense when the set of properties is > large and ever-growing, like it is for normal CSS properties. The > CSSStyleDeclaration interface makes it at least somewhat more > convenient to determine what properties are actually set, at least > over the alternative of querying every possible attribute to see if > it's null or not. > > On the other hand, when the set of properties is small and > rarely-growing, like in @page or @font-face, I think it makes the most > sense to just expose them directly. You'll much more rarely want to > interact with the properties "generically", and even if you do, it's > not hard to quickly iterate through them all. The extra indirection > of a .style object seems unnecessary, as does exposing all the > additional machinery for iterating/adding/removing rules by index. Even though exposing the attributes directly seems simpler on the face of it, it means that it's inconsistent with what developers are used to. As you said in IRC, if we use .style instead we would introduce a new interface that has the relevant machinery from CSSStyleDeclaration, and let CSSStyleDeclaration inherit from that, and introduce CSSFontFaceDescriptors and CSSPageDescriptors that expose the relevant IDL attributes. > So, I think it's best to settle on the CSSFontFaceRule idiom, and > change CSSPageRule accordingly. (@page's OM is already broken; Simon > has a bug on it > <https://www.w3.org/Bugs/Public/show_bug.cgi?id=22500>.) > > ~TJ -- Simon Pieters Opera Software
Received on Thursday, 27 June 2013 22:13:06 UTC