added support for handling multiple elements

This PR passes all test on OS X 10.7 (Lion) in FF20.0, Chr 26.0, Op 12.15.
It fails however in Saf 6.0 but so does your master branch. AFAIK, this is a separate issue, that has nothing to do with this PR.

I might do another PR to resolve the Saf issue :+1: 

BTW: I like your style