Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit23d5392

Browse files
authored
Ajax: Deprecate AJAX event aliases, inline event/alias into deprecated
A new `src/deprecated` directory makes it possible to exclude some deprecatedAPIs from a custom build when their respective "parent" module is excludedwithout keeping that module outside of the `src/deprecated` directory orthe `src/deprecated.js` file.Closesgh-4572
1 parent865469f commit23d5392

File tree

7 files changed

+50
-52
lines changed

7 files changed

+50
-52
lines changed

‎Gruntfile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ module.exports = function( grunt ) {
5858

5959
// Exclude specified modules if the module matching the key is removed
6060
removeWith:{
61-
ajax:["manipulation/_evalUrl","event/ajax"],
61+
ajax:["manipulation/_evalUrl","deprecated/ajax-event-alias"],
6262
callbacks:["deferred"],
6363
css:["effects","dimensions","offset"],
6464
"css/showHide":["effects"],
6565
deferred:{
6666
remove:["ajax","effects","queue","core/ready"],
6767
include:["core/ready-no-deferred"]
68-
}
68+
},
69+
event:["deprecated/ajax-event-alias","deprecated/event"]
6970
}
7071
}
7172
},

‎README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ Some example modules that can be excluded are:
8686
-**deprecated**: Methods documented as deprecated but not yet removed.
8787
-**dimensions**: The`.width()` and`.height()` methods, including`inner-` and`outer-` variations.
8888
-**effects**: The`.animate()` method and its shorthands such as`.slideUp()` or`.hide("slow")`.
89-
-**event**: The`.on()` and`.off()` methods and all event functionality. Also removes`event/alias`.
90-
-**event/alias**: All event attaching/triggering shorthands like`.click()` or`.mouseover()`.
89+
-**event**: The`.on()` and`.off()` methods and all event functionality.
9190
-**event/trigger**: The`.trigger()` and`.triggerHandler()` methods. Used by the**alias** module.
9291
-**offset**: The`.offset()`,`.position()`,`.offsetParent()`,`.scrollLeft()`, and`.scrollTop()` methods.
9392
-**wrap**: The`.wrap()`,`.wrapAll()`,`.wrapInner()`, and`.unwrap()` methods.
@@ -143,7 +142,7 @@ grunt custom:-css
143142
Exclude a bunch of modules:
144143

145144
```bash
146-
grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-event/alias,-offset,-wrap
145+
grunt custom:-ajax/jsonp,-css,-deprecated,-dimensions,-effects,-offset,-wrap
147146
```
148147

149148
There is also a special alias to generate a build with the same configuration as the official jQuery Slim build is generated:

‎src/deprecated.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,8 @@ import jQuery from "./core.js";
22
importslicefrom"./var/slice.js";
33
importtrimfrom"./var/trim.js";
44

5-
import"./event/alias.js";
6-
7-
jQuery.fn.extend({
8-
9-
bind:function(types,data,fn){
10-
returnthis.on(types,null,data,fn);
11-
},
12-
unbind:function(types,fn){
13-
returnthis.off(types,null,fn);
14-
},
15-
16-
delegate:function(selector,types,data,fn){
17-
returnthis.on(types,selector,data,fn);
18-
},
19-
undelegate:function(selector,types,fn){
20-
21-
// ( namespace ) or ( selector, types [, fn] )
22-
returnarguments.length===1 ?
23-
this.off(selector,"**") :
24-
this.off(types,selector||"**",fn);
25-
}
26-
});
5+
import"./deprecated/ajax-event-alias.js";
6+
import"./deprecated/event.js";
277

288
// Bind a function to a context, optionally partially applying any
299
// arguments.

‎src/event/ajax.jsrenamed to ‎src/deprecated/ajax-event-alias.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
importjQueryfrom"../core.js";
22

3+
import"../ajax.js";
34
import"../event.js";
45

5-
// Attach a bunch of functions for handling common AJAX events
66
jQuery.each([
77
"ajaxStart",
88
"ajaxStop",

‎src/deprecated/event.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
importjQueryfrom"../core.js";
2+
3+
import"../event.js";
4+
import"../event/trigger.js";
5+
6+
jQuery.fn.extend({
7+
8+
bind:function(types,data,fn){
9+
returnthis.on(types,null,data,fn);
10+
},
11+
unbind:function(types,fn){
12+
returnthis.off(types,null,fn);
13+
},
14+
15+
delegate:function(selector,types,data,fn){
16+
returnthis.on(types,selector,data,fn);
17+
},
18+
undelegate:function(selector,types,fn){
19+
20+
// ( namespace ) or ( selector, types [, fn] )
21+
returnarguments.length===1 ?
22+
this.off(selector,"**") :
23+
this.off(types,selector||"**",fn);
24+
},
25+
26+
hover:function(fnOver,fnOut){
27+
returnthis.mouseenter(fnOver).mouseleave(fnOut||fnOver);
28+
}
29+
});
30+
31+
jQuery.each(("blur focus focusin focusout resize scroll click dblclick "+
32+
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+
33+
"change select submit keydown keypress keyup contextmenu").split(" "),
34+
function(_i,name){
35+
36+
// Handle event binding
37+
jQuery.fn[name]=function(data,fn){
38+
returnarguments.length>0 ?
39+
this.on(name,null,data,fn) :
40+
this.trigger(name);
41+
};
42+
});

‎src/event/alias.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎src/jquery.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import "./ajax/jsonp.js";
2424
import"./ajax/load.js";
2525
import"./core/parseXML.js";
2626
import"./core/parseHTML.js";
27-
import"./event/ajax.js";
2827
import"./effects.js";
2928
import"./effects/animatedSelector.js";
3029
import"./offset.js";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp