Functiondojo.behavior.add

dojo.require("dojo.behavior");
defined in dojo/behavior.js

behavior objects are specified in the following format(s):

{ "#id": { "found": function(element){ // ... },

"onblah": {targetObj: foo, targetFunc: "bar"},

"onblarg": "/foo/bar/baz/blarg",

"onevent": function(evt){ },

"onotherevent: function(evt){ // ... } },

"#id2": { // ... },

"#id3": function(element){ // ... },

// publish the match on a topic "#id4": "/found/topic/name",

// match all direct descendants "#id4 > *": function(element){ // ... },

// match the first child node that's an element "#id4 > :first-child": { ... },

// match the last child node that's an element "#id4 > :last-child": { ... },

// all elements of type tagname "tagname": { // ... },

"tagname1 tagname2 tagname3": { // ... },

".classname": { // ... },

"tagname.classname": { // ... }, }

The "found" method is a generalized handler that's called as soon as the node matches the selector. Rules for values that follow also apply to the "found" key.

The "on*" handlers are attached with dojo.connect().

If the value corresponding to the ID key is a function and not a list, it's treated as though it was the value of "found".

Usage

function (behaviorObj) (view source)
parametertypedescription
behaviorObj