Inherits from NSObject
Conforms to NSCopying
Declared in DTCSSStylesheet.h

Overview

This class represents a CSS style sheet used for specifying formatting for certain CSS selectors.

It supports matching styles by class, by id or by tag name. Hierarchy matching is not supported yet.

Class Methods

defaultStyleSheet

Creates the default stylesheet.

+ (DTCSSStylesheet *)defaultStyleSheet

Discussion

This stylesheet is based on the standard styles that Webkit provides for these tags. This stylesheet is loaded from an embedded copy of default.css.

Declared In

DTCSSStylesheet.h

Instance Methods

initWithStyleBlock:

Creates a stylesheet with a given style block

- (id)initWithStyleBlock:(NSString *)css

Parameters

css

The CSS string for the style block

Declared In

DTCSSStylesheet.h

mergeStylesheet:

Merges styles from given stylesheet into the receiver

- (void)mergeStylesheet:(DTCSSStylesheet *)stylesheet

Parameters

stylesheet

the stylesheet to merge

Declared In

DTCSSStylesheet.h

mergedStyleDictionaryForElement:matchedSelectors:ignoreInlineStyle:

Returns a dictionary that contains the merged style for a given element and the applicable style rules from the receiver.

- (NSDictionary *)mergedStyleDictionaryForElement:(DTHTMLElement *)element matchedSelectors:(NSSet *__autoreleasing *)matchedSelectors ignoreInlineStyle:(BOOL)ignoreInlineStyle

Parameters

element

The HTML element.

matchedSelectors

The CSS selectors that caused a match

ignoreInlineStyle

If YES then the inline styles of the element will be ignored and only the receiver’s styles used

Return Value

The merged style dictionary containing only styles which selector matches the element

Declared In

DTCSSStylesheet.h

orderedSelectors

Returns an ordered (by declaration) set of the selectors for all of the styles.

- (NSArray *)orderedSelectors

Declared In

DTCSSStylesheet.h

parseStyleBlock:

Parses a style block string and adds the found style rules to the receiver.

- (void)parseStyleBlock:(NSString *)css

Parameters

css

The CSS string for the style block

Declared In

DTCSSStylesheet.h

styles

Returns a dictionary of the styles of the receiver

- (NSDictionary *)styles

Declared In

DTCSSStylesheet.h