cssd 0.1.3

CSS library for D


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

cssd

CSS library for D

The library currently includes a non-validating parser module and a DOM agnostic (currently through an element proxy template) selector matching module The selector matching module currently implements all CSS3 and the case-insensitive attribute matching from CSS4. Pseudo-elements are currently left to be handled by the user code to minimize the proxy template interface.

Example handler:

struct CSSOMBuilder {
	void onSelector(const(char)[] data) {}
	void onSelectorEnd() {}
	void onBlockEnd() {}
	void onPropertyName(const(char)[] data) {}
	void onPropertyValue(const(char)[] data) {}
	void onPropertyValueEnd() {}
	void onComment(const(char)[] data) {}
}

Example usage:

auto builder = CSSOMBuilder();
parseCSS(`h1:hover > span#highlight { background: black; }`, builder);

Example selector usage:

	auto highlightSelector = Selector.parse("h1:hover > span#highlight"); // parses selector into a representation that is fast to test
	if (highlightSelector.matches(someElement))
		someElement.attr("style", highlightStyle);
Authors:
  • Márcio Martins
Dependencies:
none
Versions:
0.1.3 2016-Dec-01
0.1.2 2016-Nov-30
0.1.1 2015-Apr-09
0.1.0 2015-Apr-02
~master 2016-Dec-01
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 0 downloads total

Score:
1.7
Short URL:
cssd.dub.pm