Skip Selenium scenarios in a Cucumber run

@javascript Cucumber scenarios run with Selenium and can slow down test runs; cucumber --tags ~@javascript skips them when needed.

Don't use "self" as a Javascript variable

Using self as a JavaScript variable can collide with the global window alias and cause confusing bugs when capturing this in callbacks.

Type text into Javascript prompt dialogs in Capybara/Selenium

Automated tests need a way to enter text into JavaScript prompt dialogs in Capybara/Selenium. Browser dialog handling can block workflows unless the prompt input is filled correctly.

How to: Client-side language detection

Client-side language detection can route visitors to their preferred locale on the root path without a server-side component, with JavaScript and a meta refresh fallback.

Unpoly: Testing values for presence or blankness

Blank and missing values in JavaScript need explicit handling; Unpoly provides up.util.isBlank(), up.util.isPresent(), up.util.isMissing() and up.util.isGiven() for common and custom types.

Using feature flags to stabilize flaky E2E tests

Always-on UI behaviors like polling, animations, autocomplete, and lazy loading can make E2E tests flaky; feature flags disable them by default and re-enable them only where needed.

Prevent the selenium webbrowser window from closing after a failed @javascript step

Failed @javascript Cucumber steps can close the Selenium browser before the page state is inspected. Keeping the window open on failure helps debug the created data.

JavaScript Start-up Performance

JavaScript parse and execution can delay app interactivity long after download, making heavy startup code a common cause of slow page load.

Howto prompt before accidentally discarding unsaved changes with JavaScript

Warns users before leaving a page with unsaved form data or dirty CKEditor content, helping prevent accidental loss during navigation or submit handling.

Capybara: Waiting for pending AJAX requests after a test

Selenium tests can fail when pending AJAX calls are aborted as Capybara closes the browser tab. Blocking new requests and waiting for in-flight work reduces flaky teardown errors.

Bootstrap 4 is coming

Bootstrap 4 switches from Less to Sass, adds flexbox-based layout options and cards, and modernizes customization, JavaScript, and browser support.

How to access before/after pseudo element styles with JavaScript

Pseudo-element styles are hard to inspect directly, but getComputedStyle can read ::before and ::after values for testing and color checks.

JSONP - Wikipedia

Cross-origin web pages cannot normally communicate, but <script> requests can pull executable JavaScript around same-origin limits. JSONP uses this loophole to load dynamic data from other origins.

Beware: Coffeescript "in" is not the Javascript "in"

CoffeeScript in checks array membership, not object properties; JavaScript in tests whether an object has a property. Use of for property lookup in CoffeeScript.

Drag'n'drop in trees: I went to town

Nested drag-and-drop for reorderable trees is hard when items can be leaves or containers; precise drop targets need custom JavaScript, CSS, and testing support.

Rails Assets

Automatically wraps Bower packages as gems for the Rails asset pipeline, but duplicate JavaScript copies can conflict when mixed with other package sources.

Jasmine: Spy on value properties

Jasmine spyOnProperty() fails on plain value fields; a helper can convert them into accessors so they can be stubbed or asserted in tests.

JavaScript “Stale Practices” | benmccormick.org

ES5-era JavaScript best practices have stale alternatives in modern code, and older patterns can become outdated as the language evolves quickly.

JavaScript events: target vs currentTarget

event.target points to the clicked descendant, while event.currentTarget points to the element handling the listener; currentTarget is usually the safer choice.

An intro to Javascript promises

Promises provide a chainable way to handle asynchronous work and separate control flow from callbacks, with built-in support in modern browsers and polyfills for older ones.

Open the on-screen keyboard on an iPhone or iPad with Javascript

iPhone and iPad browsers do not allow JavaScript to open the on-screen keyboard programmatically. The keyboard appears only after a user gesture in an editable field.

Represent astral Unicode characters in Javascript, HTML or Ruby

Unicode symbols can be hard to enter reliably across tools, and astral characters or non-breaking spaces often need escapes or entities instead of pasted text.

Make jQuery.animate run smoother with almost no code changes

jQuery .animate() can feel choppy because it relies on JavaScript timers, while CSS transitions deliver smoother motion with nearly the same API.

JavaScript: How to generate a regular expression from a string

Build RegExp objects from strings, but literal characters are not escaped automatically. Escaping input avoids unintended matches, and flags are passed as a second argument.