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
abead1c8
Commit
abead1c8
authored
Dec 31, 2012
by
Mike Sherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #13088: under IE8, $(selector).attr('style') always return lowercase string
parent
c9b75df7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
attributes.js
src/attributes.js
+3
-2
attributes.js
test/unit/attributes.js
+5
-2
No files found.
src/attributes.js
View file @
abead1c8
...
@@ -600,8 +600,9 @@ if ( !jQuery.support.style ) {
...
@@ -600,8 +600,9 @@ if ( !jQuery.support.style ) {
jQuery
.
attrHooks
.
style
=
{
jQuery
.
attrHooks
.
style
=
{
get
:
function
(
elem
)
{
get
:
function
(
elem
)
{
// Return undefined in the case of empty string
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
// Note: IE uppercases css property names, but if we were to .toLowerCase()
return
elem
.
style
.
cssText
.
toLowerCase
()
||
undefined
;
// .cssText, that would destroy case senstitivity in URL's, like in "background"
return
elem
.
style
.
cssText
||
undefined
;
},
},
set
:
function
(
elem
,
value
)
{
set
:
function
(
elem
,
value
)
{
return
(
elem
.
style
.
cssText
=
value
+
""
);
return
(
elem
.
style
.
cssText
=
value
+
""
);
...
...
test/unit/attributes.js
View file @
abead1c8
...
@@ -130,8 +130,11 @@ test( "attr(String)", function() {
...
@@ -130,8 +130,11 @@ test( "attr(String)", function() {
equal
(
$img
.
attr
(
"height"
),
"53"
,
"Retrieve height attribute an an element with display:none."
);
equal
(
$img
.
attr
(
"height"
),
"53"
,
"Retrieve height attribute an an element with display:none."
);
// Check for style support
// Check for style support
ok
(
!!~
jQuery
(
"#dl"
).
attr
(
"style"
).
indexOf
(
"position"
),
"Check style attribute getter, also normalize css props to lowercase"
);
var
styleElem
=
jQuery
(
"<div/>"
).
appendTo
(
"#qunit-fixture"
).
css
({
ok
(
!!~
jQuery
(
"#foo"
).
attr
(
"style"
,
"position:absolute;"
).
attr
(
"style"
).
indexOf
(
"position"
),
"Check style setter"
);
background
:
"url(UPPERlower.gif)"
});
ok
(
!!~
styleElem
.
attr
(
"style"
).
indexOf
(
"UPPERlower.gif"
),
"Check style attribute getter"
);
ok
(
!!~
styleElem
.
attr
(
"style"
,
"position:absolute;"
).
attr
(
"style"
).
indexOf
(
"absolute"
),
"Check style setter"
);
// Check value on button element (#1954)
// Check value on button element (#1954)
var
$button
=
jQuery
(
"<button>text</button>"
).
insertAfter
(
"#button"
);
var
$button
=
jQuery
(
"<button>text</button>"
).
insertAfter
(
"#button"
);
...
...
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