Class templateLayout
TemplateLayout is a CSS Template Layout prototype that implements some basic features defined in W3C working draft "Template Layout Module". Features:
- basic template definition: letters, . (dot) and @
- column width in pixels and %
- row height imn pixels and %
Defined in: templateLayout.js.
Constructor Attributes | Constructor Name and Description |
---|---|
templateLayout(templateSource)
Create the prototype main class
|
Field Attributes | Field Name and Description |
---|---|
Template compiler
|
|
Constant object that stores CSS properties names used as triggers
Currently used:
|
|
Template output generator
|
|
Template sources store
|
|
Version number
|
Method Attributes | Method Name and Description |
---|---|
Returns the info from the parsing step
|
|
getTOM()
Returns TOM (Template Object Model)
|
|
isSupportedProperty(property)
Checks if given property is a valid one.
|
|
parserDone(o)
"Parser stop" callback.
|
|
parserStarts(o)
"Parser start" callback.
|
|
propertyFound(property)
"Property has been found" callback.
|
|
transform(options)
Reads, compiles and generates the template
|
Class Detail
templateLayout(templateSource)
Create the prototype main class
- Parameters:
- {string|strings[]} templateSource Optional
- template source.
Supports 0..* strings containing valid CSS text or URL.
Empty constructor searches parent HTML file for STYLE tags and uses its
CSS content as template source.
String params are analyzed and loaded in this way:
- "htttp[s]://..." entries are loaded as files and content extracted
- "file://..." entries are loaded as files and content extracted
- Unmatched entries are loaded as CSS text
Field Detail
compiler
Template compiler
constants
Constant object that stores CSS properties names used as triggers
Currently used:
- constants.DISPLAY = "display"
- constants.POSITION = "position"
generator
Template output generator
templateSources
Template sources store
version
Version number
Method Detail
{ParserBufferEntry[]}
getBuffer()
Returns the info from the parsing step
- Returns:
- {ParserBufferEntry[]} buffer
{rootTemplate}
getTOM()
Returns TOM (Template Object Model)
- Returns:
- {rootTemplate} tom
{boolean}
isSupportedProperty(property)
Checks if given property is a valid one.
If property name exists in constants then is a valid one
- Parameters:
- {CSSParserProperty} property
- the property
- Returns:
- {boolean} true if exists constants[???] == property.declaration.property
parserDone(o)
"Parser stop" callback. Prints stop time
- Parameters:
- {StopCallbackData} o
- Information sent by parser
parserStarts(o)
"Parser start" callback. Prints start time and resets buffer
- Parameters:
- o
- Information sent by parser
- o.time
- Start time in milliseconds
propertyFound(property)
"Property has been found" callback. Stores in buffer valid properties
- Parameters:
- {CSSParserProperty} property
- found property information
transform(options)
Reads, compiles and generates the template
- Parameters:
- {string} options Optional, Default: all
- Only for testing purposes.
Supported values [none|parse|compile]
Stops transform process at different points:
- none: transform does nothing
- parse: transform only parses template source
- compile: transform parses source and compiles the template