Popup: Performance improvements.

http://jsperf.com/improve-popup