...content of $('#id'). To do the same in Rails 3, include usual rails-ujs JavaScript, and put this into your application.js: $(function() { $('[data-remote][data-replace]') .data('type', 'html')

...replaced event on the link. .unobtrusive version In case you are using our unobtrusive JavaScript helper, use the following code instead: $.unobtrusive(function() { $('[data-remote][data-replace]') .data('type', 'html...

...position receives the click A step which finds and clicks the desired link via javascript may solve the problem: When(/^I search and click on "([^"]*)"$/) do |text| page.execute_script("$(\":contains...

...text}'):not(:has(:contains('#{text}')))\").click()") end Note: "Clicking" via JavaScript might click elements which are actually not clickable, e.g. because a modal overlay covers them. Use with caution.

...best cost-benefit ratio. (Know that this does not detect touch devices, but browsers.) Javascript var isTouchDevice = 'ontouchstart' in window Coffeescript isTouchDevice = 'ontouchstart' of window On the difference between the...

...Javascript and the Coffeescript version, see Beware: Coffeescript "in" is not the Javascript "in...

I had to deal with JavaScript Undefined Error while accessing a specific CKEditor instance to fill in text. Ensure everything is loaded with patiently do page.execute_script("return isCkeditorLoaded('#{selector...

...selector}');").should be_true end html.gsub!(/\n+/, "") # otherwise: unterminated string literal (Selenium::WebDriver::Error::JavascriptError) page.execute_script("CKEDITOR.instances['#{selector}'].setData('#{html}');") end The snippet for JavaScript: function isCkeditorLoaded(instance_selector...

...you want to overwrite inherited methods but call the parent's implementation, too. In JavaScript, there is no simple "super" method like in Ruby -- so here is how to do...

...BaseClass to run as well -- and if you want to call a method in JavaScript, you need to do exactly that. Backbone offers a shortcut that is not too ugly...

...production, non-parallel test run. super end end def fresh? # Stock Webpacker checks if JavaScript changed in app, yarn.lock or config/webpack. # We want to be a bit stricter about freshness...

...assets once before your end-to-end integration test suite. Otherwise the first rendered javascript_pack_tag would start compilation, causing the helper to freeze for a minute and current...

...page, and have Selenium click it: path = "/your/path/here" id = "helper_#{SecureRandom.hex(8)}" execute_script <<-JAVASCRIPT var $helper = $(' ').attr({ href: #{path.to_json}, id: #{id.to_json}, target: '_blank' }); $helper.prependTo('body').text('click...

...me').css({ zIndex: 9999, position: 'absolute' }); setTimeout(function() { $helper.remove() }, 1000); JAVASCRIPT find("##{id}").click Note that the link tag is removed after 1 second. You may or may not want...

end Short explanation: asset_host is used for links to stylesheets and javascripts asset_host belongs to ActionController::Base -- changes are persistent and will not be reset after...

...because we cannot yield out of define_method module InstanceMethods private # Force URLs for JavaScript and Stylesheet links def assets_have_urls old_asset_host = asset_host self.asset_host = HOST...

You are not using javascript tests The file is served from a public folder (not via controller) Problem description If you deliver files from a public folder it might...

...response with content-type "..." Outline How to test file downloads with tests that need javascript. Public served Look at the link of the url and check if this file exists...

You can also tell Unpoly to treat that one link as a vanilla Javascript link...

...page may load without assets. The dev server will detect any changes to your JavaScript and CSS and re-compile automatically. When it is done automatically any browser window showing...

...have a dev server running and call any helper that accesses asset paths (e.g. javascript_pack_tag or image_tag), Rails will compile your entire assets within its process before...

...also namespaces files compiled files inside a pack CSS files are stored inside css, JavaScripts inside js and images inside media If you namespaced your pack's contents like /your-pack-name/images...

...commit messages, add a new link "Commit" to your bookmarks and use the following Javascript as the link URL: javascript:(function() { let storyTitles = []; let stories = Array.from(document.querySelectorAll('.story[data-selected...

stackoverflow.com

...menu for copying and pasting will appear. This can confuse unexperienced users. Use the Javascript hack below to disable text selection on mobile devices: // Deactivating distracting Text Selection:

...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 nice data attribute to the form fields, and look for that in your JavaScript code: document.on('change', '[data-requires-update]', updateThings); If you are interested in the element that...

...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.

makandra dev

...some utility functions for DOM manipulation and traversal in the up.element module. Further reading JavaScript without jQuery (presentation from...

...openTasks = $.find('.task.open', container); Note that Sizzle returns vanilla DOM nodes in a vanilla Javascript array. It does not return jQuery collections...

...will break after modifying the collection like above. The following solution works. It uses JavaScript methods which modify the object in place, thus keeping any extra attributes: var index = element.indexOf...

...mind that the above examples use jQuery. Tweak accordingly if you are using another JavaScript framework...

scope.paragraphs = _.map paragraphs, (lines) -> lines.split('\n') Also see simple_format helper for Javascript...

...this, you simply cannot clone instances of Coffeescript instances as you would clone other Javascript hashes. If you need cloning, you would probably need to implement a clone() method in...

...some kind of pre-processing. You could probably also hack together a solution in JavaScript which downloads the background image file, rewrites the XML string and generates a data: URI...