Socket
Socket
Sign inDemoInstall

jquery-ujs

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.2

2

bower.json

@@ -8,3 +8,3 @@ {

"license": "MIT",
"version": "1.0.0",
"version": "1.0.2",
"dependencies": {

@@ -11,0 +11,0 @@ "jquery": ">1.8.*"

@@ -1,45 +0,19 @@

CHANGELOG
=========
## v1.0.2
Here is a non-exhaustive list of notable changes to jquery-ujs (oldest
to newest):
* Re-enables buttons and links after going back through the `pageshow` event.
- [`085d910a5ec07b69`](https://github.com/rails/jquery-ujs/commit/085d910a5ec07b69f31beabce286141aa26f3005) last version before callback names updated
- [`72d875a8d57c6bb4`](https://github.com/rails/jquery-ujs/commit/72d875a8d57c6bb466170980a5142c66ac74e8f0) callback name updates completed
- [`e076121248913143`](https://github.com/rails/jquery-ujs/commit/e0761212489131437402a92fa8f548a78f685ae2) dropped support for jQuery 1.4, 1.4.1, 1.4.2 (separate [v1.4 branch](https://github.com/rails/jquery-ujs/commits/v1.4) created)
- [`498b35e24cdb14f2`](https://github.com/rails/jquery-ujs/commit/498b35e24cdb14f2d94486e8a1f4a1f661091426) last version before `.callRemote()` removed
- [`ec96408a746d3b06`](https://github.com/rails/jquery-ujs/commit/ec96408a746d3b0692da9249f218a3943fbffc28) `ACCEPTS` header data-type default changed to prefer `:js` but not require it
- [`fc639928d1e15c88`](https://github.com/rails/jquery-ujs/commit/fc639928d1e15c885b85de5b517346db7f963f44) default form method changed from `POST` to `GET`
- [`e9311550fdb3afeb`](https://github.com/rails/jquery-ujs/commit/e9311550fdb3afeb2917bcb1fef39767bf715003) added CSRF Protection to remote requests
- [`a284dd706e7d76e8`](https://github.com/rails/jquery-ujs/commit/a284dd706e7d76e85471ef39ab3efdf07feef374) CSRF fixed - changed to only add if token is present
- [`f9b21b3a3c7c4684`](https://github.com/rails/jquery-ujs/commit/f9b21b3a3c7c46840fed8127a90def26911fad3d) `ajax:before` added back
- [`7f2acc1811f62877`](https://github.com/rails/jquery-ujs/commit/7f2acc1811f62877611e16451530728b5e13dbe7) last version before file-upload aborting behavior added
- [`ca575e184e93b3ef`](https://github.com/rails/jquery-ujs/commit/ca575e184e93b3efe1a858cf598f8a37f0a760cc) added `ajax:aborted:required` and `ajax:aborted:file` event hooks
- [`d2abd6f9df4e4a42`](https://github.com/rails/jquery-ujs/commit/d2abd6f9df4e4a426c17c218b7d5e05004c768d0) fixed submit and bubbling behavior for IE
- [`d59144177d867908`](https://github.com/rails/jquery-ujs/commit/d59144177d86790891fdb99b0e3437312e04fda2) created external api via `$.rails` object
- [`cd357e492de14747`](https://github.com/rails/jquery-ujs/commit/cd357e492de147472a8a2524575acce5d923e640) added support for jQuery 1.6 and dropped support for jQuery 1.4.3
- [`50c06dcc02c1b08c`](https://github.com/rails/jquery-ujs/commit/50c06dcc02c1b08cb7a9b4b8eced54ed685c1c93) added `confirm:complete` event hook which is passed result from confirm dialog
- [`8063d1d47ea6a08e`](https://github.com/rails/jquery-ujs/commit/8063d1d47ea6a08e545e9a6ba3e84af584200e41) made $.rails.confirm and $.rails.ajax functions available in $.rails object
- [`a96c4e9b074998c6`](https://github.com/rails/jquery-ujs/commit/a96c4e9b074998c6b6d102e4573b81c8a76f07a7) added support for jQuery 1.6.1
- [`dad6982dc5926866`](https://github.com/rails/jquery-ujs/commit/dad6982dc592686677e6845e681233c40d2ead27) added support for `data-params` attribute on remote links
- [`5433841d01622345`](https://github.com/rails/jquery-ujs/commit/5433841d01622345f734f22f82394ac035c2f783) removed support for jQuery 1.4.4 and 1.5.x, and added support for jQuery 1.6.2
- [`cd619df9f0daad33`](https://github.com/rails/jquery-ujs/commit/cd619df9f0daad3303aacd4f992fff19158b1e5d) added support for html5 `novalidate` attribute, so required fields validation is not enforced
- [`840ab6ac76b2d5ab`](https://github.com/rails/jquery-ujs/commit/840ab6ac76b2d5ab931841bc3d8567e5b57f183e) added support for jQuery 1.6.3
- [`ba5808e73111fb65`](https://github.com/rails/jquery-ujs/commit/ba5808e73111fb65e91610b078577bb014d9b6d8) added `data-remote` support for checkboxes
- [`6e9a06d45eaf2da1`](https://github.com/rails/jquery-ujs/commit/6e9a06d45eaf2da1036d4c2ead25ff57d0127d03) added `data-disable-with` support for links
- [`89396108ce574080`](https://github.com/rails/jquery-ujs/commit/89396108ce574080f9b877cad74573c5d1ae9aa2) added `data-remote` support for all input types
- [`c01215c3d48ebb9f`](https://github.com/rails/jquery-ujs/commit/c01215c3d48ebb9f9f1059f26efa0c0c9092da2b) added support for jQuery 1.6.4
- [`17f4004310b6ece3`](https://github.com/rails/jquery-ujs/commit/17f4004310b6ece3cb240914932b4d6d46032c24) added support for jQuery 1.7
- [`cb54ae287f5c7320`](https://github.com/rails/jquery-ujs/commit/cb54ae287f5c73207aef2891cdf22212aea5fb86) added support for jQuery 1.7.1
- [`dbb1b5f72a62e59f`](https://github.com/rails/jquery-ujs/commit/dbb1b5f72a62e59f34f6b5be4bee291ee7f3318f) added support for jQuery 1.7.2
- [`8100cf3b2462f144`](https://github.com/rails/jquery-ujs/commit/8100cf3b2462f144e6a0bcef7cb78d05be41755d) created `rails:attachBindings` to allow for customization of
$.rails object settings
- [`e4ca2045b202cd7a`](https://github.com/rails/jquery-ujs/commit/e4ca2045b202cd7ade97d78c20caa2822c5c28da) created `ajax:send` event to provide access to jqXHR object from
ajax requests
- [`4382f580766fcdd1`](https://github.com/rails/jquery-ujs/commit/4382f580766fcdd14201c204f43ca5aeb0928501) added support for `data-with-credentials`
- [`12da9fc2f175c8e4`](https://github.com/rails/jquery-ujs/commit/12da9fc2f175c8e445413b15cf6b685deb271d6e) added support for jQuery 1.8.0, removed support for jquery 1.6.x
- [`faeb0ad734ff6867`](https://github.com/rails/jquery-ujs/commit/faeb0ad734ff6867149b8522f9a29081734442e6) added support for jQuery 1.8.1
- [`b6dae4ef4a2d031a`](https://github.com/rails/jquery-ujs/commit/b6dae4ef4a2d031a222627c7f6a4284602f99160) added support for jQuery 1.8.2
- [`6927b82cadf3146c`](https://github.com/rails/jquery-ujs/commit/6927b82cadf3146c2b9ae3028e9b197af64011ca) added support for jQuery 1.8.3
- [`cc356656cc3edf15`](https://github.com/rails/jquery-ujs/commit/cc356656cc3edf1596fd685265187d2f75d1bc7c) added support for jQuery 1.9.0
- [`2f8ccdf26eac199a`](https://github.com/rails/jquery-ujs/commit/2f8ccdf26eac199a11aa1a893a8909bb4650d0fb) added support for jQuery 1.9.1
*Gabriel Sobrinho*
## v1.0.1
* `confirm` is no longer called twice for `button` elements inside a `form`.
*Lucas Mazza*
* `button` or submit inputs using the `form` attribute are properly bound.
*Marnen Laibow-Koser*
## v1.0.0
* First tagged release.
{
"name": "jquery-ujs",
"version": "1.0.0",
"version": "1.0.2",
"description": "Ruby on Rails unobtrusive scripting adapter for jQuery",

@@ -13,3 +13,2 @@ "main": "src/rails.js",

},
"author": "Stephen St. Martin",
"contributors": [

@@ -16,0 +15,0 @@ "Stephen St. Martin",

@@ -23,3 +23,3 @@ Unobtrusive scripting adapter for jQuery

Installation
Installation using the jquery-rails gem
------------

@@ -30,3 +30,3 @@

```ruby
gem 'jquery-rails', '~> 2.1'
gem 'jquery-rails'
```

@@ -36,8 +36,8 @@

$ bundle install
```shell
$ bundle install
```
This next step depends on your version of Rails.
Require both `jquery` and `jquery_ujs` into your application.js manifest.
a. For Rails 3.1, add these lines to the top of your app/assets/javascripts/application.js file:
```javascript

@@ -48,12 +48,17 @@ //= require jquery

b. For Rails 3.0, run this command:
Installation using Bower
------------
*Be sure to get rid of the rails.js file if it exists, and instead use
the new jquery_ujs.js file that gets copied to the public directory.
Choose to overwrite jquery_ujs.js if prompted.*
Run `bower install jquery-ujs --save` to install the jquery-ujs package.
$ rails generate jquery:install
Usage
------------
c. For Rails 2.x and for manual installation follow [this wiki](https://github.com/rails/jquery-ujs/wiki/Manual-installing-and-Rails-2) .
Require both `jquery` and `jquery-ujs` into your application.js manifest.
```javascript
//= require jquery
//= require jquery-ujs
```
How to run tests

@@ -60,0 +65,0 @@ ------------

@@ -28,3 +28,3 @@ (function($, undefined) {

// Button elements bound by jquery-ujs
buttonClickSelector: 'button[data-remote], button[data-confirm]',
buttonClickSelector: 'button[data-remote]:not(form button), button[data-confirm]:not(form button)',

@@ -326,2 +326,25 @@ // Select elements bound by jquery-ujs

// This event works the same as the load event, except that it fires every
// time the page is loaded.
//
// See https://github.com/rails/jquery-ujs/issues/357
// See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching
$(window).on("pageshow.rails", function () {
$($.rails.enableSelector).each(function () {
var element = $(this);
if (element.data("ujs:enable-with")) {
$.rails.enableFormElement(element);
}
});
$($.rails.linkDisableSelector).each(function () {
var element = $(this);
if (element.data("ujs:enable-with")) {
$.rails.enableElement(element);
}
});
});
$document.delegate(rails.linkDisableSelector, 'ajax:complete', function() {

@@ -353,3 +376,3 @@ rails.enableElement($(this));

} else if (link.data('method')) {
} else if (method) {
rails.handleMethod(link);

@@ -362,2 +385,3 @@ return false;

var button = $(this);
if (!rails.allowAction(button)) return rails.stopEverything(e);

@@ -364,0 +388,0 @@

@@ -226,1 +226,20 @@ module('data-confirm', {

});
asyncTest('a button inside a form only confirms once', 1, function() {
var confirmations = 0;
window.confirm = function(msg) {
confirmations++;
return true;
};
$('#qunit-fixture').append($('<form />').append($('<button />', {
'data-remote': 'true',
'data-confirm': 'Are you absolutely sure?',
text: 'Click me'
})));
$('form > button[data-confirm]').trigger('click');
ok(confirmations === 1, 'confirmation counter should be 1, but it was ' + confirmations);
start();
});

@@ -102,2 +102,20 @@ module('data-disable-with', {

test('form input[type=submit][data-disable-with] re-enables when `pageshow` event is triggered', function(){
var form = $('form:not([data-remote])'), input = form.find('input[type=submit]');
App.checkEnabledState(input, 'Submit');
// Emulate the disabled state without submitting the form at all, what is the
// state after going back on firefox after submitting a form.
//
// See https://github.com/rails/jquery-ujs/issues/357
$.rails.disableFormElements(form);
App.checkDisabledState(input, 'submitting ...');
$(window).trigger('pageshow');
App.checkEnabledState(input, 'Submit');
});
asyncTest('form[data-remote] input[type=submit][data-disable-with] is replaced in ajax callback', 2, function(){

@@ -177,2 +195,14 @@ var form = $('form:not([data-remote])').attr('data-remote', 'true'), origFormContents = form.html();

test('a[data-disable-with] re-enables when `pageshow` event is triggered', function() {
var link = $('a[data-disable-with]');
App.checkEnabledState(link, 'Click me');
link.trigger('click');
App.checkDisabledState(link, 'clicking...');
$(window).trigger('pageshow');
App.checkEnabledState(link, 'Click me');
});
asyncTest('a[data-remote][data-disable-with] disables and re-enables', 6, function() {

@@ -179,0 +209,0 @@ var link = $('a[data-disable-with]').attr('data-remote', true);

@@ -50,3 +50,3 @@ var App = App || {};

if (action.indexOf('iframe') < 0) form.attr('action', action + '?iframe=true')
if (action && action.indexOf('iframe') < 0) form.attr('action', action + '?iframe=true')
form.attr('target', name).append(targetInput);

@@ -53,0 +53,0 @@ $('#qunit-fixture').append(iframe);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc