Skip to content

Instantly share code, notes, and snippets.

View mogelbrod's full-sized avatar

Victor Hallberg mogelbrod

View GitHub Profile

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@mogelbrod
mogelbrod / path-to-ref.coffee
Last active August 29, 2015 14:01
pathToRef implementation in various JavaScript dialects
###*
* Helper function which returns a reference to a value in an object hierarchy.
* Call with path to parent object if you wish to mutate a value in-place, as
* assignment on reference variables will only set the variable in the local scope.
*
* AngularJS: Available in 'app' module as 'pathToRef' constant.
*
* @param path {Array | String} Path components
* @param root {Object | Array} Root object to start at
* @param initIntermediary {Boolean} Initialize and continue on non-existant values (false = bail)