Hacker Newsnew | comments | show | ask | jobs | submit login

Personally, I never did like things abstracting the iteration for me. In Javascript, I tend to favor explicit loops over huge chains of method calls, or visually confusing abstracting like the Raphael example. Just looking at that Raphael example, I'd have to actually think about the code to understand what it does right off the bat (shocker, I know, but I think you get my point). I actually think that the Bonsai example there is the most straight forward and flexible. Of course, this is all just opinion.



When working with DOM elements (SVG elements are also part of the DOM) it get messy pretty quickly. Think of it as syntactic sugar, because you can always opt for using standard arrays instead of using Raphael sets...

    var rects = [//insert rects here]
    rects.forEach(function(rect){
       rect.attr({fill: "red"});
    })

-----




Applications are open for YC Winter 2016

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: