sync with upstream commits

https://github.com/sstephenson/prototype/commit/2c2356251cec90c800e63a5d09d33b47d5430430
and
https://github.com/sstephenson/prototype/commit/548580cc8d162d95c60c3b868ffe0216ba209ab5
merged in manually