- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 27 Feb 2012 16:16:04 -0800
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: www-style@w3.org
On Fri, Feb 24, 2012 at 1:32 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote: > On 2/24/12 4:04 PM, Tab Atkins Jr. wrote: >> Hm, why do you say that? Inheritance is well-defined even if it's not >> in the document > > But rule application is not. > > Specifically, if you have a disconnected document fragment, which rules > should be applying to the elements in it? Should inline styles be applying? > None of that stuff is really defined anywhere. > > getComputedStyle sort of makes up something, but it involves applying > applying rules across documents and whatnot. It's also not really all that > workable in the face of dynamic changes. > > >> Rendering an SVG paint server shouldn't require any information gained >> from being in a displayed document, either. > > > SVG assumes that styles can be computed in a sane way for all elements. > > Other specs don't define such sane ways of computing styles, yet. > > Maybe they should.... There are a lot of details to work out, though > (scoped stylesheets in disconnected fragments; how should those work?). For now, I've deleted the previous totally unnecessary paragraph about cutting off inheritance, and added the following to the Paint Sources section: """ Because paint sources have an intrinsic appearance, it's not necessary for the element providing them to be in a document - for example, one can simply create an element with JavaScript and directly assign it to the CSSElementMap in HTML. However, some paint sources (such as an SVG <pattern>) depend on style information for their appearance, and it's currently largely undefined how styling information is assigned to an element fragment that's not part of a document. (For example, does the fragment receive styles from the active document? What if it has its own <style> or <link rel=stylesheet> in it?) This specification explicitly does not define how such a fragment is styled; it is expected that CSS will define it in sufficient detail in the future. For now, it is recommended that such fragments be inserted into a document before being referenced. For example, a <pattern> element may be placed into a ‘display:none’ <svg> element's <defs> element within a document; this has no rendering or layout effects on the document, but the style inheritance is well-defined. """ I'm not totally happy about leaving this undefined, but this spec *really* isn't the place to define it, and I'm not happy with simply disallowing this case in the spec, since there are definitely cases where there isn't any ambiguity. For example, a disconnected <pattern> that used nothing but attributes for styling would work just fine. Is this acceptable? ~TJ
Received on Tuesday, 28 February 2012 00:16:51 UTC