2010-02-11 07:44:48 +01:00
|
|
|
var DOM = {};
|
|
|
|
|
2010-02-12 03:23:26 +01:00
|
|
|
DOM.bind = function(elmt) {
|
2010-02-11 07:44:48 +01:00
|
|
|
var map = {};
|
|
|
|
|
|
|
|
DOM._bindDOMChildren(elmt[0], map);
|
|
|
|
|
|
|
|
return map;
|
|
|
|
};
|
|
|
|
|
|
|
|
DOM._bindDOMElement = function(elmt, map) {
|
2010-02-23 01:33:39 +01:00
|
|
|
var bind = elmt.getAttribute("bind");
|
|
|
|
if (bind != null && bind.length > 0) {
|
|
|
|
map[bind] = $(elmt);
|
|
|
|
elmt.removeAttribute("bind");
|
2010-02-11 07:44:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (elmt.hasChildNodes()) {
|
|
|
|
DOM._bindDOMChildren(elmt, map);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
DOM._bindDOMChildren = function(elmt, map) {
|
|
|
|
var node = elmt.firstChild;
|
|
|
|
while (node != null) {
|
|
|
|
var node2 = node.nextSibling;
|
|
|
|
if (node.nodeType == 1) {
|
|
|
|
DOM._bindDOMElement(node, map);
|
|
|
|
}
|
|
|
|
node = node2;
|
|
|
|
}
|
|
|
|
};
|