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
77e310b9
Commit
77e310b9
authored
Sep 17, 2010
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplifying the camelCase logic used in the CSS and Effects modules.
parent
6541eb9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
css.js
src/css.js
+6
-2
effects.js
src/effects.js
+2
-7
No files found.
src/css.js
View file @
77e310b9
...
@@ -64,7 +64,7 @@ jQuery.extend({
...
@@ -64,7 +64,7 @@ jQuery.extend({
}
}
// Make sure that we're working with the right name
// Make sure that we're working with the right name
var
ret
,
origName
=
name
.
replace
(
rdashAlpha
,
fcamelCas
e
),
var
ret
,
origName
=
jQuery
.
camelCase
(
nam
e
),
style
=
elem
.
style
,
hooks
=
jQuery
.
cssHooks
[
origName
];
style
=
elem
.
style
,
hooks
=
jQuery
.
cssHooks
[
origName
];
name
=
jQuery
.
cssProps
[
origName
]
||
origName
;
name
=
jQuery
.
cssProps
[
origName
]
||
origName
;
...
@@ -94,7 +94,7 @@ jQuery.extend({
...
@@ -94,7 +94,7 @@ jQuery.extend({
css
:
function
(
elem
,
name
,
extra
)
{
css
:
function
(
elem
,
name
,
extra
)
{
// Make sure that we're working with the right name
// Make sure that we're working with the right name
var
ret
,
origName
=
name
.
replace
(
rdashAlpha
,
fcamelCas
e
),
var
ret
,
origName
=
jQuery
.
camelCase
(
nam
e
),
hooks
=
jQuery
.
cssHooks
[
origName
];
hooks
=
jQuery
.
cssHooks
[
origName
];
name
=
jQuery
.
cssProps
[
origName
]
||
origName
;
name
=
jQuery
.
cssProps
[
origName
]
||
origName
;
...
@@ -125,6 +125,10 @@ jQuery.extend({
...
@@ -125,6 +125,10 @@ jQuery.extend({
for
(
name
in
options
)
{
for
(
name
in
options
)
{
elem
.
style
[
name
]
=
old
[
name
];
elem
.
style
[
name
]
=
old
[
name
];
}
}
},
camelCase
:
function
(
string
)
{
return
string
.
replace
(
rdashAlpha
,
fcamelCase
);
}
}
});
});
...
...
src/effects.js
View file @
77e310b9
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
var
elemdisplay
=
{},
var
elemdisplay
=
{},
rfxtypes
=
/toggle|show|hide/
,
rfxtypes
=
/toggle|show|hide/
,
rfxnum
=
/^
([
+
\-]
=
)?([\d
+.
\-]
+
)(
.*
)
$/
,
rfxnum
=
/^
([
+
\-]
=
)?([\d
+.
\-]
+
)(
.*
)
$/
,
rdashAlpha
=
/-
([
a-z
])
/ig
,
timerId
,
timerId
,
fxAttrs
=
[
fxAttrs
=
[
// height animations
// height animations
...
@@ -12,11 +11,7 @@ var elemdisplay = {},
...
@@ -12,11 +11,7 @@ var elemdisplay = {},
[
"width"
,
"marginLeft"
,
"marginRight"
,
"paddingLeft"
,
"paddingRight"
],
[
"width"
,
"marginLeft"
,
"marginRight"
,
"paddingLeft"
,
"paddingRight"
],
// opacity animations
// opacity animations
[
"opacity"
]
[
"opacity"
]
],
];
fcamelCase
=
function
(
all
,
letter
)
{
return
letter
.
toUpperCase
();
};
jQuery
.
fn
.
extend
({
jQuery
.
fn
.
extend
({
show
:
function
(
speed
,
callback
)
{
show
:
function
(
speed
,
callback
)
{
...
@@ -125,7 +120,7 @@ jQuery.fn.extend({
...
@@ -125,7 +120,7 @@ jQuery.fn.extend({
self
=
this
;
self
=
this
;
for
(
p
in
prop
)
{
for
(
p
in
prop
)
{
var
name
=
p
.
replace
(
rdashAlpha
,
fcamelCase
);
var
name
=
jQuery
.
camelCase
(
p
);
if
(
p
!==
name
)
{
if
(
p
!==
name
)
{
prop
[
name
]
=
prop
[
p
];
prop
[
name
]
=
prop
[
p
];
...
...
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