ded / bonzo

library agnostic, extensible DOM utility
Other
1.32k stars 137 forks source link

Added a parent() function #61

Closed markusthoemmes closed 12 years ago

markusthoemmes commented 12 years ago

Just added a rather simple parent() function using the related() function already implemented.

rvagg commented 12 years ago

FWIW, +1 this for me on adding parent() but I'd rather see parents() fixed in the bridge for the case where no arguments are supplied (it could act like selector='*' but without calling $('*')). Then closest() with no arguments gives you the functionality you're after. If parent() is still required it can just call closest().

Of course you could use the super-awesome .up() function that comes if you build Ender with Traversty which is quick & safe for the no-arg case but can also take optional selector and index arguments to find exactly what you want. (Shameless plug)

ded commented 12 years ago

i added parent — it's not amazingly robust, but it's working. as @rvagg pointed out, if you want some really great traversing methods, check out his Traversty module.