Migration from the Asset Pipeline to Webpacker
Moving a Rails app from the Asset Pipeline to Webpacker requires inventorying bundled libraries, repackaging legacy assets, and adjusting deployment for pack-based assets.
Unobtrusive JavaScript helper to progressively enhance HTML
Attach JavaScript behavior to matching HTML elements as they appear in the DOM, with automatic initialization for dynamic content and cleanup on removal.
Guide to localizing a Rails application
Rails app localization affects text, URLs, formats, images, caching, and time zones; estimating effort means checking each layer for language-sensitive behavior.
Managing vendor libraries with the Rails asset pipeline
Rails asset pipeline issues make vendor libraries hard to keep separate; custom asset paths and rewritten font URLs preserve clean library folders and correct references.
Some tips for upgrading Bootstrap from 3 to 4
Migrating a larger Rails app from Bootstrap 3 to 4 often breaks styles, components and helper gems; planning library upgrades and rebuilding variables reduces the pain.
Playing audio in a browser
Browser audio playback is fragmented across Flash and HTML5, with codec, seeking, loading, and styling limitations that often require a hybrid library.
Lazy-loading images
Loading large page images only when they enter the viewport cuts bandwidth use and can improve perceived speed. Missing crawler support and layout shifts remain common issues.
bower-rails can rewrite your relative asset paths
Precompiled CSS breaks relative image and font URLs when asset paths change; bower-rails can rewrite url(...) references into ERB asset helpers before deployment.
How to create giant memory leaks in AngularJS (and other client-side JavaScript)
AngularJS client-side code can steadily accumulate unreclaimed objects until the browser process crashes. Common causes include forgotten listeners, timers, plugins, scopes, and unbounded caches.
Making IE 9 happy
Internet Explorer 9 compatibility can require a jQuery update to 1.5.1, and box shadows may render lighter and slightly offset.
Detecting when fonts are loaded via JavaScript
Webfonts can change layout after first render; detecting readiness avoids wrong measurements. Modern browsers use document.fonts.load, while older support needs font-dimension watching.
Capybara: evaluate_script might freeze your browser
evaluate_script can freeze a browser window for about 10 seconds when it returns complex JavaScript objects; execute_script avoids the costly result conversion.
Manually uploading files via AJAX
Binary file uploads need FormData so AJAX can send multipart payloads from file inputs without manual serialization; older browsers often need a plain form fallback.
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.
Flexible overflow handling with CSS and JavaScript
Truncates one variable-length label while keeping a second label visible on the same line, with a JavaScript fallback for browsers without the needed layout.
High-level Javascript frameworks: Backbone vs. Ember vs. Knockout
High-level MV* JavaScript frameworks reduce DOM boilerplate with client-side rendering, routing, and data binding, but choosing between Backbone, Ember, and Knockout depends on style and needs.
How to quickly inspect an Angular scope in your webkit browser
Chrome and Safari consoles expose the selected DOM node, making Angular scope inspection fast when debugging selected page elements.
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.
Vortrag: Content Security Policy: Eine Einführung
Content Security Policy schützt Webseiten vor XSS, indem der Browser erlaubte Quellen für Skripte, Styles, Bilder und Verbindungen streng einschränkt.
Why your javascripts should be executed after the dom has been loaded
JavaScript that touches the DOM can run too early and fail before elements exist in the parsed tree. Waiting for DOM ready avoids timing bugs and missing nodes.
screenfull.js: Simple wrapper for cross-browser usage of the JavaScript Fullscreen API
Browser fullscreen handling is inconsistent across vendors, forcing boilerplate and event workarounds. screenfull provides a small wrapper for cross-browser fullscreen requests, exit, state, and change events.
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.
Colcade is a lightweight Masonry alternative
Lightweight grid layouting for mixed-size items with smaller footprint and no dependencies; performance is better than Masonry, but column spanning and built-in transitions are missing.
Listening to bubbling events in Prototype is easy
Prototype event handling on individual elements is brittle and breaks after AJAX replacement. Delegated document.on bindings keep change handlers working on dynamic content.