jquery-ujs
Advanced tools
Comparing version 1.2.2 to 1.2.3
{ | ||
"name": "jquery-ujs", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Unobtrusive scripting adapter for jQuery", | ||
@@ -23,5 +23,5 @@ "main": "src/rails.js", | ||
"homepage": "https://github.com/rails/jquery-ujs#readme", | ||
"dependencies": { | ||
"peerDependencies": { | ||
"jquery": ">=1.8.0" | ||
} | ||
} |
@@ -50,2 +50,17 @@ Unobtrusive scripting adapter for jQuery | ||
Installation using Rails and Webpacker | ||
------------ | ||
If you're using [webpacker](https://github.com/rails/webpacker) (introduced in [Rails 5.1](http://edgeguides.rubyonrails.org/5_1_release_notes.html#optional-webpack-support)) to manage JavaScript assets, then you can add the jquery-ujs npm package to your project using the [yarn](https://yarnpkg.com/en/) CLI. | ||
``` | ||
$ yarn add jquery-ujs | ||
``` | ||
Then, from any of your included files (e.g. `app/javascript/packs/application.js`, or from a JavaScript file imported by such a pack), you need only import the package for jquery-ujs to be initialized: | ||
```js | ||
import {} from 'jquery-ujs' | ||
``` | ||
Installation using Bower | ||
@@ -52,0 +67,0 @@ ------------ |
@@ -1,2 +0,2 @@ | ||
(function($, undefined) { | ||
/* jshint node: true */ | ||
@@ -13,6 +13,9 @@ /** | ||
(function() { | ||
'use strict'; | ||
var jqueryUjsInit = function($, undefined) { | ||
// Cut down on the number of issues from people inadvertently including jquery_ujs twice | ||
// by detecting and raising an error when it happens. | ||
'use strict'; | ||
if ( $.rails !== undefined ) { | ||
@@ -37,6 +40,6 @@ $.error('jquery-ujs has already been loaded!'); | ||
// Form elements bound by jquery-ujs | ||
formSubmitSelector: 'form', | ||
formSubmitSelector: 'form:not([data-turbo=true])', | ||
// Form input elements bound by jquery-ujs | ||
formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])', | ||
formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])', | ||
@@ -377,3 +380,3 @@ // Form input elements disabled during form submission | ||
element.bind('click.railsDisable', function(e) { // prevent further clicking | ||
element.on('click.railsDisable', function(e) { // prevent further clicking | ||
return rails.stopEverything(e); | ||
@@ -390,3 +393,3 @@ }); | ||
} | ||
element.unbind('click.railsDisable'); // enable element | ||
element.off('click.railsDisable'); // enable element | ||
element.removeData('ujs:disabled'); | ||
@@ -559,2 +562,9 @@ } | ||
})( jQuery ); | ||
}; | ||
if (window.jQuery) { | ||
jqueryUjsInit(jQuery); | ||
} else if (typeof exports === 'object' && typeof module === 'object') { | ||
module.exports = jqueryUjsInit; | ||
} | ||
})(); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
37027
486
102
1
9
- Removedjquery@>=1.8.0