Package io.sf.carte.doc.style.css.nsac
NSAC 2
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.
Selector Serialization
Implementations of the selector interfaces are not required to provide a
toString() serialization, although the reference implementation
(the 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
toString().
If you combine NSAC with your own Object Model code, you may want to follow the same approach and serialize the selectors yourself.
Parser Flags
To let the parser be configurable, two methods were added to the
Parser interface:
void setFlag(Flag)
void unsetFlag(Flag)
where Flag is a flag from an enumeration:
STARHACK. WhenSTARHACKis 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\9and\0. The non-standard values produceLexicalType.COMPAT_IDENTvalues as a result.IEPRIOaccepts values with the!iepriority hack, and again producesLexicalType.COMPAT_IDENTvalues.IEPRIOCHARaccepts values with the!important!priority hack, and instead producesLexicalType.COMPAT_PRIOvalues.
LexicalUnit Extensions
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 theIEVALUESandIEPRIOflags are used, and contain ident-like values.COMPAT_PRIOvalues are produced by theIEPRIOCHARflag, representing values that its compatible browser interprets as being of!importantpriority.
Caution is advised when using these compatibility pseudo-values, as they may conflict with syntax-conformant values.
W3C Copyright Notice
This software includes material derived from SAC (https://www.w3.org/TR/SAC/). Copyright © 1999,2000 W3C® (MIT, INRIA, Keio).
-
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'sCombinatorConditioninterface by Philippe Le Hegaret.Combinator selector.Based on SAC'sConditioninterface 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.A condition that declares a property name with an object model value.A condition that declares a property name and a value.Element selector, created by Philippe Le HegaretAn generalized input source.SAC'sLangConditioninterface by Philippe Le Hegaret.A CSS lexical unit.The lexical type.Locate a place in a document.Maps a namespace URI to a prefix, useful for selector serialization.A page selector like:first.List of page selectors.A low-level CSS parser.NSAC parser flags: theParser.Flag.STARHACK,Parser.Flag.IEVALUES,Parser.Flag.IEPRIOandParser.Flag.IEPRIOCHARflags are supported.Interface giving access to namespace URI from the prefix.Allows convenient access to certain parser functionalities.Based on SAC'sPositionalConditioninterface by Philippe Le Hegaret.AConditionfor a pseudo-class or pseudo-element.Based on SAC'sSelectorinterface by Philippe Le Hegaret.Theselector()function.List of selectors.Provides a style sheet context, useful for selector serialization.Simple selector, by Philippe Le Hegaret