class
SAPO.Utility.Styler
Version:
0.1
This class makes it easy to port static CSS rules so they apply only to a given element.
It stores the element's id (or assigns it one if missing)
It then creates a style element which it controls.
One then must pass it rules assigned to sections. These rules get prefixed with the element's id and updated in the style element,
When common browsers support scoped styles, these could be detected and used preferably:
'scoped' in document.createElement('style')
Since:
Defined in
Utility/Styler/0.1/lib.js
January 2013
Constructor Summary
Function Summary
addSection
(String
sectionName)
adds a new section to the style. sections get rendered in the order specified by the addSection(s) invocations.
addSections
(String[] | String
sectionNames)
allows adding several sections at once
appends additional CSS rules to a section
replaces the CSS rules assigned to a section
Constructor Details
constructor Styler
Styler(String|DOMElement
idOrEl, [Boolean
outputSectionComments])
Parameters:
idOrEl
id of an element or the element itself
[outputSectionComments]
set trueish value if you want the CSS rules to be prefix by a comment specifying the section name Function Details
function addSection
addSection(String
sectionName)
adds a new section to the style. sections get rendered in the order specified by the addSection(s) invocations.
Parameters:
sectionName
name for the section to add function addSections
addSections(String[] | String
sectionNames)
allows adding several sections at once
Parameters:
sectionNames
names for the sections. can be a space-separated string or array of strings function appendToSection
appends additional CSS rules to a section
Parameters:
sectionName
name of the section. in inexistent, creates one
rules
CSS rules to append to the section
[skipUpdate]
use trueish value if you're calling setSection and appendToSections sequentially function setSection
replaces the CSS rules assigned to a section
Parameters:
sectionName
name of the section. in inexistent, creates one
rules
CSS rules to set to the section
[skipUpdate]
use trueish value if you're calling setSection and appendToSections sequentially