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
ce67f0ce
Commit
ce67f0ce
authored
Jan 08, 2013
by
Oleg
Committed by
Dave Methvin
Jan 08, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ref #8908. Update IE9 css clone fix. Close gh-1120.
parent
c27d8e29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
14 deletions
+30
-14
css.js
src/css.js
+2
-2
support.js
src/support.js
+4
-0
css.js
test/unit/css.js
+5
-2
support.js
test/unit/support.js
+19
-10
No files found.
src/css.js
View file @
ce67f0ce
...
@@ -213,8 +213,8 @@ jQuery.extend({
...
@@ -213,8 +213,8 @@ jQuery.extend({
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions
// but it would mean to define eight (for every problematic property) identical functions
if
(
value
===
""
&&
name
.
indexOf
(
"background"
)
===
0
)
{
if
(
!
jQuery
.
support
.
clearCloneStyle
&&
value
===
""
&&
name
.
indexOf
(
"background"
)
===
0
)
{
value
=
"
"
;
style
[
name
]
=
"inherit
"
;
}
}
// If a hook was provided, use that value, otherwise just set the specified value
// If a hook was provided, use that value, otherwise just set the specified value
...
...
src/support.js
View file @
ce67f0ce
...
@@ -138,6 +138,10 @@ jQuery.support = (function() {
...
@@ -138,6 +138,10 @@ jQuery.support = (function() {
support
[
i
+
"Bubbles"
]
=
eventName
in
window
||
div
.
attributes
[
eventName
].
expando
===
false
;
support
[
i
+
"Bubbles"
]
=
eventName
in
window
||
div
.
attributes
[
eventName
].
expando
===
false
;
}
}
div
.
style
.
backgroundClip
=
"content-box"
;
div
.
cloneNode
().
style
.
backgroundClip
=
""
;
support
.
clearCloneStyle
=
div
.
style
.
backgroundClip
===
"content-box"
;
// Run tests that need a body at doc ready
// Run tests that need a body at doc ready
jQuery
(
function
()
{
jQuery
(
function
()
{
var
container
,
marginDiv
,
tds
,
var
container
,
marginDiv
,
tds
,
...
...
test/unit/css.js
View file @
ce67f0ce
...
@@ -923,7 +923,7 @@ test( "css opacity consistency across browsers (#12685)", function() {
...
@@ -923,7 +923,7 @@ test( "css opacity consistency across browsers (#12685)", function() {
equal
(
Math
.
round
(
el
.
css
(
"opacity"
)
*
100
),
20
,
"remove opacity override"
);
equal
(
Math
.
round
(
el
.
css
(
"opacity"
)
*
100
),
20
,
"remove opacity override"
);
});
});
asyncTest
(
"Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)"
,
16
,
function
()
{
asyncTest
(
"Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)"
,
24
,
function
()
{
var
baseUrl
=
document
.
location
.
href
.
replace
(
/
([^\/]
*
)
$/
,
""
),
var
baseUrl
=
document
.
location
.
href
.
replace
(
/
([^\/]
*
)
$/
,
""
),
styles
=
[{
styles
=
[{
name
:
"backgroundAttachment"
,
name
:
"backgroundAttachment"
,
...
@@ -961,7 +961,7 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
...
@@ -961,7 +961,7 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
expected
:
[
"auto auto"
]
expected
:
[
"auto auto"
]
}];
}];
jQuery
.
each
(
styles
,
function
(
index
,
style
)
{
jQuery
.
each
(
styles
,
function
(
index
,
style
)
{
var
$clone
,
$clonedChildren
,
var
$clone
,
$clonedChildren
,
$source
=
jQuery
(
"#firstp"
),
$source
=
jQuery
(
"#firstp"
),
source
=
$source
[
0
],
source
=
$source
[
0
],
...
@@ -972,6 +972,7 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
...
@@ -972,6 +972,7 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
if
(
source
.
style
[
style
.
name
]
===
undefined
)
{
if
(
source
.
style
[
style
.
name
]
===
undefined
)
{
ok
(
true
,
style
.
name
+
": style isn't supported and therefore not an issue"
);
ok
(
true
,
style
.
name
+
": style isn't supported and therefore not an issue"
);
ok
(
true
);
ok
(
true
);
ok
(
true
);
return
true
;
return
true
;
}
}
...
@@ -985,6 +986,8 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
...
@@ -985,6 +986,8 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
$clonedChildren
.
css
(
style
.
name
,
""
);
$clonedChildren
.
css
(
style
.
name
,
""
);
window
.
setTimeout
(
function
()
{
window
.
setTimeout
(
function
()
{
notEqual
(
$clone
.
css
(
style
.
name
),
style
.
value
[
0
],
"Cloned css was changed"
);
ok
(
jQuery
.
inArray
(
$source
.
css
(
style
.
name
)
!==
-
1
,
style
.
value
),
ok
(
jQuery
.
inArray
(
$source
.
css
(
style
.
name
)
!==
-
1
,
style
.
value
),
"Clearing clone.css() doesn't affect source.css(): "
+
style
.
name
+
"Clearing clone.css() doesn't affect source.css(): "
+
style
.
name
+
"; result: "
+
$source
.
css
(
style
.
name
)
+
"; result: "
+
$source
.
css
(
style
.
name
)
+
...
...
test/unit/support.js
View file @
ce67f0ce
...
@@ -81,7 +81,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
...
@@ -81,7 +81,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"reliableHiddenOffsets"
:
true
,
"reliableHiddenOffsets"
:
true
,
"ajax"
:
true
,
"ajax"
:
true
,
"cors"
:
true
,
"cors"
:
true
,
"doesNotIncludeMarginInBodyOffset"
:
true
"doesNotIncludeMarginInBodyOffset"
:
true
,
"clearCloneStyle"
:
true
};
};
}
else
if
(
/opera.*version
\/
12
\.
1/i
.
test
(
userAgent
)
)
{
}
else
if
(
/opera.*version
\/
12
\.
1/i
.
test
(
userAgent
)
)
{
expected
=
{
expected
=
{
...
@@ -114,7 +115,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
...
@@ -114,7 +115,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"reliableHiddenOffsets"
:
true
,
"reliableHiddenOffsets"
:
true
,
"ajax"
:
true
,
"ajax"
:
true
,
"cors"
:
true
,
"cors"
:
true
,
"doesNotIncludeMarginInBodyOffset"
:
true
"doesNotIncludeMarginInBodyOffset"
:
true
,
"clearCloneStyle"
:
true
};
};
}
else
if
(
/msie 10
\.
0/i
.
test
(
userAgent
)
)
{
}
else
if
(
/msie 10
\.
0/i
.
test
(
userAgent
)
)
{
expected
=
{
expected
=
{
...
@@ -147,7 +149,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
...
@@ -147,7 +149,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"reliableHiddenOffsets"
:
true
,
"reliableHiddenOffsets"
:
true
,
"ajax"
:
true
,
"ajax"
:
true
,
"cors"
:
true
,
"cors"
:
true
,
"doesNotIncludeMarginInBodyOffset"
:
true
"doesNotIncludeMarginInBodyOffset"
:
true
,
"clearCloneStyle"
:
false
};
};
}
else
if
(
/msie 9
\.
0/i
.
test
(
userAgent
)
)
{
}
else
if
(
/msie 9
\.
0/i
.
test
(
userAgent
)
)
{
expected
=
{
expected
=
{
...
@@ -180,7 +183,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
...
@@ -180,7 +183,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"reliableHiddenOffsets"
:
true
,
"reliableHiddenOffsets"
:
true
,
"ajax"
:
true
,
"ajax"
:
true
,
"cors"
:
false
,
"cors"
:
false
,
"doesNotIncludeMarginInBodyOffset"
:
true
"doesNotIncludeMarginInBodyOffset"
:
true
,
"clearCloneStyle"
:
false
};
};
}
else
if
(
/msie 8
\.
0/i
.
test
(
userAgent
)
)
{
}
else
if
(
/msie 8
\.
0/i
.
test
(
userAgent
)
)
{
expected
=
{
expected
=
{
...
@@ -213,7 +217,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
...
@@ -213,7 +217,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"reliableHiddenOffsets"
:
false
,
"reliableHiddenOffsets"
:
false
,
"ajax"
:
true
,
"ajax"
:
true
,
"cors"
:
false
,
"cors"
:
false
,
"doesNotIncludeMarginInBodyOffset"
:
true
"doesNotIncludeMarginInBodyOffset"
:
true
,
"clearCloneStyle"
:
true
};
};
}
else
if
(
/msie 7
\.
0/i
.
test
(
userAgent
)
)
{
}
else
if
(
/msie 7
\.
0/i
.
test
(
userAgent
)
)
{
expected
=
{
expected
=
{
...
@@ -246,7 +251,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
...
@@ -246,7 +251,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"shrinkWrapBlocks"
:
false
,
"shrinkWrapBlocks"
:
false
,
"submitBubbles"
:
false
,
"submitBubbles"
:
false
,
"tbody"
:
false
,
"tbody"
:
false
,
"style"
:
false
"style"
:
false
,
"clearCloneStyle"
:
true
};
};
}
else
if
(
/msie 6
\.
0/i
.
test
(
userAgent
)
)
{
}
else
if
(
/msie 6
\.
0/i
.
test
(
userAgent
)
)
{
expected
=
{
expected
=
{
...
@@ -279,7 +285,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
...
@@ -279,7 +285,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"reliableHiddenOffsets"
:
false
,
"reliableHiddenOffsets"
:
false
,
"ajax"
:
true
,
"ajax"
:
true
,
"cors"
:
false
,
"cors"
:
false
,
"doesNotIncludeMarginInBodyOffset"
:
true
"doesNotIncludeMarginInBodyOffset"
:
true
,
"clearCloneStyle"
:
true
};
};
}
else
if
(
/5
\.
1
\.
1 safari/i
.
test
(
userAgent
)
)
{
}
else
if
(
/5
\.
1
\.
1 safari/i
.
test
(
userAgent
)
)
{
expected
=
{
expected
=
{
...
@@ -312,7 +319,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
...
@@ -312,7 +319,8 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"reliableHiddenOffsets"
:
true
,
"reliableHiddenOffsets"
:
true
,
"ajax"
:
true
,
"ajax"
:
true
,
"cors"
:
true
,
"cors"
:
true
,
"doesNotIncludeMarginInBodyOffset"
:
true
"doesNotIncludeMarginInBodyOffset"
:
true
,
"clearCloneStyle"
:
true
};
};
}
else
if
(
/firefox/i
.
test
(
userAgent
)
)
{
}
else
if
(
/firefox/i
.
test
(
userAgent
)
)
{
expected
=
{
expected
=
{
...
@@ -345,13 +353,14 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
...
@@ -345,13 +353,14 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"reliableHiddenOffsets"
:
true
,
"reliableHiddenOffsets"
:
true
,
"ajax"
:
true
,
"ajax"
:
true
,
"cors"
:
true
,
"cors"
:
true
,
"doesNotIncludeMarginInBodyOffset"
:
true
"doesNotIncludeMarginInBodyOffset"
:
true
,
"clearCloneStyle"
:
true
};
};
}
}
if
(
expected
)
{
if
(
expected
)
{
test
(
"Verify that the support tests resolve as expected per browser"
,
function
()
{
test
(
"Verify that the support tests resolve as expected per browser"
,
function
()
{
expect
(
3
0
);
expect
(
3
1
);
for
(
var
i
in
expected
)
{
for
(
var
i
in
expected
)
{
if
(
jQuery
.
ajax
||
i
!==
"ajax"
&&
i
!==
"cors"
)
{
if
(
jQuery
.
ajax
||
i
!==
"ajax"
&&
i
!==
"cors"
)
{
...
...
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