Home Identifier Source Repository

Function

Static Public Summary
public

applyTemplate(el: HTMLElement, tpl: string)

Apply the template given by the property cebTemplate.

public

Get a new attribute builder.

public

Get a new custom element builder.

public

compile(html: string, options: Object): function(i: !IncrementalDOM, h: *)

Compile the given HTML template into a function factory.

public

Get a new delegate builder.

public

evaluate(value: string, options: *, conf: *): string

Evaluate the string to return a JavaScript compliant syntax.

public

getAttValue(el: HTMLElement, attrName: string, isBoolean: boolean): string | boolean

Get the value from an attribute.

public

instantiate(load: *): *

public

Get a new method builder.

public

on(events: string): OnBuilder

Get a new on builder.

public

Get a new property builder.

public

setAttValue(el: HTMLElement, attrName: string, isBoolean: boolean, value: string | boolean)

Set the value of an attribute.

public

Get a new template builder.

public

translate(load: *): *

Static Public

public applyTemplate(el: HTMLElement, tpl: string) source

Apply the template given by the property cebTemplate.

Params:

NameTypeAttributeDescription
el HTMLElement
  • nullable: false

the custom element

tpl string
  • nullable: false

the template

public attribute(attrName: string): AttributeBuilder source

import {attribute} from 'custom-elements-builder'

Get a new attribute builder.

Params:

NameTypeAttributeDescription
attrName string
  • nullable: false

the name of the attribute

Return:

AttributeBuilder

the attribute builder

public ceb(): CustomElementBuilder source

import {ceb} from 'custom-elements-builder'

Get a new custom element builder.

Return:

CustomElementBuilder

the custom element builder

public compile(html: string, options: Object): function(i: !IncrementalDOM, h: *) source

Compile the given HTML template into a function factory.

If the incrementalDOM argument is provided, this function will return a render function. The render function is used with IncrementalDOM.patch.

If the incrementalDOM argument is not provided, this function will return a factory function. The factory function requires the IncrementalDOM library as argument and return the render function..

Basically, when the template is compiled at build time, the IncrementalDOM should not be given. When the template is compiled at runtime, the IncrementalDOM should be given.

Params:

NameTypeAttributeDescription
html string
  • nullable: false

the template

options Object
  • optional

the options

Return:

function(i: !IncrementalDOM, h: *)

the function factory

public delegate(builder: PropertyBuilder | AttributeBuilder | MethodBuilder): DelegateBuilder source

import {delegate} from 'custom-elements-builder'

Get a new delegate builder.

Params:

NameTypeAttributeDescription
builder PropertyBuilder | AttributeBuilder | MethodBuilder
  • nullable: false

a property, attribute or method builder

Return:

DelegateBuilder

the delegate builder

public evaluate(value: string, options: *, conf: *): string source

Evaluate the string to return a JavaScript compliant syntax.

Params:

NameTypeAttributeDescription
value string
  • nullable: false

the value

options *

the options

conf *

the evaluator's configuration

Return:

string

the JavaScript compliant syntax

public getAttValue(el: HTMLElement, attrName: string, isBoolean: boolean): string | boolean source

Get the value from an attribute.

Params:

NameTypeAttributeDescription
el HTMLElement
  • nullable: false

an HTML element

attrName string
  • nullable: false

the name of the attribute

isBoolean boolean
  • nullable: false

true is the returned value should be a boolean

Return:

string | boolean

public instantiate(load: *): * source

Params:

NameTypeAttributeDescription
load *

Return:

*

public method(methName: string): MethodBuilder source

import {method} from 'custom-elements-builder'

Get a new method builder.

Params:

NameTypeAttributeDescription
methName string
  • nullable: false

the name of the method

Return:

MethodBuilder

the method builder

public on(events: string): OnBuilder source

import {on} from 'custom-elements-builder'

Get a new on builder.

Params:

NameTypeAttributeDescription
events string
  • nullable: false

a list of tuple 'event target' separated by comas, the target is optional

Return:

OnBuilder

the on builder

public property(propName: string): PropertyBuilder source

import {property} from 'custom-elements-builder'

Get a new property builder.

Params:

NameTypeAttributeDescription
propName string
  • nullable: false

the name of the property

Return:

PropertyBuilder

the property builder

public setAttValue(el: HTMLElement, attrName: string, isBoolean: boolean, value: string | boolean) source

Set the value of an attribute.

Params:

NameTypeAttributeDescription
el HTMLElement
  • nullable: false

an HTML element

attrName string
  • nullable: false

the name of the attribute

isBoolean boolean
  • nullable: false

true is the value should be a boolean

value string | boolean

the value to set

public template(tpl: string | Function): TemplateBuilder source

import {template} from 'custom-elements-builder'

Get a new template builder.

Params:

NameTypeAttributeDescription
tpl string | Function
  • nullable: false

the string or function template

Return:

TemplateBuilder

the template builder

public translate(load: *): * source

Params:

NameTypeAttributeDescription
load *

Return:

*