+ Please add types to LzNode and LzCSSStyle, e.g. __LZCSSStyleclass:String = ...
Otherwise, looks good! Regards, Max Carlson OpenLaszlo.org On 8/25/10 1:37 PM, P T Withington wrote:
Change ptw-20100825-rTl by [email protected] on 2010-08-25 15:30:14 EDT in /Users/ptw/OpenLaszlo/trunk-2 for http://svn.openlaszlo.org/openlaszlo/trunk Summary: Implement CSS 'classes' for LZX nodes New Features:<node>/styleclass Bugs Fixed: LPP-7358 Add support for CSS 'classes' to<node> Technical Reviewer: [email protected] (pending) QA Reviewer: [email protected] (pending) Doc Reviewer: [email protected] (pending) Documentation: [Please see<node>/styleclass in the LZX Reference in the nightly build after I check this in. I will also be updating the CSS section of the developer's guide with an additional example modelled on the new test/style/classes test.] Release Notes: It is now possible to use CSS class selectors (i.e., view.foo) for LZX<node>s. The `styleclass` attribute of<node> is a space-separated list of CSS class names that the node belongs to. These class names can be used in CSS selectors to cause the corresponding styles to be applied to the node. See the CSS section of the Developer's Guide for more information. Overview: Made class selectors and conjunctions work. Eliminated the runtime parsing of CSS selectors by generating them pre-parsed in the StyleSheetCompiler. Streamlined the selector representation. Details: dynamic: Cleaned up and renamed classes so I can replicate this for a dynamic class test. classes/*: A test modelled on the dynamic attributes test but using multiple dynamic class selectors instead. LzCSSStyle, StyleSheetCompiler: Improved the construction of style rules. The selector is now emitted already parsed with specificity by the style compiler by modelling it as a Map and List internally and using the ScriptCompiler object writer to emit it, rather than trying to build up a string by hand. Throws a compile-time error if an unimplemented rule is encountered (rather than the former behaviour of emitting an ill-formed rule to the runtime). The only runtime parsing is to accumulate the specificity of compound rules. Shortened the names of the parts of selectors to make them more compact (at the price of legibility). Added support for classes (e.g., .foo), conditional 'conjunction' rules (e.g., .foo.bar or [foo=x][bar=y]), for ~= and |= matches. Simplified attribute rules structure since the 2-level lookup can't be used in the dynamic attribute implementation. Eliminated the rule 'type' field since the salient points about type can all be tested directly. Reorganized the attribute checker to work for conjunctions and additional matches. Simplified the main path so that the lookup test in metasuite is actually improved. LzNode: Added the `styleclass` property with a setter that caches multiple classes in a format that makes testing for them faster. Tests: style/metasuite with the new dynamic classes test, and smokecheck on all platforms. Files: M test/style/dynamic/dynamic.lzx A test/style/classes A test/style/classes/library.lzx A test/style/classes/main.lzx A test/style/classes/classes.lzx M test/style/metasuite.lzx M WEB-INF/lps/lfc/services/LzCSSStyle.lzs M WEB-INF/lps/lfc/core/LzNode.lzs M WEB-INF/lps/server/src/org/openlaszlo/compiler/StyleSheetCompiler.java Changeset: http://svn.openlaszlo.org/openlaszlo/patches/ptw-20100825-rTl.tar
