ensemble.base
#
ensemble- ensemble
- ~base
- new base([element], options)
- .defaults(defaults, options) โ
object
- .compo(ns, [tag], [name]) โ
mixed
- .data(obj) โ
mixed
- .event(obj) โ
mixed
- .selector(query, node, all) โ
mixed
- .appendNode(parent, node) โ
boolean
- .prependNode(parent, node) โ
boolean
- .removeNode(parent, node) โ
boolean
- .cloneNode(node, deep) โ
boolean
- .hasAttr(node, attr) โ
boolean
- .getAttr(node, attr) โ
string
- .setAttr(node, attr, value)
- .delAttr(node, attr)
- .binds(method) โ
function
- .delay(func, node, dtime)
- .timing(node, prop) โ
int
- ~base
#
ensemble~baseA base class for ensemble components.
Kind: inner abstract class of ensemble
- ~base
- new base([element], options)
- .defaults(defaults, options) โ
object
- .compo(ns, [tag], [name]) โ
mixed
- .data(obj) โ
mixed
- .event(obj) โ
mixed
- .selector(query, node, all) โ
mixed
- .appendNode(parent, node) โ
boolean
- .prependNode(parent, node) โ
boolean
- .removeNode(parent, node) โ
boolean
- .cloneNode(node, deep) โ
boolean
- .hasAttr(node, attr) โ
boolean
- .getAttr(node, attr) โ
string
- .setAttr(node, attr, value)
- .delAttr(node, attr)
- .binds(method) โ
function
- .delay(func, node, dtime)
- .timing(node, prop) โ
int
#
new base([element], options)Constructor method.
Param | Type | Description |
---|---|---|
[element] | Element | A valid element, could be used within the extending class |
options | object | Options object |
Example
object
#
base.defaults(defaults, options) โ Creates an options Object from a defaults object of pre-defined properties.
Note it supports only the first level of depth.
Kind: instance method of base
Param | Type | Description |
---|---|---|
defaults | object | The default options Object |
options | object | An options Object that would extends |
mixed
#
base.compo(ns, [tag], [name]) โ Shorthand method for ensemble.Compo class.
When passed the first argument it makes a new Compo instance, otherwise it returns a reference to the Compo class.
Kind: instance method of base
Returns: mixed
- Instance of ensemble.Data -or- ensemble.Data class reference
Param | Type | Default | Description |
---|---|---|---|
ns | string | Composition namespace | |
[tag] | string | "'div'" | The [DOM] Element node tag -or- component name, empty for ensemble.Compo class reference |
[name] | mixed | The composition name, used for CSS className |
mixed
#
base.data(obj) โ Shorthand method for ensemble.Data class.
When passed the first argument it makes a new Data instance, otherwise it returns a reference to the Data class.
Kind: instance method of base
Returns: mixed
- Instance of ensemble.Data -or- ensemble.Data class reference
Param | Type | Description |
---|---|---|
obj | object | A starter Object, empty for ensemble.Data class reference |
mixed
#
base.event(obj) โ Shorthand method for ensemble.Event class.
When the passed first argument is a string it makes a new Event instance, if you pass an Event as the first argument, a preventDefault and blur will be performed, otherwise it returns a reference to the Event class.
Kind: instance method of base
Param | Type | Description |
---|---|---|
obj | object | A starter Object, empty for ensemble.Event class reference |
mixed
#
base.selector(query, node, all) โ Shortcut to querySelectorAll() and querySelector() [DOM].
Kind: instance method of base
Returns: mixed
- - Element -or- ElementCollection
See
- Element.querySelectorAll()
- Element.querySelector()
Param | Type | Default | Description |
---|---|---|---|
query | string | A text query | |
node | Element | An Element node where find | |
all | boolean | false | Find single or multiple elements |
boolean
#
base.appendNode(parent, node) โ Shortcut to appendChild() [DOM].
Kind: instance method of base
See: Element.appendChild()
Param | Type | Description |
---|---|---|
parent | Element | An Element parent |
node | Element | An Element node to append |
boolean
#
base.prependNode(parent, node) โ Shortcut to prependChild() [DOM].
Kind: instance method of base
See: Element.prependChild()
Param | Type | Description |
---|---|---|
parent | Element | An Element parent |
node | Element | An Element node to prepend |
boolean
#
base.removeNode(parent, node) โ Shortcut to cloneNode() [DOM].
Kind: instance method of base
See: Element.removeNode()
Param | Type | Description |
---|---|---|
parent | Element | An Element parent |
node | Element | An Element node to remove |
boolean
#
base.cloneNode(node, deep) โ Shortcut to Element.cloneNode() [DOM].
Kind: instance method of base
See: Element.cloneNode()
Param | Type | Default | Description |
---|---|---|---|
node | Element | An Element node to clone | |
deep | boolean | false | Clone also all children inside the Element node |
boolean
#
base.hasAttr(node, attr) โ Shortcut to Element.hasAttribute() [DOM].
Kind: instance method of base
See: Element.hasAttribute()
Param | Type | Description |
---|---|---|
node | Element | An Element node |
attr | string | An attribute |
string
#
base.getAttr(node, attr) โ Shortcut to Element.getAttribute() [DOM].
Kind: instance method of base
See: Element.getAttribute()
Param | Type | Description |
---|---|---|
node | Element | An Element node |
attr | string | An attribute |
#
base.setAttr(node, attr, value)Shortcut to Element.setAttribute() [DOM].
Kind: instance method of base
See: Element.setAttribute()
Param | Type | Description |
---|---|---|
node | Element | An Element node |
attr | string | An attribute |
value | string | The value |
#
base.delAttr(node, attr)Shortcut to Element.removettribute() [DOM].
Kind: instance method of base
See: Element.removeAttribute()
Param | Type | Description |
---|---|---|
node | Element | An Element node |
attr | string | An attribute |
function
#
base.binds(method) โ Creates a proxy function with bindings to instance and optionally an event.
Kind: instance method of base
Todo
- untrusted method
Param | Type | Description |
---|---|---|
method | function | A method from the current instance |
#
base.delay(func, node, dtime)Provides a delay and executes a callback function
Kind: instance method of base
See: window.setTimeout()
Param | Type | Description |
---|---|---|
func | function | A function callback |
node | mixed | An Element node -or- an ensemble.Compo composition |
dtime | int | A default value of time in milliseconds |
int
#
base.timing(node, prop) โ Calculates a time, based on a time property of the style of an element
Kind: instance method of base
Returns: int
- time - Number of time in milliseconds
See: window.getComputedStyle()
Param | Type | Default | Description |
---|---|---|---|
node | mixed | An Element node -or- an ensemble.Compo composition | |
prop | string | "transitionDuration" | A style property |