CSS4 comes with :has. E.g. h1:has(b) would select all tags that contain a tag. This is implemented in...

With "attaching an event handler once" you possibly mean one of these two things: Register a function for an event...

makandra dev
github.com

Note This card does not reflect the current state of lazy loading technologies. The native lazy attribute could be used...

If you have jQuery code like this: if (condition) { $element.show(); } else { $element.hide(); } ... you can shorten this to: $element.toggle(condition);

You can say this in Javascript: $.fn.jquery => "1.11.1"

Our applications not only need to be functional, they need to be fast. But, to quote Donald Knuth, premature optimization...

andismith.com

If you need to upgrade code that uses the old jQuery methods bind, delegate, live, unbind and die, the attached...

In a web application you often need to move data between the client (HTML, Javascript) and the server (Ruby, Rails...

Jasmine comes with two matchers that test for equality. The first is toBe: expect(first).toBe(second) toBe passes when...

tl;dr: Use event.currentTarget unless you are absolutely certain that you need event.target. Since it hasn't been written down...

When you register a delegated event using on (or the deprecated delegate / live), it is somewhat hard to manually trigger...

github.com

jquery-placeholder is a simple jQuery plugin that enables form placeholders in browsers that do not support them natively, i.e...

When ending a Selenium test Capybara resets the browser state by closing the tab, clearing cookies, localStorage, etc.

patrickmarabeas.github.io

Webfonts are not always available when your JavaScript runs on first page load. Since fonts may affect element sizes, you...

jQuery doesn't store information about event listeners and data values with the element itself. This information is instead stored...

This guide shows how to create an AngularJS application that consumes more and more memory until, eventually, the browser process...

Here is a Javascript function reloadUsers() that fetches a HTML snippet from the server using AJAX and replaces the current...

makandra dev
github.com

This jasmine plugin helps with testing DOM manipulation in two ways: It gives you DOM-related matchers like toBeVisible() or...

dimsemenov.com

Responsive Lightbox JavaScript that just works. You can use it for single images or a gallery. Animations are optional.

The API is a little confusing because animate returns a reference to the element to enable chaining.

jQuery comes with .animate() that lets you transition some CSS selectors: function floatIn($element) { $element.css({ 'opacity': 0, 'margin-top': 200px...

The benefit of the Rails asset pipeline is that it compiles your stylesheets and javascripts to a single file, respectively...

github.com

BubbleTree is a library for interactive visualization of hierarchical data. Originally developed mainly for spending data, the library is now...

Browsers make this very hard. Even when you explicitely set the selection inside the textarea (e. g. using jquery-fieldselection...