Re: [css-break] page break aliases vs getComputedStyle

On Tue, Jan 14, 2014 at 8:01 PM, Peter Moulder
<pjrm@mail.internode.on.net> wrote:
> I'm not at all familiar with scripting things, so forgive me if the answer
> should actually be obvious to most people, or if I cite an out-of-date spec.
>
> Section 3.4 ‘Page Break Aliases: ...’ says that UAs should "[treat]
> page-break-* as shorthands", while
> http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyCSSValue
> says that getPropertyCSSValue should return null for shorthands.
>
> Do I correctly infer that UAs that conform to css-break must return null
> for getComputedStyle(...).getPropertyCSSValue("pageBreakBefore")
> (even when there is an explicit page-break-before declaration), while
> other (CSS21-like) UAs must return non-null ?
>
> If so, I suggest drawing attention to this (given that this paragraph says that
> the intent is to preserve compatibility with CSS Level 2).
>
> Otherwise, I suggest stating what the rules for what it should return in this
> case (e.g. with a declaration like "break-before: page" or "break-before:
> column" or "page-break-before: always").
>
> (Again, sorry if the above comment arises only because of my unfamiliarity with
> this area.)

Nope, you're correct - per DOM L2 Style, the properties need to
incompatibly change to return null.  This is one of the reasons why
the DOM L2 Style api is absolutely terrible - it gave zero thought to
backwards compatibility.

Luckily, we don't really have to worry about this.  The DOM L2 Style
apis are rarely used.  getPropertyCSSValue() is longer, and thus less
convenient, than getPropertyValue(), which works correctly for
shorthands.  Also, this is a page-break property, and paged media and
scripting don't collide very much.

We could add a note about this, but honestly I'd rather we not draw
further attention to that spec and its terrible apis.

~TJ

Received on Wednesday, 16 September 2015 22:20:04 UTC