Intent to Prototype: CSSPageDescriptor for @page at-rules

10 views
Skip to first unread message

Javier Fernandez

unread,
2:04 PM (1 hour ago) 2:04 PM
to blink-dev
Contact emails
jfern...@igalia.com

Specification
https://drafts.csswg.org/cssom/#the-csspagerule-interface

Summary
CSSPageRule.style now returns a CSSPageDescriptors object instead of a generic CSSStyleDeclaration. The new interface exposes the @page descriptors — size, page-orientation and the margin family — as named attributes in both camel-cased and dashedform, and accepts only declarations that are valid in the page context. This matches the CSSOM specification and the behaviour already shipped by Firefox and implemented by WebKit, and it makes @page support detectable via window.CSSPageDescriptors.

Blink component
css

Web Feature ID
Missing feature

Motivation

Chrome exposes an @page rule's declaration block as a plain CSSStyleDeclaration, which causes some problems: 

1. No feature detection. MDN's documented idiom is if (typeof window.CSSPageDescriptors === "undefined"). Chrome fails it, so authors cannot distinguish "unsupported" from "supported". 

2. Page-only descriptors leak onto every declaration. 'size' in element.style is true and getComputedStyle(el).size returns "", even though size can never apply to an element. Property enumeration and feature testing see phantom entries. 

3. CSS.supports('size','a4') returns true — Chrome claims a page-only descriptor is a supported element property. 

4. @page accepts inert declarations. pageRule.style.setProperty('float','left') is accepted and serialized into cssText with no signal that it can never take effect, diverging from the other engines.


Initial public proposal
No information provided

Search tags
cssom, @page, print, descriptors, CSSPageRule

Goals for experimentation
None

Requires code in //chrome?
False

Tracking bug
https://issues.chromium.org/issues/541924681

Estimated milestones

No milestones specified



Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5196252624060416?gate=6310173531570176

This intent message was generated by Chrome Platform Status.


Reply all
Reply to author
Forward
0 new messages