Skip to main content
matt_chotin
Inspiring
February 20, 2009
Question

Draft proposal: Namespaces and CSS

  • February 20, 2009
  • 5 replies
  • 2305 views
Hey all,

This is a draft proposal for how we'll update CSS support to handle
disambiguating classes via namespace. Feedback appreciated here for now so
when we get to the formal mini-spec we can rush it through.

---------

Keeping in mind that most folks have indicated they don't use Type selectors
much in CSS...

- Namespace qualification is now required for type selectors in CSS style
declarations.
- Gumbo will use the CSS3 suggested syntax for declaring namespaces and
prefixing type selectors. For the most common component namespace the
default namespace can be used (ignore the actual namespace url value):

@11909012 "http://ns.adobe.com/flex/spark";
Button { color: #990000; }


Otherwise, prefixes can be specified for each namespace:

@11909012 "http://ns.adobe.com/flex/spark";
@11909012 cx "com.mycompany.*";

Button { color: #990000; }
cx|MyFancyButton { color: #000099; }


- The namespace mappings that are currently used to map MXML tags to
ActionScript class names will also apply to CSS3 type selectors. These
mappings draw information from configured manifests in flex-config.xml,
swcs' catalog.xml files, and local package namespaces (e.g. how in MXML you
use xmlns:c="com.mycompany.*" to scope the package name for your custom
component). Note that namespace/prefix mappings defined in MXML do not
apply to the enclosing CSS.

- Type selectors that are either not qualified by a namespace or do not
resolve to an ActionScript class linked into the Application cause a warning
at compile time.

- The version compatibility flag forces the compiler to ignore type selector
prefixes. This allows Flex 3 applications to continue to use type selectors
without namespaces.

- The runtime will only match against fully qualified class names going
forward. When the compatibility version flag is set for Flex 3 or earlier,
it only matches against local names.

- When updating from Flex3, applications will either have to run in
compatibility mode, or qualify their CSS type selectors using namespaces. We
continue to discourage type selectors anywhere but the root application
file, and a warning will be given if type selectors are used outside of the
root application.
This topic has been closed for replies.

5 replies

Participant
October 13, 2010

You must declare namespaces in the document element when using XML with a cascading style sheet. Locally scoped namespaces will parse correctly.

Solicitors Regulation Authority

Participating Frequently
March 2, 2009
We could consider it a B-feature to support the namespaces in scope for the Style tag case inside an MXML document, however, this information would have to be exposed to the Batik-based CSS Parser - which at this point in time is isolated from MXML.
Inspiring
February 27, 2009
On Friday 20 Feb 2009, Matt Chotin wrote:

> - Namespace qualification is now required for type selectors in CSS style

> declarations.



Couldn't the default be taken from the containing document (if using Style

tag), so it wouldn't be required in every single (most ?) blocks ?



> - When updating from Flex3, applications will either have to run in

> compatibility mode, or qualify their CSS type selectors using namespaces.



This seems sensible, perfect.



--

Tom Chiverton

Helping to synergistically administrate market-growth



****************************************************



This email is sent for and on behalf of Halliwells LLP.



Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word partner to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority.



CONFIDENTIALITY



This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500.



For more information about Halliwells LLP visit www.halliwells.com.




Participating Frequently
February 23, 2009
Hey Sean,

The default @namespace should be possible at the style sheet level. I'm hoping that documentation will establish a convention, but the namespace is merely used at compile time to resolve a fully qualified ActionScript class name so your scenarios should work.

Any type selector will need to consider a namespace, but universal selectors (*, .foo, #myButton) are independent of namespace and thus won't need scoping.

I haven't heard from Flex Builder on auto-completion for @namespace styles yet, but they are aware of this proposal.

Pete
Participating Frequently
February 22, 2009
Is modifying the default namespace per file allowed or will it always be
the spark namespace?

Scenario 1.
Styles1.css
@namespace "http://ns.adobe.com/flex/spark";
Button { color: #990000; }
Styles2.css
@namespace "com.effectiveui.controls.*";
SearchButton { color: #990000; }

Scenario 2.
File com/effectiveui/controls/SearchButton.mxml


Are these valid?

Are class selectors scoped to the default/custom namespace and then just
ignored by the style manager implementation, or are they always compiled
into the global space?
Do you expect Flex Builder 4 will provide autocompletion and namespace
insertion when defining type selectors in css files?

Sean Christmann


Matt Chotin wrote:
> A new discussion was started by Matt Chotin in
>
> Developers --
> Draft proposal: Namespaces and CSS
>
> Hey all,
>
> This is a draft proposal for how we'll update CSS support to handle
> disambiguating classes via namespace. Feedback appreciated here for now so
> when we get to the formal mini-spec we can rush it through.
>
> ---------
>
> Keeping in mind that most folks have indicated they don't use Type selectors
> much in CSS...
>
> - Namespace qualification is now required for type selectors in CSS style
> declarations.
> - Gumbo will use the CSS3 suggested syntax for declaring namespaces and
> prefixing type selectors. For the most common component namespace the
> default namespace can be used (ignore the actual namespace url value):
>
> > @namespace "http://ns.adobe.com/flex/spark";
> Button { color: #990000; }
>
>
> Otherwise, prefixes can be specified for each namespace:
>
> > @namespace "http://ns.adobe.com/flex/spark";
> @namespace cx "com.mycompany.*";
>
> Button { color: #990000; }
> cx|MyFancyButton { color: #000099; }
>
>
> - The namespace mappings that are currently used to map MXML tags to
> ActionScript class names will also apply to CSS3 type selectors. These
> mappings draw information from configured manifests in flex-config.xml,
> swcs' catalog.xml files, and local package namespaces (e.g. how in MXML you
> use xmlns:c="com.mycompany.*" to scope the package name for your custom
> component). Note that namespace/prefix mappings defined in MXML do not
> apply to the enclosing CSS.
>
> - Type selectors that are either not qualified by a namespace or do not
> resolve to an ActionScript class linked into the Application cause a warning
> at compile time.
>
> - The version compatibility flag forces the compiler to ignore type selector
> prefixes. This allows Flex 3 applications to continue to use type selectors
> without namespaces.
>
> - The runtime will only match against fully qualified class names going
> forward. When the compatibility version flag is set for Flex 3 or earlier,
> it only matches against local names.
>
> - When updating from Flex3, applications will either have to run in
> compatibility mode, or qualify their CSS type selectors using namespaces. We
> continue to discourage type selectors anywhere but the root application
> file, and a warning will be given if type selectors are used outside of the
> root application.
>
>
>
> ------------------------------------------------------
> View/reply at
> Replies by email are OK.
> Use the unsubscribe form at
to cancel your email subscription.
> .
>
>