david-mark-llc / jessie

Javascript cross-browser library builder enabling (real) progressive enhancement
http://jessie.herokuapp.com
39 stars 13 forks source link

getElementsByClassName default in rendition1 #242

Open web-bert opened 10 years ago

web-bert commented 10 years ago

Should rendition1 actually default to document when no el is passed - or just throw an error?

https://github.com/rassie/jessie/blob/master/functions/getDescendantsByClassName/rendition1.js#L12

This has just caught me out, as some code was expecting to get some descendants by class, but instead it got the whole documents elements. And I didn't notice until the tester pointed it out, where as if it threw an error then I would have known before checking it in.

adamsilver commented 10 years ago

Not sure really...

Either we default it as is or it will naturally throw an error when el is undefined. Wouldn't need scaffolding for that one although you could - but then it would be the same piece of scaffolding on 75% of the functions.

david-mark commented 10 years ago

I would take that out as the first argument should not be optional.

Thanks!

adamsilver commented 10 years ago

There ya go - it's certainly not nice to do getElementsByClassName(, "className")