Accessibility: Making non-standard elements interactive
JavaScript-made controls can be mouse-only, leaving keyboard users and screen readers unable to focus or activate them. Use semantic elements, tabindex, ARIA roles, or up-clickable for accessible interaction.
HTTP Client in RubyMine
RubyMine’s built-in HTTP client tests web APIs from .http scratch files, supports sequential requests, and can reuse response data with JavaScript variables.
You should be using the Web Animations API
Browser support is strong for the Web Animations API, which lets JavaScript animate DOM elements and await or cancel CSS transitions and animations.
Ensure passing Jasmine specs from your Ruby E2E tests
Run Jasmine specs through Rails E2E tests to catch JavaScript failures in regular test runs and verify the runner finishes with all specs passing.
Webpack: How to split your bundles
Large JavaScript libraries can bloat the main bundle; import() lets webpack load them asynchronously and keep rarely used code out of the initial payload.
Firefox cancels any JavaScript events at a fieldset[disabled]
Events from controls inside a disabled fieldset stop bubbling in Firefox, unlike Chrome and IE/Edge, which can break document-level listeners and delegated handlers.
JavaScript without jQuery
Moving away from jQuery improves performance, reduces bundle size, and aligns with the modern web platform. Native DOM APIs and polyfills now cover most common needs.
Ruby: Retrieving and processing files via Selenium and JavaScript
Selenium can fetch binary files through JavaScript and return them to Ruby as an array, useful when direct downloads are awkward or blocked.
Preventing users from uploading malicious content
Uploaded HTML or SVG can execute JavaScript and steal session cookies; safer uploads rely on extension allowlists, strict CSP, attachment disposition, or octet-stream delivery.
JavaScript: Sharing content with the native share dialog
Native share dialogs on mobile and desktop let users hand off links, text, and titles to installed apps; navigator.share works only on HTTPS pages.
Terser is good at minifying JavaScript
Terser compresses JavaScript aggressively, merging branches, inlining small functions, and folding constants to cut output size further than expected.
esbuild: Compressing JavaScript harder with Terser
Terser can shrink JavaScript bundles further than esbuild's minifier, at the cost of noticeably longer build times.
Exchange messages between Javascript and Flash
Flash movies can exchange data with JavaScript in the same page, with ExternalInterface as the preferred bridge and fscommand or SetVariable() as legacy options.
Integrating ESLint
JavaScript linting catches style and quality issues early, with a flat config, RSpec check, and gradual cleanup of existing offenses.
Does <html> or <body> scroll the page?
Main viewport scrolling in browsers varies between html and body, affecting scrollTop and overflow handling in CSS and JavaScript.
Tasks, microtasks, queues and schedules - JakeArchibald.com
JavaScript timeout and promise callbacks can run out of queue order because tasks and microtasks follow different scheduling rules.
Improving browser rendering performance
Web apps feel sluggish when JavaScript, layout, or repaints miss the 16 ms frame budget; Chrome DevTools and requestAnimationFrame() help diagnose and reduce jank.
Triggering JavaScript when an element is clicked
Clickable actions often rely on anchor or div hacks that break accessibility or CSP. A native button provides keyboard support, screen-reader semantics, and safer JavaScript triggers.
Using attribute event handlers with a strict Content Security Policy (CSP)
Inline event handlers and javascript: links are blocked by a strict CSP; script-src-attr hashes can re-enable specific handlers while keeping other inline script disabled.
Use <input type="number"> for numeric form fields
Numeric form fields on mobile get digit-focused keyboards, locale-aware decimal display, and consistent point-based values in JavaScript and form submission.
Getter and setter functions for JavaScript properties
Property access can trigger custom logic in JavaScript, enabling virtual fields like fullName and read/write synchronization without explicit function calls.
How to add esbuild to the rails asset pipeline
Migrating a Rails app from Sprockets-only asset handling to esbuild adds modern JavaScript bundling and can surface path, font, and Sass compatibility issues.
Using regular expressions in JavaScript
Regular expressions in JavaScript use RegExp objects or regex literals, and global matches keep state between test() calls.
How to accept or deny JavaScript confirmation dialogs in Capybara/Selenium
JavaScript confirmation dialogs in Capybara/Selenium can block tests or auto-dismiss unexpectedly. Direct alert handling restores accept, dismiss, and text access.