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

Commit5ea5946

Browse files
ShashankaNatarajmgol
authored andcommitted
Core: Deprecate jQuery.trim
Fixesgh-4363Closesgh-4461
1 parentac5f7cd commit5ea5946

File tree

5 files changed

+30
-31
lines changed

5 files changed

+30
-31
lines changed

‎src/core.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ define( [
1414
"./var/hasOwn",
1515
"./var/fnToString",
1616
"./var/ObjectFunctionString",
17-
"./var/trim",
1817
"./var/support",
1918
"./var/isWindow",
2019
"./core/DOMEval",
2120
"./core/toType"
2221
],function(arr,getProto,slice,concat,push,indexOf,
2322
class2type,toString,hasOwn,fnToString,ObjectFunctionString,
24-
trim,support,isWindow,DOMEval,toType){
23+
support,isWindow,DOMEval,toType){
2524

2625
"use strict";
2726

@@ -298,9 +297,6 @@ jQuery.extend( {
298297
returnret;
299298
},
300299

301-
trim:function(text){
302-
returntext==null ?"" :trim.call(text);
303-
},
304300

305301
// results is for internal usage only
306302
makeArray:function(arr,results){

‎src/deprecated.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
define([
22
"./core",
33
"./var/slice",
4-
4+
"./var/trim",
55
"./event/alias"
6-
],function(jQuery,slice){
6+
],function(jQuery,trim,slice){
77

88
"use strict";
99

@@ -66,4 +66,8 @@ jQuery.holdReady = function( hold ) {
6666
jQuery.ready(true);
6767
}
6868
};
69+
70+
jQuery.trim=function(text){
71+
returntext==null ?"" :trim.call(text);
72+
};
6973
});

‎test/unit/basic.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ QUnit.test( "show/hide", function( assert ) {
7676
}
7777

7878
QUnit.test("core",function(assert){
79-
assert.expect(18);
79+
assert.expect(17);
8080

8181
varelem=jQuery("<div></div><span></span>");
8282

8383
assert.strictEqual(elem.length,2,"Correct number of elements");
84-
assert.strictEqual(jQuery.trim(" hello "),"hello","jQuery.trim");
8584

8685
assert.ok(jQuery.isPlainObject({"a":2}),"jQuery.isPlainObject(object)");
8786
assert.ok(!jQuery.isPlainObject("foo"),"jQuery.isPlainObject(String)");

‎test/unit/core.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -216,28 +216,6 @@ QUnit.test( "noConflict", function( assert ) {
216216
window["jQuery"]=jQuery=$$;
217217
});
218218

219-
QUnit.test("trim",function(assert){
220-
assert.expect(13);
221-
222-
varnbsp=String.fromCharCode(160);
223-
224-
assert.equal(jQuery.trim("hello "),"hello","trailing space");
225-
assert.equal(jQuery.trim(" hello"),"hello","leading space");
226-
assert.equal(jQuery.trim(" hello "),"hello","space on both sides");
227-
assert.equal(jQuery.trim(" "+nbsp+"hello "+nbsp+" "),"hello","&nbsp;");
228-
229-
assert.equal(jQuery.trim(),"","Nothing in.");
230-
assert.equal(jQuery.trim(undefined),"","Undefined");
231-
assert.equal(jQuery.trim(null),"","Null");
232-
assert.equal(jQuery.trim(5),"5","Number");
233-
assert.equal(jQuery.trim(false),"false","Boolean");
234-
235-
assert.equal(jQuery.trim(" "),"","space should be trimmed");
236-
assert.equal(jQuery.trim("ipad\xA0"),"ipad","nbsp should be trimmed");
237-
assert.equal(jQuery.trim("\uFEFF"),"","zwsp should be trimmed");
238-
assert.equal(jQuery.trim("\uFEFF \xA0! | \uFEFF"),"! |","leading/trailing should be trimmed");
239-
});
240-
241219
QUnit.test("isPlainObject",function(assert){
242220
vardone=assert.async();
243221

‎test/unit/deprecated.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,25 @@ QUnit.test( "jQuery.proxy", function( assert ) {
160160
cb=jQuery.proxy(fn,null,"arg1","arg2");
161161
cb.call(thisObject,"arg3");
162162
});
163+
164+
QUnit.test("trim",function(assert){
165+
assert.expect(13);
166+
167+
varnbsp=String.fromCharCode(160);
168+
169+
assert.equal(jQuery.trim("hello "),"hello","trailing space");
170+
assert.equal(jQuery.trim(" hello"),"hello","leading space");
171+
assert.equal(jQuery.trim(" hello "),"hello","space on both sides");
172+
assert.equal(jQuery.trim(" "+nbsp+"hello "+nbsp+" "),"hello","&nbsp;");
173+
174+
assert.equal(jQuery.trim(),"","Nothing in.");
175+
assert.equal(jQuery.trim(undefined),"","Undefined");
176+
assert.equal(jQuery.trim(null),"","Null");
177+
assert.equal(jQuery.trim(5),"5","Number");
178+
assert.equal(jQuery.trim(false),"false","Boolean");
179+
180+
assert.equal(jQuery.trim(" "),"","space should be trimmed");
181+
assert.equal(jQuery.trim("ipad\xA0"),"ipad","nbsp should be trimmed");
182+
assert.equal(jQuery.trim("\uFEFF"),"","zwsp should be trimmed");
183+
assert.equal(jQuery.trim("\uFEFF \xA0! | \uFEFF"),"! |","leading/trailing should be trimmed");
184+
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp