...browsers that support a given declaration. There is CSS.supports() to do the equivalent in Javascript. backdrop-filter (Edge 17+, but not FF): Applying filters to what is visible through an...
...this, test for the right environment and place the JS-code afterwards: - if Rails.env.production? :javascript var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); _gaq.push(['_trackPageview...
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...
...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...
...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...
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...
...the value of the last expression, it may return DOM nodes: # coffeescript scope.focus = -> element.focus() # javascript scope.focus = function() { return element.focus(); // wheee } If you e.g. use this function like this, the error...
...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...
...acts like Stripe’s and also serves a fake version of Stripe.js, Stripe’s JavaScript library that allows you to collect your customers’ payment information without ever having it touch...
...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...
Service just like Factory, but: instead of a funciton, it receives a Javascript class / a constructor function as argument simplest service type, but also least flexible Value
...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...
...in your PT profile or in ~/.config/geordi/global.yml if you have ever used geordi commit javascript: (function() { var pt_project_id = 'XXX'; var pt_token='XXX'; var url = `https://www.pivotaltracker.com/services/v5/projects/$...
...that you can easily use or replace the theme. Does not come with extra JavaScript; some effects like button click ripples are implemented via CSS. Also check out their other...
...Another concise way to write the statement is this: console.log({ foo, bar }); This uses Javascript's new destructuring syntax and is actually shorthand for: console.log({ foo: foo, bar: bar });
behavior: url(/PIE.htc); background: white; } li.active .content { background: red; } If you now use JavaScript to add the class .active to another li, the contained .content (whose background should have...
...re already using lazysizes, you can use its object-fit polyfill! Usage In your Javascript manifest, require them like this: #= require plugins/object-fit/ls.object-fit #= require lazysizes Now use the mixin below to...
...a correct window. [1] as in: a real browser window, maybe via window.open in JavaScript
We recently migrated a Rails application from yarn to npm. We decided to go this step instead of upgrading to...
Select2 is a fantastic library for advanced dropdown boxes, but it depends on jQuery. Alternatives Tom Select
...this useful when creating responsive designs that work well on small screens. The attached Javascript gives a container different CSS classes (single_line or multiple_lines) depending on whether its...
You can say this in Javascript: