Skip to content

Commit fe8975a

Browse files
committed
【新增】$.Class() 可声明 抽象实例方法
【修正】多处 IE 兼容性问题
1 parent 4857400 commit fe8975a

File tree

21 files changed

+362
-274
lines changed

21 files changed

+362
-274
lines changed

build/iQuery.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/iQuery.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iQuery.js

Lines changed: 129 additions & 97 deletions
Large diffs are not rendered by default.

jQueryKit.js

Lines changed: 104 additions & 80 deletions
Large diffs are not rendered by default.

source/AJAX/ext/transport.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ define([
3333

3434
iXHR = new HTMLHttpRequest();
3535

36-
iXHR.open(iOption.type, iOption.url);
36+
iXHR.open(iOption.method, iOption.url);
3737

3838
iXHR.onload = iXHR.onerror = function () {
3939

@@ -56,7 +56,7 @@ define([
5656

5757
$.ajaxTransport('+script', $.proxy(HHR_Transport, $));
5858

59-
if (! (BOM.XDomainRequest instanceof Function)) return;
59+
if (! ($.browser.msie < 10)) return;
6060

6161

6262
$.ajaxTransport('+*', function (iOption) {
@@ -75,7 +75,7 @@ define([
7575

7676
iXHR = new BOM.XDomainRequest();
7777

78-
iXHR.open(iOption.type, iOption.url, true);
78+
iXHR.open(iOption.method, iOption.url, true);
7979

8080
$.extend(iXHR, {
8181
timeout: iOption.timeout || 0,

source/AJAX/hook.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ define(['../iQuery'], function ($) {
1212

1313
if (callback instanceof Array) {
1414

15-
queue = queue[type || '*'][0];
15+
var handler = (queue[ type ] || queue['*'] || '')[0];
1616

17-
return queue && queue.apply(null, callback);
17+
return handler && handler.apply(null, callback);
1818
}
1919

2020
callback = callback || type;
@@ -42,7 +42,7 @@ define(['../iQuery'], function ($) {
4242

4343
iXHR = new self.XMLHttpRequest();
4444

45-
iXHR.open(iOption.type, iOption.url, true);
45+
iXHR.open(iOption.method, iOption.url, true);
4646

4747
iXHR[iOption.crossDomain ? 'onload' : 'onreadystatechange'] =
4848
function () {
@@ -87,6 +87,7 @@ define(['../iQuery'], function ($) {
8787
iXHR.send(iData);
8888
},
8989
abort: function () {
90+
9091
iXHR.onload = iXHR.onreadystatechange = null;
9192

9293
iXHR.abort(); iXHR = null;

source/AJAX/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ define([
6767
/* ---------- Request Core ---------- */
6868

6969
var Default_Option = {
70-
type: 'GET',
70+
method: 'GET',
7171
dataType: 'text'
7272
},
7373
$_DOM = $( self.document );
@@ -103,6 +103,8 @@ define([
103103
var _Option_ = $.extend(
104104
{url: self.location.href}, Default_Option, iOption
105105
);
106+
_Option_.method = (_Option_.type || _Option_.method).toUpperCase();
107+
106108
iURL = _Option_.url;
107109

108110
_Option_.crossDomain = $.isXDomain( iURL );
@@ -114,22 +116,24 @@ define([
114116
return '';
115117
});
116118

117-
if (_Option_.type == 'GET') {
119+
if (_Option_.method === 'GET') {
118120

119121
if (! (_Option_.jsonp || hasFetched( iURL )))
120122
_Option_.data._ = $.now();
121123

122124
_Option_.data = $.extend($.paramJSON( iURL ), _Option_.data);
123125

124126
_Option_.url = $.extendURL(iURL, _Option_.data);
127+
128+
_Option_.data = '';
125129
}
126130

127131
// Prefilter & Transport
128-
var iXHR = new self.XMLHttpRequest(), iArgs = [_Option_, iOption, iXHR];
132+
var iArgs = [_Option_, iOption, iXHR];
129133

130134
$.ajaxPrefilter(_Option_.dataType, iArgs);
131135

132-
iXHR = $.ajaxTransport(_Option_.dataType, iArgs) || iXHR;
136+
var iXHR = $.ajaxTransport(_Option_.dataType, iArgs);
133137

134138
// Async Promise
135139
var iResult = new Promise(function (iResolve, iReject) {

source/DOM/parseHTML.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ define(['../object/index'], function ($) {
4646
.slice(-1)[0];
4747
}
4848

49-
return Array.from(iNew.childNodes, function (iDOM) {
49+
return $.each($.makeArray( iNew.childNodes ), function () {
5050

51-
return iDOM.parentNode.removeChild( iDOM );
51+
return this.parentNode.removeChild( this );
5252
});
5353
};
5454
});

source/DOM/utility.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ define(['../iQuery', '../CSS/ext/pseudo'], function ($) {
4747
function Scroll_DOM() {
4848

4949
return (this.nodeName.toLowerCase() in Scroll_Root) ?
50-
DOM.scrollingElement : this;
50+
document.scrollingElement : this;
5151
}
5252

5353
function DOM_Scroll(iName) {

source/event/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ define([
9090
var result; event = Event(event, {currentTarget: this});
9191

9292
$.each(
93-
$.event.handlers.call(
94-
this, event, $.data(this, '__event__'), namespace
95-
),
93+
$.event.handlers.apply(this, [
94+
event, $.data(this, '__event__')[ event.type ], namespace
95+
]),
9696
function () {
9797

9898
for (var i = 0; this.handler[i]; i++) {

0 commit comments

Comments
 (0)