I think the that's the correct behaviour. For one record javascript is working as it has one context, but if you select many records different contexts are there.
E.g. Assume your OnLoad JS has a condition such as, if status == Draft, then Do Something
In this case, JS has many different status' from many records.
That's my idea and hope that makes sense.