回答編集履歴
3
2018/05/23 -> 2016/05/23
answer
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
- [jQuery 1.12.4 and 2.2.4 Released | Official jQuery Blog](https://blog.jquery.com/2016/05/20/jquery-1-12-4-and-2-2-4-released/)
|
34
34
|
|
35
|
-
|
35
|
+
2016/05/23当時のドキュメントを読むと、引数省略時の挙動は書いていません。
|
36
36
|
|
37
37
|
- [.load() | jQuery API Documentation](https://web.archive.org/web/20160523044759/https://api.jquery.com/load/)
|
38
38
|
- [.load() | jQuery API Documentation](https://web.archive.org/web/20160525230429/http://api.jquery.com:80/load-event/)
|
2
引用ミスを修正
answer
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
> "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
|
52
52
|
> "change select submit keydown keypress keyup error contextmenu" ).split( " " ),
|
53
53
|
> function( i, name ) {
|
54
|
-
>
|
54
|
+
>
|
55
55
|
> // Handle event binding
|
56
56
|
> jQuery.fn[ name ] = function( data, fn ) {
|
57
57
|
> return arguments.length > 0 ?
|
@@ -74,33 +74,33 @@
|
|
74
74
|
> if ( typeof url !== "string" && _load ) {
|
75
75
|
> return _load.apply( this, arguments );
|
76
76
|
> }
|
77
|
-
>
|
77
|
+
>
|
78
78
|
> var selector, type, response,
|
79
79
|
> self = this,
|
80
80
|
> off = url.indexOf( " " );
|
81
|
-
>
|
81
|
+
>
|
82
82
|
> if ( off > -1 ) {
|
83
83
|
> selector = jQuery.trim( url.slice( off ) );
|
84
84
|
> url = url.slice( 0, off );
|
85
85
|
> }
|
86
|
-
>
|
86
|
+
>
|
87
87
|
> // If it's a function
|
88
88
|
> if ( jQuery.isFunction( params ) ) {
|
89
|
-
>
|
89
|
+
>
|
90
90
|
> // We assume that it's the callback
|
91
91
|
> callback = params;
|
92
92
|
> params = undefined;
|
93
|
-
>
|
93
|
+
>
|
94
94
|
> // Otherwise, build a param string
|
95
95
|
> } else if ( params && typeof params === "object" ) {
|
96
96
|
> type = "POST";
|
97
97
|
> }
|
98
|
-
>
|
98
|
+
>
|
99
99
|
> // If we have elements to modify, make the request
|
100
100
|
> if ( self.length > 0 ) {
|
101
101
|
> jQuery.ajax( {
|
102
102
|
> url: url,
|
103
|
-
>
|
103
|
+
>
|
104
104
|
> // If "type" variable is undefined, then "GET" method will be used.
|
105
105
|
> // Make value of this field explicit since
|
106
106
|
> // user can override it through ajaxSetup method
|
@@ -108,19 +108,19 @@
|
|
108
108
|
> dataType: "html",
|
109
109
|
> data: params
|
110
110
|
> } ).done( function( responseText ) {
|
111
|
-
>
|
111
|
+
>
|
112
112
|
> // Save response for use in complete callback
|
113
113
|
> response = arguments;
|
114
|
-
>
|
114
|
+
>
|
115
115
|
> self.html( selector ?
|
116
|
-
>
|
116
|
+
>
|
117
117
|
> // If a selector was specified, locate the right elements in a dummy div
|
118
118
|
> // Exclude scripts to avoid IE 'Permission Denied' errors
|
119
119
|
> jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
|
120
|
-
>
|
120
|
+
>
|
121
121
|
> // Otherwise use the full result
|
122
122
|
> responseText );
|
123
|
-
>
|
123
|
+
>
|
124
124
|
> // If the request succeeds, this function gets "data", "status", "jqXHR"
|
125
125
|
> // but they are ignored because response was set above.
|
126
126
|
> // If it fails, this function gets "jqXHR", "status", "error"
|
@@ -130,7 +130,7 @@
|
|
130
130
|
> } );
|
131
131
|
> } );
|
132
132
|
> }
|
133
|
-
>
|
133
|
+
>
|
134
134
|
> return this;
|
135
135
|
> };
|
136
136
|
> ```
|
1
コピペミスを修正
answer
CHANGED
@@ -66,10 +66,10 @@
|
|
66
66
|
> ```JavaScript
|
67
67
|
> // Keep a copy of the old load method
|
68
68
|
> var _load = jQuery.fn.load;
|
69
|
-
>
|
69
|
+
>
|
70
70
|
> /**
|
71
71
|
> * Load a url into a page
|
72
|
-
> *
|
72
|
+
> */
|
73
73
|
> jQuery.fn.load = function( url, params, callback ) {
|
74
74
|
> if ( typeof url !== "string" && _load ) {
|
75
75
|
> return _load.apply( this, arguments );
|