In JavaScript we often use Immediately Invoked Function Expessions (or IIFEs) to prevent local variables from bleeding into an outside scope: (function() { var foo = "value"; // foo is scoped to this...
Cucumber scenarios that are tagged with @javascript so they run with Selenium are very slow. You might not want to run them every time. In order to skip all Selenium...
...scenarios, call Cucumber like this: cucumber --tags ~@javascript Note that you should still run all the scenarios, including the Selenium ones, before you push a change...
...Web APIs haven’t provided the functionality to copy text to the clipboard through JavaScript, which is why visiting GitHub with Flash disabled shows an ugly grey box where the...
...and slated to move to release in mid-September, it is becoming available to JavaScript within user-action initiated callbacks...
...following links in your web application faster. Instead of letting the browser recompile the JavaScript and CSS between each page change, it keeps the current page instance alive and replaces...
...you get the bulk of the speed benefits from pjax (no recompiling of the JavaScript or CSS) without having to tailor the server-side response. It just works...
...many ways to achieve this, from SVGs inlined into the HTML, SVGs inlined in CSS, JavaScript-based solutions, to icon fonts. Out of all these options, the tried and true...
...most advantages, since icon fonts are supported everywhere they perform well and require no JavaScript at all their icons align nicely with text their icons automatically inherit color and size...
...below are from Holly. This is the feature that tests Holly's print stylesheet: @javascript Scenario: When printing a tree, the page appears black on white with all controls hidden...
Javascript library for drag'n'drop that seems to have more options than native HTML5 drag'n'drop. They also claim to support "multi-touch", which would be awesome if...
...on touch devices. Another library with similar aims is interact.js (Github). They're pitching JavaScript drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers...
...happening when something else is focused). Instead you should explicitly trigger those events via Javascript. Examples for Capybara: page.execute_script("$('#foo').focus()") page.execute_script("$('#foo').blur()") If this doesn't...
...your test suite accumulates a larger number of Selenium tests (required for today's increasingly Javascript-heavy interfaces), tests will start to flicker more. Appendix Things I hope you never...
Here is a Javascript function reloadUsers() that fetches a HTML snippet from the server using AJAX and replaces the current .users container in the DOM: window.reloadUsers = -> $.get('/users').then (html...
= form.file_field :add_images, class: 'hidden', multiple: true Add Images = gallery_form.submit Javascript Now to the dynamic part. I built it with an Unpoly compiler, but the code...
...any CSS that contains directives like background-image: url(/internal-path/wallpaper.png) will be break Referenced javascripts or stylesheets will probably attempt to load from the wrong URL The solution to this...
...times till it succeeds or a timeout is reached, when we're inside a @javascript feature. You're encouraged to use this for all of your own steps that check...
...will then always fail since we never re-fetch a fresh body. Prevent stray javascript requests between steps and scenarios We're using the gem capybara lockstep for that...
...probably don't want to. [2] If you don't speak CoffeeScript, take this JavaScript: this.app.decorator('$httpBackend', ['$delegate', function($delegate) { return function() { var headers = arguments[4]; var contentType = (headers != null...
...making a vanilla form submission to a hidden and try to wrap a nice Javascript API around this. I found it really hard to make this work reliably.
...a great enhancement when you want users to supply some kind of code (HTML, JavaScript, Ruby, etc). It offers syntax highlighting and some neat features like auto-indenting.
...will find that this is hard to test with Cucumber and Capybara: A non-Javascript Rack::Test scenario will just ignore the host and try to open /some/path in your...
Sometimes modern Javascript projects get out of hand. A major culprit in this can be the messy handling of asynchronous tasks, leading to long, complex, and deeply nested blocks of...
...code. Javascript now provides a new syntax for handling these operations, and it can turn even the most convoluted asynchronous operations into concise and highly readable code...
...real ones. An attacker with control over a victim's browser can simply use JavaScript or web developer tools to retrieve values from those inputs...
position: fixed; top: 0; width: auto; display: none; border: none; margin: 0; } Javascript ;(function($) { $.fn.fixHeader = function() { return this.each(function() { var $table = $(this), $t_fixed; function init() { $t_fixed...
...you can switch between drivers using tags: Feature: The app works with low resolutions @javascript @chrome320x480 Scenario: Visit my profile in low res Given "bart" is a user with the...
...some utility functions for DOM manipulation and traversal in the up.element module. Further reading JavaScript without jQuery (presentation from...
Amazing guide how to divide a ball of Javascript spaghetti distinct separate layers (model, view, controller, backend adapter). It does not use a Javascript framework...
A tooltip library that does not use Javascript. Works in IE9+. This library (or the technique used by it) could be a great choice for projects with a lot of...
...tooltips, which are hard to do fast with Javascript...
This is a demo of the "Tabby" Javascript jQuery plugin to use tabs in regular textareas to make them suitable for in-browser coding of languages like HTML, CSS, Javascript...