Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
44590a5d
Commit
44590a5d
authored
Jun 16, 2006
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
You can now append and prepend into a table that doesn't have a tbody.
parent
cb3eada7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
jquery.js
jquery/jquery.js
+24
-4
No files found.
jquery/jquery.js
View file @
44590a5d
...
@@ -162,7 +162,7 @@ function $(a,c) {
...
@@ -162,7 +162,7 @@ function $(a,c) {
append
:
function
()
{
append
:
function
()
{
var
clone
=
this
.
size
()
>
1
;
var
clone
=
this
.
size
()
>
1
;
var
a
=
$
.
clean
(
arguments
);
var
a
=
$
.
clean
(
arguments
);
return
this
.
each
(
function
(){
return
this
.
domManip
(
function
(){
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
{
this
.
appendChild
(
clone
?
a
[
i
].
cloneNode
(
true
)
:
a
[
i
]
);
this
.
appendChild
(
clone
?
a
[
i
].
cloneNode
(
true
)
:
a
[
i
]
);
}
}
...
@@ -181,7 +181,7 @@ function $(a,c) {
...
@@ -181,7 +181,7 @@ function $(a,c) {
prepend
:
function
()
{
prepend
:
function
()
{
var
clone
=
this
.
size
()
>
1
;
var
clone
=
this
.
size
()
>
1
;
var
a
=
$
.
clean
(
arguments
);
var
a
=
$
.
clean
(
arguments
);
return
this
.
each
(
function
(){
return
this
.
domManip
(
function
(){
for
(
var
i
=
a
.
length
-
1
;
i
>=
0
;
i
--
)
{
for
(
var
i
=
a
.
length
-
1
;
i
>=
0
;
i
--
)
{
this
.
insertBefore
(
clone
?
a
[
i
].
cloneNode
(
true
)
:
a
[
i
],
this
.
firstChild
);
this
.
insertBefore
(
clone
?
a
[
i
].
cloneNode
(
true
)
:
a
[
i
],
this
.
firstChild
);
}
}
...
@@ -442,6 +442,28 @@ $.clean = function(a) {
...
@@ -442,6 +442,28 @@ $.clean = function(a) {
return
r
;
return
r
;
};
};
$
.
fn
=
{};
/**
* A wrapper function for each() to be used by append and prepend.
* Handles cases where you're trying to modify the inner contents of
* a table, when you actually need to work with the tbody.
*/
$
.
fn
.
domManip
=
function
(
fn
){
return
this
.
each
(
function
(){
var
obj
=
this
;
if
(
this
.
nodeName
==
'TABLE'
)
{
if
(
!
this
.
firstChild
)
{
this
.
appendChild
(
document
.
createElement
(
"tbody"
)
);
}
obj
=
this
.
firstChild
;
}
$
.
apply
(
obj
,
fn
);
});
};
$
.
g
=
{
$
.
g
=
{
''
:
"m[2] == '*' || a.nodeName.toUpperCase() == m[2].toUpperCase()"
,
''
:
"m[2] == '*' || a.nodeName.toUpperCase() == m[2].toUpperCase()"
,
'#'
:
"a.getAttribute('id') && a.getAttribute('id').nodeValue == m[2]"
,
'#'
:
"a.getAttribute('id') && a.getAttribute('id').nodeValue == m[2]"
,
...
@@ -489,8 +511,6 @@ $.g = {
...
@@ -489,8 +511,6 @@ $.g = {
"["
:
"$.Select(m[2],a).length > 0"
"["
:
"$.Select(m[2],a).length > 0"
};
};
$
.
fn
=
{};
$
.
Select
=
function
(
t
,
context
)
{
$
.
Select
=
function
(
t
,
context
)
{
context
=
context
||
$
.
context
||
document
;
context
=
context
||
$
.
context
||
document
;
if
(
t
.
constructor
!=
String
)
{
if
(
t
.
constructor
!=
String
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment