Create an instance of StyleSheet to encapsulate a css stylesheet.
The constructor can be called using function or constructor syntax.
var sheet = Y.StyleSheet(..);
or
var sheet = new Y.StyleSheet(..);
The first parameter passed can be any of the following things:
- The desired string name to register a new empty sheet
- The string name of an existing StyleSheet instance
- The unique guid generated for an existing StyleSheet instance
- The id of an existing
<link>
or <style>
node
- The node reference for an existing
<link>
or <style>
node
- The Y.Node instance wrapping an existing
<link>
or <style>
node
- A chunk of css text to create a new stylesheet from
If a string is passed, StyleSheet will first look in its static name
registry for an existing sheet, then in the DOM for an element with that id.
If neither are found and the string contains the { character, it will be
used as a the initial cssText for a new StyleSheet. Otherwise, a new empty
StyleSheet is created, assigned the string value as a name, and registered
statically by that name.
The optional second parameter is a string name to register the sheet as.
This param is largely useful when providing a node id/ref or chunk of css
text to create a populated instance.