buttonMarkup: Use native js more often to improve performance. Fixes #5466. Thanks Changsuk.

Performance analysis: http://jsperf.com/jqmdatavsremovedata/7

I used a third option where I restore the popup-handling code to the original, but that's unnecessary because plain optimization achies the highest performance.