NSAC 1.0 was intended to be an easy upgrade path for SAC users, and it preserved most of SAC. That 1.0 API was not convenient for modern CSS, however, so NSAC 2 was written as a better replacement.
The SAC jar file is no longer necessary, as NSAC 2 contains all the required classes and interfaces.
Implementations of the selector interfaces are not required to provide a
toString() serialization, although the reference implementation
doc.style.css.parser package) does. It is not recommended
to use it for serialization, however, as it may not reflect namespace changes
made after the parsing took place (i.e. changing the namespace
prefix). The rule serialization in the Object Model implementation of css4j
does account for that, and it does not use the selector's
If you combine NSAC with your own Object Model code, you may want to follow the same approach and serialize the selectors yourself.
To let the parser be configurable, two methods were added to the
Flag is a flag from an enumeration:
STARHACKis set, the parser will handle asterisk-prefixed property names as accepted names. This hack (that targets old IE browsers) is ubiquitous in present-day websites, and in plain SAC parsers it was producing 'unexpected character' errors because the property names are not valid according to the specification. However, these declarations weren't real mistakes and the style authors wanted them to be there.
IEVALUESaccepts values with some IE hacks like IE expressions (progid included), and also values ending with
\0. The non-standard values produce
LexicalType.COMPAT_IDENTvalues as a result.
IEPRIOaccepts values with the
!iepriority hack, and again produces
IEPRIOCHARaccepts values with the
!important!priority hack, and instead produces
Some of the above Internet Explorer compatibility flags require the use of two pseudo-values that do not follow standard CSS syntax:
COMPAT_IDENTvalues are produced only when the
IEPRIOflags are used, and contain ident-like values.
COMPAT_PRIOvalues are produced by the
IEPRIOCHARflag, representing values that its compatible browser interprets as being of
Caution is advised when using these compatibility pseudo-values, as they may conflict with syntax-conformant values.
W3C Copyright Notice
ClassDescriptionA condition is applied to a list of selectors that is supplied as an argument to the selector name.Based on SAC's
AttributeConditioninterface by Philippe Le Hegaret.Attribute selector flags.Based on SAC's
CombinatorConditioninterface by Philippe Le Hegaret.Combinator selector.Based on SAC's
Conditioninterface by Philippe Le Hegaret.Conditional selector, by Philippe Le HegaretCSS budget exception.A CSS event handler for low-level parsing errors.CSS runtime exception, normally related to parsing.A CSS event handler for low-level parsing.Media-related parse exception.Namespace-related parse exception.CSS parse exception.Element selector, created by Philippe Le HegaretAn generalized input source.SAC's
LangConditioninterface by Philippe Le Hegaret.Based on SAC's
LexicalUnitinterface by Philippe Le Hegaret.The lexical type.Locate a place in a document.A page selector like
:first.List of page selectors.A low-level CSS parser.Interface giving access to namespace URI from the prefix.Allows convenient access to certain parser functionalities.Based on SAC's
PositionalConditioninterface by Philippe Le Hegaret.A
Conditionfor a pseudo-class or pseudo-element.Based on SAC's
Selectorinterface by Philippe Le Hegaret.List of selectors.Simple selector, by Philippe Le Hegaret