Listview: Do not compute .first() if there is only one anchor

(cherry picked from commit 3d8560939cf8ff87cd17b791771c6ec26a625dd0)
addFirstLastClasses: .not( ".ui-screen-hidden" ) -> custom function

http://jsperf.com/dot-not-vs-loop

(cherry picked from commit 7b818d8e2ed234de6316bb63521828cdd95da2cc)

Closes gh-7228
Fixes gh-7227