API Docs for: 1.0 pre
Show:

Ember.RenderBuffer Class

Ember.RenderBuffer gathers information regarding the a view and generates the final representation. Ember.RenderBuffer will generate HTML which can be pushed to the DOM.

var buffer = Ember.RenderBuffer('div');

Constructor

Ember.RenderBuffer

(
  • tagName
)

Parameters:

  • tagName String

    tag name (such as 'div' or 'p') used for the buffer

Methods

addClass

(
  • className
)
chainable

Adds a class to the buffer, which will be rendered to the class attribute.

Parameters:

  • className String

    Class name to add to the buffer

attr

(
  • name
  • value
)
Ember.RenderBuffer | String chainable

Adds an attribute which will be rendered to the element.

Parameters:

  • name String

    The name of the attribute

  • value String

    The value to add to the attribute

Returns:

Ember.RenderBuffer | String:

this or the current attribute value

element

() DOMElement

Returns:

DOMElement:

The element corresponding to the generated HTML of this buffer

id

(
  • id
)
chainable

Sets the elementID to be used for the element.

Parameters:

prop

(
  • name
  • value
)
Ember.RenderBuffer | String chainable

Adds a property which will be rendered to the element.

Parameters:

  • name String

    The name of the property

  • value String

    The value to add to the property

Returns:

Ember.RenderBuffer | String:

this or the current property value

push

(
  • string
)
chainable

Adds a string of HTML to the RenderBuffer.

Parameters:

  • string String

    HTML to push into the buffer

removeAttr

(
  • name
)
chainable

Remove an attribute from the list of attributes to render.

Parameters:

  • name String

    The name of the attribute

removeProp

(
  • name
)
chainable

Remove an property from the list of properties to render.

Parameters:

  • name String

    The name of the property

string

() String

Generates the HTML content for this buffer.

Returns:

String:

The generated HTML

style

(
  • name
  • value
)
chainable

Adds a style to the style attribute which will be rendered to the element.

Parameters:

Properties

classes

Array

Array of class names which will be applied in the class attribute.

You can use setClasses() to set this property directly. If you use addClass(), it will be maintained for you.

Default: null

elementAttributes

Hash

A hash keyed on the name of the attribute and whose value will be applied to that attribute. For example, if you wanted to apply a data-view="Foo.bar" property to an element, you would set the elementAttributes hash to {'data-view':'Foo.bar'}.

You should not maintain this hash yourself, rather, you should use the attr() method of Ember.RenderBuffer.

Default: {}

elementClasses

Array private

An internal set used to de-dupe class names when addClass() is used. After each call to addClass(), the classes property will be updated.

Default: null

elementId

String

The id in of the element, to be applied in the id attribute.

You should not set this property yourself, rather, you should use the id() method of Ember.RenderBuffer.

Default: null

elementProperties

Hash

A hash keyed on the name of the properties and whose value will be applied to that property. For example, if you wanted to apply a checked=true property to an element, you would set the elementProperties hash to {'checked':true}.

You should not maintain this hash yourself, rather, you should use the prop() method of Ember.RenderBuffer.

Default: {}

elementStyle

Hash

A hash keyed on the name of the style attribute and whose value will be applied to that attribute. For example, if you wanted to apply a background-color:black; style to an element, you would set the elementStyle hash to {'background-color':'black'}.

You should not maintain this hash yourself, rather, you should use the style() method of Ember.RenderBuffer.

Default: {}

elementTag

String

The tagname of the element an instance of Ember.RenderBuffer represents.

Usually, this gets set as the first parameter to Ember.RenderBuffer. For example, if you wanted to create a p tag, then you would call

Ember.RenderBuffer('p')

Default: null

parentBuffer

Ember._RenderBuffer

Nested RenderBuffers will set this to their parent RenderBuffer instance.