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
a5063ee2
Commit
a5063ee2
authored
Sep 29, 2013
by
Lihan Li
Committed by
Richard Gibson
Oct 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #14394: Changing style !important in webkit. Close gh-1385.
(cherry picked from commit
24e58792
) Conflicts: src/css.js
parent
1ceecf4c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
css.js
src/css.js
+5
-2
css.js
test/unit/css.js
+6
-0
No files found.
src/css.js
View file @
a5063ee2
...
@@ -292,9 +292,12 @@ jQuery.extend({
...
@@ -292,9 +292,12 @@ jQuery.extend({
// 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
if
(
!
hooks
||
!
(
"set"
in
hooks
)
||
(
value
=
hooks
.
set
(
elem
,
value
,
extra
))
!==
undefined
)
{
if
(
!
hooks
||
!
(
"set"
in
hooks
)
||
(
value
=
hooks
.
set
(
elem
,
value
,
extra
))
!==
undefined
)
{
//
Wrapped to prevent IE from throwing errors when 'invalid' values are provided
//
Support: IE
//
Fixes bug #5509
//
Swallow errors from 'invalid' CSS values (#5509)
try
{
try
{
// Support: Chrome, Safari
// Setting style to blank string required to delete "style: x !important;"
style
[
name
]
=
""
;
style
[
name
]
=
value
;
style
[
name
]
=
value
;
}
catch
(
e
)
{}
}
catch
(
e
)
{}
}
}
...
...
test/unit/css.js
View file @
a5063ee2
...
@@ -970,6 +970,12 @@ test( ":visible/:hidden selectors", function() {
...
@@ -970,6 +970,12 @@ test( ":visible/:hidden selectors", function() {
t
(
"Is Hidden"
,
"#form input:hidden"
,
[
"hidden1"
,
"hidden2"
]
);
t
(
"Is Hidden"
,
"#form input:hidden"
,
[
"hidden1"
,
"hidden2"
]
);
});
});
test
(
"Override !important when changing styles (#14394)"
,
function
()
{
expect
(
1
);
var
el
=
jQuery
(
"<div style='display: block !important;'></div>"
).
css
(
"display"
,
"none"
);
equal
(
el
.
css
(
"display"
),
"none"
,
"New style replaced !important"
);
});
asyncTest
(
"Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)"
,
24
,
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
=
[{
...
...
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