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
0f7c89cd
Commit
0f7c89cd
authored
Mar 24, 2007
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a fix and test for bug #978 (Appending elements into an IFrame, in IE).
parent
7ad613c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
10 deletions
+28
-10
index.html
build/test/index.html
+1
-0
coreTest.js
src/jquery/coreTest.js
+11
-1
jquery.js
src/jquery/jquery.js
+14
-7
selectorTest.js
src/selector/selectorTest.js
+2
-2
No files found.
build/test/index.html
View file @
0f7c89cd
...
@@ -79,6 +79,7 @@
...
@@ -79,6 +79,7 @@
</object>
</object>
</form>
</form>
<b
id=
"floatTest"
>
Float test.
</b>
<b
id=
"floatTest"
>
Float test.
</b>
<iframe
id=
"iframe"
></iframe>
</div>
</div>
</dl>
</dl>
...
...
src/jquery/coreTest.js
View file @
0f7c89cd
...
@@ -316,7 +316,7 @@ test("wrap(String|Element)", function() {
...
@@ -316,7 +316,7 @@ test("wrap(String|Element)", function() {
});
});
test
(
"append(String|Element|Array<Element>|jQuery)"
,
function
()
{
test
(
"append(String|Element|Array<Element>|jQuery)"
,
function
()
{
expect
(
1
1
);
expect
(
1
2
);
var
defaultText
=
'Try them out:'
var
defaultText
=
'Try them out:'
var
result
=
$
(
'#first'
).
append
(
'<b>buga</b>'
);
var
result
=
$
(
'#first'
).
append
(
'<b>buga</b>'
);
ok
(
result
.
text
()
==
defaultText
+
'buga'
,
'Check if text appending works'
);
ok
(
result
.
text
()
==
defaultText
+
'buga'
,
'Check if text appending works'
);
...
@@ -353,6 +353,16 @@ test("append(String|Element|Array<Element>|jQuery)", function() {
...
@@ -353,6 +353,16 @@ test("append(String|Element|Array<Element>|jQuery)", function() {
reset
();
reset
();
$
(
"#sap"
).
append
(
document
.
getElementById
(
'form'
));
$
(
"#sap"
).
append
(
document
.
getElementById
(
'form'
));
ok
(
$
(
"#sap>form"
).
size
()
==
1
,
"Check for appending a form"
);
// Bug #910
ok
(
$
(
"#sap>form"
).
size
()
==
1
,
"Check for appending a form"
);
// Bug #910
reset
();
var
pass
=
true
;
try
{
$
(
$
(
"iframe"
)[
0
].
contentWindow
.
document
.
body
).
append
(
"<div>test</div>"
);
}
catch
(
e
)
{
pass
=
false
;
}
ok
(
pass
,
"Test for appending a DOM node to the contents of an IFrame"
);
});
});
...
...
src/jquery/jquery.js
View file @
0f7c89cd
...
@@ -614,10 +614,13 @@ jQuery.fn = jQuery.prototype = {
...
@@ -614,10 +614,13 @@ jQuery.fn = jQuery.prototype = {
*/
*/
wrap
:
function
()
{
wrap
:
function
()
{
// The elements to wrap the target around
// The elements to wrap the target around
var
a
=
jQuery
.
clean
(
arguments
)
;
var
a
,
args
=
arguments
;
// Wrap each of the matched elements individually
// Wrap each of the matched elements individually
return
this
.
each
(
function
(){
return
this
.
each
(
function
(){
if
(
!
a
)
a
=
jQuery
.
clean
(
args
,
this
.
ownerDocument
);
// Clone the structure that we're using to wrap
// Clone the structure that we're using to wrap
var
b
=
a
[
0
].
cloneNode
(
true
);
var
b
=
a
[
0
].
cloneNode
(
true
);
...
@@ -1121,12 +1124,15 @@ jQuery.fn = jQuery.prototype = {
...
@@ -1121,12 +1124,15 @@ jQuery.fn = jQuery.prototype = {
* @cat Core
* @cat Core
*/
*/
domManip
:
function
(
args
,
table
,
dir
,
fn
){
domManip
:
function
(
args
,
table
,
dir
,
fn
){
var
clone
=
this
.
length
>
1
;
var
clone
=
this
.
length
>
1
,
a
;
var
a
=
jQuery
.
clean
(
args
);
if
(
dir
<
0
)
a
.
reverse
();
return
this
.
each
(
function
(){
return
this
.
each
(
function
(){
if
(
!
a
)
{
a
=
jQuery
.
clean
(
args
,
this
.
ownerDocument
);
if
(
dir
<
0
)
a
.
reverse
();
}
var
obj
=
this
;
var
obj
=
this
;
if
(
table
&&
jQuery
.
nodeName
(
this
,
"table"
)
&&
jQuery
.
nodeName
(
a
[
0
],
"tr"
)
)
if
(
table
&&
jQuery
.
nodeName
(
this
,
"table"
)
&&
jQuery
.
nodeName
(
a
[
0
],
"tr"
)
)
...
@@ -1440,8 +1446,9 @@ jQuery.extend({
...
@@ -1440,8 +1446,9 @@ jQuery.extend({
return
ret
;
return
ret
;
},
},
clean
:
function
(
a
)
{
clean
:
function
(
a
,
doc
)
{
var
r
=
[];
var
r
=
[];
doc
=
doc
||
document
;
jQuery
.
each
(
a
,
function
(
i
,
arg
){
jQuery
.
each
(
a
,
function
(
i
,
arg
){
if
(
!
arg
)
return
;
if
(
!
arg
)
return
;
...
@@ -1452,7 +1459,7 @@ jQuery.extend({
...
@@ -1452,7 +1459,7 @@ jQuery.extend({
// Convert html string into DOM nodes
// Convert html string into DOM nodes
if
(
typeof
arg
==
"string"
)
{
if
(
typeof
arg
==
"string"
)
{
// Trim whitespace, otherwise indexOf won't work as expected
// Trim whitespace, otherwise indexOf won't work as expected
var
s
=
jQuery
.
trim
(
arg
),
div
=
doc
ument
.
createElement
(
"div"
),
tb
=
[];
var
s
=
jQuery
.
trim
(
arg
),
div
=
doc
.
createElement
(
"div"
),
tb
=
[];
var
wrap
=
var
wrap
=
// option or optgroup
// option or optgroup
...
...
src/selector/selectorTest.js
View file @
0f7c89cd
...
@@ -144,8 +144,8 @@ test("expressions - basic xpath", function() {
...
@@ -144,8 +144,8 @@ test("expressions - basic xpath", function() {
t
(
"Attribute Exists"
,
"//a[@title]"
,
[
"google"
]
);
t
(
"Attribute Exists"
,
"//a[@title]"
,
[
"google"
]
);
t
(
"Attribute Equals"
,
"//a[@rel='bookmark']"
,
[
"simon1"
]
);
t
(
"Attribute Equals"
,
"//a[@rel='bookmark']"
,
[
"simon1"
]
);
t
(
"Parent Axis"
,
"//p/.."
,
[
"main"
,
"foo"
]
);
t
(
"Parent Axis"
,
"//p/.."
,
[
"main"
,
"foo"
]
);
t
(
"Sibling Axis"
,
"//p/../"
,
[
"firstp"
,
"ap"
,
"foo"
,
"first"
,
"firstUL"
,
"empty"
,
"form"
,
"floatTest"
,
"sndp"
,
"en"
,
"sap"
]
);
t
(
"Sibling Axis"
,
"//p/../"
,
[
"firstp"
,
"ap"
,
"foo"
,
"first"
,
"firstUL"
,
"empty"
,
"form"
,
"floatTest"
,
"
iframe"
,
"
sndp"
,
"en"
,
"sap"
]
);
t
(
"Sibling Axis"
,
"//p/../*"
,
[
"firstp"
,
"ap"
,
"foo"
,
"first"
,
"firstUL"
,
"empty"
,
"form"
,
"floatTest"
,
"sndp"
,
"en"
,
"sap"
]
);
t
(
"Sibling Axis"
,
"//p/../*"
,
[
"firstp"
,
"ap"
,
"foo"
,
"first"
,
"firstUL"
,
"empty"
,
"form"
,
"floatTest"
,
"
iframe"
,
"
sndp"
,
"en"
,
"sap"
]
);
t
(
"Has Children"
,
"//p[a]"
,
[
"firstp"
,
"ap"
,
"en"
,
"sap"
]
);
t
(
"Has Children"
,
"//p[a]"
,
[
"firstp"
,
"ap"
,
"en"
,
"sap"
]
);
$
(
"#foo"
).
each
(
function
()
{
$
(
"#foo"
).
each
(
function
()
{
...
...
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