All new browsers support the new object-fit CSS property. It allows to specify how an element behaves within its...
The way that Javascript schedules timeouts and promise callbacks is more complicated than you think. This can be the reason...
When you are working with jQuery selectors and collections, many times you want to know if the collection actually contains...
to create a Gallery that has a name and has_many :images, which in turn have a...
The attached ImageLoader helper will start fetching an image and return an image that is resolved once the image is...
jQuery's find looks in the element's descendants. It will never return the current element itself, even if the...
Sometimes you want to preload images that you will be using later. E.g. if hovering over a an area changes...
To delay your entire Jasmine test suite until the DOM is ready, add the following: beforeAll(function(done) { $(done); });
Since jQuery 3 saw it's first release candidate today, the links has a list of (breaking) changes.
When you have a localized website, you may want to redirect users to their preferred language when they visit the...
fake_stripe spins up a local server that acts like Stripe’s and also serves a fake version of Stripe.js...
When building a form with a file select field, you may want to offer your users a live preview before...
You can use JavaScript to get or set cookie values on the client. Using the vanilla JavaScript API
jQuery's deferred objects behave somewhat like standard promises, but not really. One of many subtle differences is that there...
Current webkit browsers like Chrome and Safari have a special variable in their consoles that refers to the selected DOM...
The NestedHash class allows you to read and write hashes of any depth. Examples: hash = {} NestedHash.write hash, 'a', 'b', 'c...
The attached Coffeescript helper will let you create mouse events: $element = $('div') Trigger.mouseover($element) Trigger.mouseenter($element) Trigger.mousedown($element) Trigger.mouseup($element...
Some modern Javascript APIs return iterators instead of arrays. In plain Javascript you can loop through an iterator using
To upload a file via AJAX (e.g. from an ) you need to wrap your params in a FormData object.
Angular's location provider stalls links to the current URL, i.e. window.location. As soon as the $location service is activated...
This will give the target site full access to your Javascript environment through window.opener, if the target is on the...
Let's say you want to find the element with the text hello in the following DOM tree: hello
A HTTP 302 Found redirect to PATCH and DELETE requests will be followed with PATCH or DELETE. Redirect responses to...
In JavaScript we often use Immediately Invoked Function Expessions (or IIFEs) to prevent local variables from bleeding into an outside...