Instances of Controller.Params are passed to Event based actions.
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());
}
})
new Controller.Params(params) -> Controller.Params
Creates a new Controller.Params object.
params.element -> HTMLElement
The HTML element that the Matches the action's selector.
params.event -> Event
Returns the event that resulted in the Action being called.
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.
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'
params.object_data() -> Object
If data was attached to the class_element, this returns that data.