Controller.Params

class_element, Controller.Params, element, event, form_params, object_data

Related

Controller, Controller.Action

Instances of Controller.Params are passed to Event based actions.

Example

new Controller('todos', {
   mouseover : function(params){ 
      params.element.style.backgroundColor = 'Red';
   },
   mouseout : function(params){
      params.element.style.backgroundColor = '';
      params.event.stop();
   },
   "img click" : function(params){
   	  params.class_element().parentNode.removeSibiling(params.class_element());
   }
})

Class Methods

Controller.Params

new Controller.Params(params) -> Controller.Params

Creates a new Controller.Params object.

Attributes

element

params.element -> HTMLElement

The HTML element that the Matches the action's selector.

event

params.event -> Event

Returns the event that resulted in the Action being called.

Prototype Methods

form_params

params.form_params() -> Object

When an event handler is called on a 'FORM' element. This function will return an object containing the name -> value pairs of input elements nested inside the form.

class_element

params.class_element() -> HTMLElement

Returns the parent element that represents this class. For an example controller and action like:

new Controller('todos', {
   "img click" : function(params){
   	  params.class_element()
   }
})

params.class_element() returns the parent element of the IMG tag with className = 'todo'

object_data

params.object_data() -> Object

If data was attached to the class_element, this returns that data.