Skip to content

Commit 58a79bf

Browse files
authored
Update jBase.dev.js
1 parent b7846a9 commit 58a79bf

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

jBase.dev.js

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,10 @@ class JBase extends Array{
4545
return this;
4646
}
4747
val(arg){
48-
if(arg){
49-
this.each(function(e){
50-
e.value = arg;
51-
});
52-
}
53-
else{
54-
this.each(function(e){
55-
return e.value;
56-
});
57-
}
48+
if(arg)
49+
this[0].value = arg;
50+
else
51+
return this[0].value;
5852
return this;
5953
}
6054
hasClass(arg){
@@ -70,16 +64,10 @@ class JBase extends Array{
7064
return this;
7165
}
7266
attr(att, val = null){
73-
if (val) {
74-
this.each(function(e){
75-
e.setAttribute(att, val);
76-
});
77-
}
78-
else{
79-
this.each(function(e){
80-
e.getAttribute(att);
81-
});
82-
}
67+
if (val)
68+
this[0].setAttribute(att, val);
69+
else
70+
return this[0].getAttribute(att);
8371
return this;
8472
}
8573
removeAttr(arg){
@@ -302,6 +290,7 @@ $.ajax = function(arg){
302290
let type = "get";
303291
let success = function(){};
304292
let fail = function(){};
293+
let param;
305294
if(arg['success']){
306295
success = arg['success'];
307296
}
@@ -326,7 +315,6 @@ $.ajax = function(arg){
326315
else
327316
return fail(this.status);
328317
};
329-
let param="";
330318
if (arg){
331319
type = arg["type"];
332320
if ('data' in arg) {

0 commit comments

Comments
 (0)