That's a good question, I think that we should not consider Surface as a mobile, but it is a really hybrid device so it could fit in this category.
Anyway, I'm pretty sure that anyone could modify the function to whatever they need.
That returns undefined in Windows 8 touch based devices. I will do more tests however.
Nice post, but I think that this would be the correct way to perform the test:
It should be expect(xPosition('#someSection')).toBeGreaterThan(0);
Much better!
I've changed it :)
@robsonsobral tables are not working right now, meanwhile I've created a list. If you could please tell me Windows Phone 7.8 and 8 user agents I could extend the function and add support for those devices too.
For now this trick have been worked an all devices I've tested. I didn't have any problem on Android, iOS, Mac OS X, Windows 7 and 8.
Achievements
270 Karma
196,977 Total ProTip Views
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/forked100-eb3235ebeb00483ef070677bead3e2c4037d5b3f9197d3f6c524a0b0bf185587.png)
Forked 100
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/forked50-dfb43b5a47a4ee100a1d56e45ef509ffd0aab7612db3bdcb625a9ba4f7a8a346.png)
Forked 50
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/forked20-d8399a08bf011790a855bcc59ae5ffe039e48f3ca9094f9425d6685a2b7fd330.png)
Forked 20
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/100lemming-75ef69b417fed814e00911c952268ec8f46e670b2b7f1d3197e95e531530c5f3.png)
Lemmings 100
![](https://dj1symwmxvldi.cloudfront.net/assets/badges/forked1-63f23ad054823f6065b4526f8552dbc2c4fbaa75d22db7150d700201218ac426.png)
I love it :)
It will be even better if you can detect when $digest loop is called and when it finishes, to remove those
$scope.$broadcast()
, but as far as I know it is not possible in AngularJS.Another improvement could be to use
$rootScope.$emit()
that is far better in performance than$scope.$broadcast()
due to the bubbling propagation, but anyway is pretty smart and I will use this very soon I think.