jquery-migrate-rails 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +1 -0
- data/jquery-migrate-rails.gemspec +19 -0
- data/lib/jquery-migrate-rails.rb +10 -0
- data/lib/jquery-migrate-rails/engine.rb +8 -0
- data/lib/jquery-migrate-rails/version.rb +7 -0
- data/vendor/assets/javascripts/jquery-migrate-1.0.0.js +498 -0
- data/vendor/assets/javascripts/jquery-migrate-1.0.0.min.js +3 -0
- metadata +56 -0
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 krishnasrihari
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Jquery::Migrate::Rails
|
2
|
+
|
3
|
+
Include jQuery migrate for Rails project
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'jquery-migrate-rails'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install jquery-migrate-rails
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
Add jquery migrate rails to app/assets/javascripts/application.js:
|
21
|
+
|
22
|
+
Include it after the jquery as below
|
23
|
+
|
24
|
+
//= require jquery
|
25
|
+
//= require jquery-migrate-min
|
26
|
+
|
27
|
+
|
28
|
+
===Reference
|
29
|
+
* jQuery upgrade: http://jquery.com/upgrade-guide/1.9/
|
30
|
+
* jQuery migrate: https://github.com/jquery/jquery-migrate
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
1. Fork it
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jquery-migrate-rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "jquery-migrate-rails"
|
8
|
+
gem.version = Jquery::Migrate::Rails::VERSION
|
9
|
+
gem.authors = ["krishnasrihari"]
|
10
|
+
gem.email = ["krishna.srihari@gmail.com"]
|
11
|
+
gem.description = %q{jQuery migrate for rails application}
|
12
|
+
gem.summary = %q{jQuery migrate rails}
|
13
|
+
gem.homepage = "https://github.com/krishnasrihari/jquery-migrate-rails"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
@@ -0,0 +1,498 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery Migrate - v1.0.0 - 2013-01-14
|
3
|
+
* https://github.com/jquery/jquery-migrate
|
4
|
+
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
|
5
|
+
*/
|
6
|
+
(function( jQuery, window, undefined ) {
|
7
|
+
"use strict";
|
8
|
+
|
9
|
+
|
10
|
+
var warnedAbout = {};
|
11
|
+
|
12
|
+
// List of warnings already given; public read only
|
13
|
+
jQuery.migrateWarnings = [];
|
14
|
+
|
15
|
+
// Set to true to prevent console output; migrateWarnings still maintained
|
16
|
+
// jQuery.migrateMute = false;
|
17
|
+
|
18
|
+
// Forget any warnings we've already given; public
|
19
|
+
jQuery.migrateReset = function() {
|
20
|
+
warnedAbout = {};
|
21
|
+
jQuery.migrateWarnings.length = 0;
|
22
|
+
};
|
23
|
+
|
24
|
+
function migrateWarn( msg) {
|
25
|
+
if ( !warnedAbout[ msg ] ) {
|
26
|
+
warnedAbout[ msg ] = true;
|
27
|
+
jQuery.migrateWarnings.push( msg );
|
28
|
+
if ( window.console && console.warn && !jQuery.migrateMute ) {
|
29
|
+
console.warn( "JQMIGRATE: " + msg );
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
function migrateWarnProp( obj, prop, value, msg ) {
|
35
|
+
if ( Object.defineProperty ) {
|
36
|
+
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
37
|
+
// allow property to be overwritten in case some other plugin wants it
|
38
|
+
try {
|
39
|
+
Object.defineProperty( obj, prop, {
|
40
|
+
configurable: true,
|
41
|
+
enumerable: true,
|
42
|
+
get: function() {
|
43
|
+
migrateWarn( msg );
|
44
|
+
return value;
|
45
|
+
},
|
46
|
+
set: function( newValue ) {
|
47
|
+
migrateWarn( msg );
|
48
|
+
value = newValue;
|
49
|
+
}
|
50
|
+
});
|
51
|
+
return;
|
52
|
+
} catch( err ) {
|
53
|
+
// IE8 is a dope about Object.defineProperty, can't warn there
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
// Non-ES5 (or broken) browser; just set the property
|
58
|
+
jQuery._definePropertyBroken = true;
|
59
|
+
obj[ prop ] = value;
|
60
|
+
}
|
61
|
+
|
62
|
+
if ( document.compatMode === "BackCompat" ) {
|
63
|
+
// jQuery has never supported or tested Quirks Mode
|
64
|
+
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
var attrFn = {},
|
69
|
+
attr = jQuery.attr,
|
70
|
+
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
71
|
+
function() { return null; },
|
72
|
+
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
73
|
+
function() { return undefined; },
|
74
|
+
rnoType = /^(?:input|button)$/i,
|
75
|
+
rnoAttrNodeType = /^[238]$/,
|
76
|
+
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
77
|
+
ruseDefault = /^(?:checked|selected)$/i;
|
78
|
+
|
79
|
+
// jQuery.attrFn
|
80
|
+
migrateWarnProp( jQuery, "attrFn", attrFn, "jQuery.attrFn is deprecated" );
|
81
|
+
|
82
|
+
jQuery.attr = function( elem, name, value, pass ) {
|
83
|
+
var lowerName = name.toLowerCase(),
|
84
|
+
nType = elem && elem.nodeType;
|
85
|
+
|
86
|
+
if ( pass ) {
|
87
|
+
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
88
|
+
if ( elem && !rnoAttrNodeType.test( nType ) && jQuery.isFunction( jQuery.fn[ name ] ) ) {
|
89
|
+
return jQuery( elem )[ name ]( value );
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
// Warn if user tries to set `type` since it breaks on IE 6/7/8
|
94
|
+
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) ) {
|
95
|
+
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
96
|
+
}
|
97
|
+
|
98
|
+
// Restore boolHook for boolean property/attribute synchronization
|
99
|
+
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
100
|
+
jQuery.attrHooks[ lowerName ] = {
|
101
|
+
get: function( elem, name ) {
|
102
|
+
// Align boolean attributes with corresponding properties
|
103
|
+
// Fall back to attribute presence where some booleans are not supported
|
104
|
+
var attrNode,
|
105
|
+
property = jQuery.prop( elem, name );
|
106
|
+
return property === true || typeof property !== "boolean" &&
|
107
|
+
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
108
|
+
|
109
|
+
name.toLowerCase() :
|
110
|
+
undefined;
|
111
|
+
},
|
112
|
+
set: function( elem, value, name ) {
|
113
|
+
var propName;
|
114
|
+
if ( value === false ) {
|
115
|
+
// Remove boolean attributes when set to false
|
116
|
+
jQuery.removeAttr( elem, name );
|
117
|
+
} else {
|
118
|
+
// value is true since we know at this point it's type boolean and not false
|
119
|
+
// Set boolean attributes to the same name and set the DOM property
|
120
|
+
propName = jQuery.propFix[ name ] || name;
|
121
|
+
if ( propName in elem ) {
|
122
|
+
// Only set the IDL specifically if it already exists on the element
|
123
|
+
elem[ propName ] = true;
|
124
|
+
}
|
125
|
+
|
126
|
+
elem.setAttribute( name, name.toLowerCase() );
|
127
|
+
}
|
128
|
+
return name;
|
129
|
+
}
|
130
|
+
};
|
131
|
+
|
132
|
+
// Warn only for attributes that can remain distinct from their properties post-1.9
|
133
|
+
if ( ruseDefault.test( lowerName ) ) {
|
134
|
+
migrateWarn( "jQuery.fn.attr(" + lowerName + ") may use property instead of attribute" );
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
return attr.call( jQuery, elem, name, value );
|
139
|
+
};
|
140
|
+
|
141
|
+
// attrHooks: value
|
142
|
+
jQuery.attrHooks.value = {
|
143
|
+
get: function( elem, name ) {
|
144
|
+
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
145
|
+
if ( nodeName === "button" ) {
|
146
|
+
return valueAttrGet.apply( this, arguments );
|
147
|
+
}
|
148
|
+
if ( nodeName !== "input" && nodeName !== "option" ) {
|
149
|
+
migrateWarn("property-based jQuery.fn.attr('value') is deprecated");
|
150
|
+
}
|
151
|
+
return name in elem ?
|
152
|
+
elem.value :
|
153
|
+
null;
|
154
|
+
},
|
155
|
+
set: function( elem, value ) {
|
156
|
+
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
157
|
+
if ( nodeName === "button" ) {
|
158
|
+
return valueAttrSet.apply( this, arguments );
|
159
|
+
}
|
160
|
+
if ( nodeName !== "input" && nodeName !== "option" ) {
|
161
|
+
migrateWarn("property-based jQuery.fn.attr('value', val) is deprecated");
|
162
|
+
}
|
163
|
+
// Does not return so that setAttribute is also used
|
164
|
+
elem.value = value;
|
165
|
+
}
|
166
|
+
};
|
167
|
+
|
168
|
+
|
169
|
+
var matched, browser,
|
170
|
+
oldInit = jQuery.fn.init,
|
171
|
+
// Note this does NOT include the # XSS fix from 1.7!
|
172
|
+
rquickExpr = /^(?:.*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;
|
173
|
+
|
174
|
+
// $(html) "looks like html" rule change
|
175
|
+
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
176
|
+
var match;
|
177
|
+
|
178
|
+
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
179
|
+
(match = rquickExpr.exec( selector )) && match[1] ) {
|
180
|
+
// This is an HTML string according to the "old" rules; is it still?
|
181
|
+
if ( selector.charAt( 0 ) !== "<" ) {
|
182
|
+
migrateWarn("$(html) HTML strings must start with '<' character");
|
183
|
+
}
|
184
|
+
// Now process using loose rules; let pre-1.8 play too
|
185
|
+
if ( context && context.context ) {
|
186
|
+
// jQuery object as context; parseHTML expects a DOM object
|
187
|
+
context = context.context;
|
188
|
+
}
|
189
|
+
if ( jQuery.parseHTML ) {
|
190
|
+
return oldInit.call( this, jQuery.parseHTML( jQuery.trim(selector), context, true ),
|
191
|
+
context, rootjQuery );
|
192
|
+
}
|
193
|
+
}
|
194
|
+
return oldInit.apply( this, arguments );
|
195
|
+
};
|
196
|
+
jQuery.fn.init.prototype = jQuery.fn;
|
197
|
+
|
198
|
+
jQuery.uaMatch = function( ua ) {
|
199
|
+
ua = ua.toLowerCase();
|
200
|
+
|
201
|
+
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
202
|
+
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
203
|
+
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
204
|
+
/(msie) ([\w.]+)/.exec( ua ) ||
|
205
|
+
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
206
|
+
[];
|
207
|
+
|
208
|
+
return {
|
209
|
+
browser: match[ 1 ] || "",
|
210
|
+
version: match[ 2 ] || "0"
|
211
|
+
};
|
212
|
+
};
|
213
|
+
|
214
|
+
matched = jQuery.uaMatch( navigator.userAgent );
|
215
|
+
browser = {};
|
216
|
+
|
217
|
+
if ( matched.browser ) {
|
218
|
+
browser[ matched.browser ] = true;
|
219
|
+
browser.version = matched.version;
|
220
|
+
}
|
221
|
+
|
222
|
+
// Chrome is Webkit, but Webkit is also Safari.
|
223
|
+
if ( browser.chrome ) {
|
224
|
+
browser.webkit = true;
|
225
|
+
} else if ( browser.webkit ) {
|
226
|
+
browser.safari = true;
|
227
|
+
}
|
228
|
+
|
229
|
+
jQuery.browser = browser;
|
230
|
+
|
231
|
+
// Warn if the code tries to get jQuery.browser
|
232
|
+
migrateWarnProp( jQuery, "browser", browser, "jQuery.browser is deprecated" );
|
233
|
+
|
234
|
+
jQuery.sub = function() {
|
235
|
+
function jQuerySub( selector, context ) {
|
236
|
+
return new jQuerySub.fn.init( selector, context );
|
237
|
+
}
|
238
|
+
jQuery.extend( true, jQuerySub, this );
|
239
|
+
jQuerySub.superclass = this;
|
240
|
+
jQuerySub.fn = jQuerySub.prototype = this();
|
241
|
+
jQuerySub.fn.constructor = jQuerySub;
|
242
|
+
jQuerySub.sub = this.sub;
|
243
|
+
jQuerySub.fn.init = function init( selector, context ) {
|
244
|
+
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
245
|
+
context = jQuerySub( context );
|
246
|
+
}
|
247
|
+
|
248
|
+
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
249
|
+
};
|
250
|
+
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
251
|
+
var rootjQuerySub = jQuerySub(document);
|
252
|
+
migrateWarn( "jQuery.sub() is deprecated" );
|
253
|
+
return jQuerySub;
|
254
|
+
};
|
255
|
+
|
256
|
+
|
257
|
+
var oldFnData = jQuery.fn.data;
|
258
|
+
|
259
|
+
jQuery.fn.data = function( name ) {
|
260
|
+
var ret, evt,
|
261
|
+
elem = this[0];
|
262
|
+
|
263
|
+
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
264
|
+
if ( elem && name === "events" && arguments.length === 1 ) {
|
265
|
+
ret = jQuery.data( elem, name );
|
266
|
+
evt = jQuery._data( elem, name );
|
267
|
+
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
268
|
+
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
269
|
+
return evt;
|
270
|
+
}
|
271
|
+
}
|
272
|
+
return oldFnData.apply( this, arguments );
|
273
|
+
};
|
274
|
+
|
275
|
+
|
276
|
+
var rscriptType = /\/(java|ecma)script/i,
|
277
|
+
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
|
278
|
+
oldFragment = jQuery.buildFragment;
|
279
|
+
|
280
|
+
jQuery.fn.andSelf = function() {
|
281
|
+
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
282
|
+
return oldSelf.apply( this, arguments );
|
283
|
+
};
|
284
|
+
|
285
|
+
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
286
|
+
if ( !jQuery.clean ) {
|
287
|
+
jQuery.clean = function( elems, context, fragment, scripts ) {
|
288
|
+
// Set context per 1.8 logic
|
289
|
+
context = context || document;
|
290
|
+
context = !context.nodeType && context[0] || context;
|
291
|
+
context = context.ownerDocument || context;
|
292
|
+
|
293
|
+
migrateWarn("jQuery.clean() is deprecated");
|
294
|
+
|
295
|
+
var i, elem, handleScript, jsTags,
|
296
|
+
ret = [];
|
297
|
+
|
298
|
+
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
299
|
+
|
300
|
+
// Complex logic lifted directly from jQuery 1.8
|
301
|
+
if ( fragment ) {
|
302
|
+
// Special handling of each script element
|
303
|
+
handleScript = function( elem ) {
|
304
|
+
// Check if we consider it executable
|
305
|
+
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
306
|
+
// Detach the script and store it in the scripts array (if provided) or the fragment
|
307
|
+
// Return truthy to indicate that it has been handled
|
308
|
+
return scripts ?
|
309
|
+
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
310
|
+
fragment.appendChild( elem );
|
311
|
+
}
|
312
|
+
};
|
313
|
+
|
314
|
+
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
315
|
+
// Check if we're done after handling an executable script
|
316
|
+
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
317
|
+
// Append to fragment and handle embedded scripts
|
318
|
+
fragment.appendChild( elem );
|
319
|
+
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
320
|
+
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
321
|
+
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
322
|
+
|
323
|
+
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
324
|
+
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
325
|
+
i += jsTags.length;
|
326
|
+
}
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
return ret;
|
332
|
+
};
|
333
|
+
}
|
334
|
+
|
335
|
+
jQuery.buildFragment = function( elems, context, scripts, selection ) {
|
336
|
+
var ret,
|
337
|
+
warning = "jQuery.buildFragment() is deprecated";
|
338
|
+
|
339
|
+
// Set context per 1.8 logic
|
340
|
+
context = context || document;
|
341
|
+
context = !context.nodeType && context[0] || context;
|
342
|
+
context = context.ownerDocument || context;
|
343
|
+
|
344
|
+
try {
|
345
|
+
ret = oldFragment.call( jQuery, elems, context, scripts, selection );
|
346
|
+
|
347
|
+
// jQuery < 1.8 required arrayish context; jQuery 1.9 fails on it
|
348
|
+
} catch( x ) {
|
349
|
+
ret = oldFragment.call( jQuery, elems, context.nodeType ? [ context ] : context[ 0 ], scripts, selection );
|
350
|
+
|
351
|
+
// Success from tweaking context means buildFragment was called by the user
|
352
|
+
migrateWarn( warning );
|
353
|
+
}
|
354
|
+
|
355
|
+
// jQuery < 1.9 returned an object instead of the fragment itself
|
356
|
+
if ( !ret.fragment ) {
|
357
|
+
migrateWarnProp( ret, "fragment", ret, warning );
|
358
|
+
migrateWarnProp( ret, "cacheable", false, warning );
|
359
|
+
}
|
360
|
+
|
361
|
+
return ret;
|
362
|
+
};
|
363
|
+
|
364
|
+
var eventAdd = jQuery.event.add,
|
365
|
+
eventRemove = jQuery.event.remove,
|
366
|
+
eventTrigger = jQuery.event.trigger,
|
367
|
+
oldToggle = jQuery.fn.toggle,
|
368
|
+
oldLive = jQuery.fn.live,
|
369
|
+
oldDie = jQuery.fn.die,
|
370
|
+
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
371
|
+
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
372
|
+
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
373
|
+
hoverHack = function( events ) {
|
374
|
+
if ( typeof( events ) != "string" || jQuery.event.special.hover ) {
|
375
|
+
return events;
|
376
|
+
}
|
377
|
+
if ( rhoverHack.test( events ) ) {
|
378
|
+
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
379
|
+
}
|
380
|
+
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
381
|
+
};
|
382
|
+
|
383
|
+
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
384
|
+
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
385
|
+
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
386
|
+
}
|
387
|
+
|
388
|
+
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
389
|
+
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
390
|
+
|
391
|
+
// Support for 'hover' pseudo-event and ajax event warnings
|
392
|
+
jQuery.event.add = function( elem, types, handler, data, selector ){
|
393
|
+
if ( elem !== document && rajaxEvent.test( types ) ) {
|
394
|
+
migrateWarn( "AJAX events should be attached to document: " + types );
|
395
|
+
}
|
396
|
+
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
397
|
+
};
|
398
|
+
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
399
|
+
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
400
|
+
};
|
401
|
+
|
402
|
+
jQuery.fn.error = function() {
|
403
|
+
var args = Array.prototype.slice.call( arguments, 0);
|
404
|
+
migrateWarn("jQuery.fn.error() is deprecated");
|
405
|
+
args.splice( 0, 0, "error" );
|
406
|
+
if ( arguments.length ) {
|
407
|
+
return this.bind.apply( this, args );
|
408
|
+
}
|
409
|
+
// error event should not bubble to window, although it does pre-1.7
|
410
|
+
this.triggerHandler.apply( this, args );
|
411
|
+
return this;
|
412
|
+
};
|
413
|
+
|
414
|
+
jQuery.fn.toggle = function( fn, fn2 ) {
|
415
|
+
|
416
|
+
// Don't mess with animation or css toggles
|
417
|
+
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
418
|
+
return oldToggle.apply( this, arguments );
|
419
|
+
}
|
420
|
+
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
421
|
+
|
422
|
+
// Save reference to arguments for access in closure
|
423
|
+
var args = arguments,
|
424
|
+
guid = fn.guid || jQuery.guid++,
|
425
|
+
i = 0,
|
426
|
+
toggler = function( event ) {
|
427
|
+
// Figure out which function to execute
|
428
|
+
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
429
|
+
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
430
|
+
|
431
|
+
// Make sure that clicks stop
|
432
|
+
event.preventDefault();
|
433
|
+
|
434
|
+
// and execute the function
|
435
|
+
return args[ lastToggle ].apply( this, arguments ) || false;
|
436
|
+
};
|
437
|
+
|
438
|
+
// link all the functions, so any of them can unbind this click handler
|
439
|
+
toggler.guid = guid;
|
440
|
+
while ( i < args.length ) {
|
441
|
+
args[ i++ ].guid = guid;
|
442
|
+
}
|
443
|
+
|
444
|
+
return this.click( toggler );
|
445
|
+
};
|
446
|
+
|
447
|
+
jQuery.fn.live = function( types, data, fn ) {
|
448
|
+
migrateWarn("jQuery.fn.live() is deprecated");
|
449
|
+
if ( oldLive ) {
|
450
|
+
return oldLive.apply( this, arguments );
|
451
|
+
}
|
452
|
+
jQuery( this.context ).on( types, this.selector, data, fn );
|
453
|
+
return this;
|
454
|
+
};
|
455
|
+
|
456
|
+
jQuery.fn.die = function( types, fn ) {
|
457
|
+
migrateWarn("jQuery.fn.die() is deprecated");
|
458
|
+
if ( oldDie ) {
|
459
|
+
return oldDie.apply( this, arguments );
|
460
|
+
}
|
461
|
+
jQuery( this.context ).off( types, this.selector || "**", fn );
|
462
|
+
return this;
|
463
|
+
};
|
464
|
+
|
465
|
+
// Turn global events into document-triggered events
|
466
|
+
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
467
|
+
if ( !elem & !rajaxEvent.test( event ) ) {
|
468
|
+
migrateWarn( "Global events are undocumented and deprecated" );
|
469
|
+
}
|
470
|
+
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
471
|
+
};
|
472
|
+
jQuery.each( ajaxEvents.split("|"),
|
473
|
+
function( _, name ) {
|
474
|
+
jQuery.event.special[ name ] = {
|
475
|
+
setup: function() {
|
476
|
+
var elem = this;
|
477
|
+
|
478
|
+
// The document needs no shimming; must be !== for oldIE
|
479
|
+
if ( elem !== document ) {
|
480
|
+
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
481
|
+
jQuery.event.trigger( name, null, elem, true );
|
482
|
+
});
|
483
|
+
jQuery._data( this, name, jQuery.guid++ );
|
484
|
+
}
|
485
|
+
return false;
|
486
|
+
},
|
487
|
+
teardown: function() {
|
488
|
+
if ( this !== document ) {
|
489
|
+
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
490
|
+
}
|
491
|
+
return false;
|
492
|
+
}
|
493
|
+
};
|
494
|
+
}
|
495
|
+
);
|
496
|
+
|
497
|
+
|
498
|
+
})( jQuery, window );
|
@@ -0,0 +1,3 @@
|
|
1
|
+
/*! jQuery Migrate v1.0.0 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */
|
2
|
+
jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){"use strict";function r(n){o[n]||(o[n]=!0,e.migrateWarnings.push(n),t.console&&console.warn&&!e.migrateMute&&console.warn("JQMIGRATE: "+n))}function a(t,a,o,i){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(i),o},set:function(e){r(i),o=e}}),n}catch(u){}e._definePropertyBroken=!0,t[a]=o}var o={};e.migrateWarnings=[],e.migrateReset=function(){o={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var i={},u=e.attr,s=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},d=/^(?:input|button)$/i,l=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",i,"jQuery.attrFn is deprecated"),e.attr=function(t,a,o,i){var s=a.toLowerCase(),c=t&&t.nodeType;return i&&(r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!l.test(c)&&e.isFunction(e.fn[a]))?e(t)[a](o):("type"===a&&o!==n&&d.test(t.nodeName)&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[s]&&p.test(s)&&(e.attrHooks[s]={get:function(t,r){var a,o=e.prop(t,r);return o===!0||"boolean"!=typeof o&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(s)&&r("jQuery.fn.attr("+s+") may use property instead of attribute")),u.call(e,t,a,o))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?s.apply(this,arguments):("input"!==n&&"option"!==n&&r("property-based jQuery.fn.attr('value') is deprecated"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("property-based jQuery.fn.attr('value', val) is deprecated"),e.value=t,n)}};var g,h,m=e.fn.init,v=/^(?:.*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;e.fn.init=function(t,n,a){var o;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(o=v.exec(t))&&o[1]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),n&&n.context&&(n=n.context),e.parseHTML)?m.call(this,e.parseHTML(e.trim(t),n,!0),n,a):m.apply(this,arguments)},e.fn.init.prototype=e.fn,e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h,a(e,"browser",h,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t};var y=e.fn.data;e.fn.data=function(t){var a,o,i=this[0];return!i||"events"!==t||1!==arguments.length||(a=e.data(i,t),o=e._data(i,t),a!==n&&a!==o||o===n)?y.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),o)};var b=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack,j=e.buildFragment;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,o,i){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var u,s,c,d,l=[];if(e.merge(l,e.buildFragment(t,a).childNodes),o)for(c=function(e){return!e.type||b.test(e.type)?i?i.push(e.parentNode?e.parentNode.removeChild(e):e):o.appendChild(e):n},u=0;null!=(s=l[u]);u++)e.nodeName(s,"script")&&c(s)||(o.appendChild(s),s.getElementsByTagName!==n&&(d=e.grep(e.merge([],s.getElementsByTagName("script")),c),l.splice.apply(l,[u+1,0].concat(d)),u+=d.length));return l}),e.buildFragment=function(t,n,o,i){var u,s="jQuery.buildFragment() is deprecated";n=n||document,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n;try{u=j.call(e,t,n,o,i)}catch(c){u=j.call(e,t,n.nodeType?[n]:n[0],o,i),r(s)}return u.fragment||(a(u,"fragment",u,s),a(u,"cacheable",!1,s)),u};var Q=e.event.add,x=e.event.remove,k=e.event.trigger,C=e.fn.toggle,N=e.fn.live,T=e.fn.die,H="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",M=RegExp("\\b(?:"+H+")\\b"),F=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(F.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(F,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,o){e!==document&&M.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,o)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return C.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,o=t.guid||e.guid++,i=0,u=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%i;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(u.guid=o;a.length>i;)a[i++].guid=o;return this.click(u)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),N?N.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),T?T.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return!n&!M.test(e)&&r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(H.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window);
|
3
|
+
//@ sourceMappingURL=dist/jquery-migrate.min.map
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-migrate-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- krishnasrihari
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-29 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: jQuery migrate for rails application
|
15
|
+
email:
|
16
|
+
- krishna.srihari@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- jquery-migrate-rails.gemspec
|
27
|
+
- lib/jquery-migrate-rails.rb
|
28
|
+
- lib/jquery-migrate-rails/engine.rb
|
29
|
+
- lib/jquery-migrate-rails/version.rb
|
30
|
+
- vendor/assets/javascripts/jquery-migrate-1.0.0.js
|
31
|
+
- vendor/assets/javascripts/jquery-migrate-1.0.0.min.js
|
32
|
+
homepage: https://github.com/krishnasrihari/jquery-migrate-rails
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.24
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: jQuery migrate rails
|
56
|
+
test_files: []
|