Removed dirty checking, minor optimizations (#135)
Removed dirty checking, minor optimizations (#135)

* Removed dirty checking, minor optimizations

An update will now only be queued through requestAnimationFrame whenever
changes occurred. This means that absolutely no code is running when the
page is idling (helpful for power saving and scalability). Care was
taken to first read from the DOM and afterwards update it in the new
scroll handler to prevent any possible layout thrashing as described here:

http://wilsonpage.co.uk/preventing-layout-thrashing/

lastWidth, lastHeight and all sensor properties are only updated
once every frame.

* Run callbacks only if size changed between two frames

An element may change its size multiple times during a frame. Do not
emit events anymore if its size returned to its previous size since the
last update. This means that events occurring in between two frames -
which are never visible to the user - may be skipped.

* Reset sensors always

Sensors need to be reset even if the element's size returned to its
original dimensions.

* Fix performance regression

Resetting within the requestAnimationFrame handler lead to bad
performance. This was noticeable in the performance demo where this
version fares about as good as older versions.

* Avoid initial resize event

* Code simplification

privard/css-element-queries,marcj/css-element-queries,marcj/css-element-queries,marcj/css-element-queries