Draft proposal: Namespaces and CSS
matt_chotin Feb 20, 2009 3:46 PMHey 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.
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.



