We are currently using prototype and jQuery as our js frameworks. Right now, jQuery is set to $ j () to prevent prototype conflicts.
In the past, we used many prototypes of Element.down (), Element.next (), and Element.previous () to traverse the DOM. However, I need an easy way to get the last child. I know that I can iterate over an array using Element.childElements (), but I would like something inline that reads cleanly and can be pipelined.
Just thought I'd ask before I reinvent the wheel again. Here is a snippet of code that has lastChild in it that needs to be replaced:
_find : function(rows, address) { var obj = null; for (var i=0; i < rows.length && obj == null; i++) { if (rows[i].down().className == 'b') obj = this._find(rows[i].lastChild.down().down().childElements(), address); else if (rows[i].lastChild.getAttribute('tabAddress') == address) return rows[i].lastChild; } return obj; }
javascript jquery prototypejs
taco
source share