CSSStyleSheet-class: Representation of a parsed Cascading Style Shetet

Description Objects from the Class Slots Extends Methods Author(s) References See Also Examples

Description

This is the basic class for representing a parsed Cascading Style Sheet in RCSS. It is a reference to a C-level object which holds the parsed information. We can treate the style sheet like a list, asking for its length, its names, individual elements or subsets of elements, and using lapply and sapply to invoke a function on each of the elements.

The CSS is actually a tree and we can access the sub-elements by converting the top-level elements to R objects using asCSSObject. Some classes of elements within the style sheet have methods for accessing the contents directly from the C-level object, e.g. url, sheet and media_list in an IMPORT_RULE object.

Objects from the Class

Objects of these classes are produced implicitly via readCSS.

Slots

docName:

character. The name of the document (file or URL) from which this CSS content was read. This is used to identify the origin of the CSS content and when resolving relative imports.

ref:

Object of class "externalptr" which is the reference to the C-level object.

Extends

Class "ExternalRef", directly.

Methods

[

signature(x = "CSSStyleSheet"): retrieve a subset of the top-level elements in the style sheet.

[[

signature(x = "CSSStyleSheet"): retrieve an individual top-level element of the style sheet.

length

signature(x = "CSSStyleSheet"): return the number of top-level elements in the style sheet. Note that this ignores page and import nodes.

names

signature(x = "CSSStyleSheet"): get (heuristic) names of the top-level names in the style sheet

Author(s)

Duncan Temple Lang

References

libcroco at http://www.freespiders.org/projects/libcroco Cascading Style Sheets http://www.w3.org/Style/CSS/

See Also

readCSS

Examples

1
2
3
4
5
6
css = readCSS(system.file("samples", "test.css", package = "RCSS"))
length(css)
css[]
sapply(css, class)
css[[3]]
css[[3]]

omegahat/RCSS documentation built on May 24, 2019, 1:52 p.m.