git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6541eb9
)
Simplifying the camelCase logic used in the CSS and Effects modules.
author
John Resig
<jeresig@gmail.com>
Fri, 17 Sep 2010 18:53:10 +0000
(14:53 -0400)
committer
John Resig
<jeresig@gmail.com>
Fri, 17 Sep 2010 18:53:10 +0000
(14:53 -0400)
src/css.js
patch
|
blob
|
history
src/effects.js
patch
|
blob
|
history
diff --git
a/src/css.js
b/src/css.js
index
8ea815c
..
84b6e60
100644
(file)
--- a/
src/css.js
+++ b/
src/css.js
@@
-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, fcamelCase ),
+ var ret, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
@@
-94,7
+94,7
@@
jQuery.extend({
css: function( elem, name, extra ) {
// Make sure that we're working with the right name
css: function( elem, name, extra ) {
// Make sure that we're working with the right name
- var ret, origName = name.replace( rdashAlpha, fcamelCase ),
+ var ret, origName = jQuery.camelCase( name ),
hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
@@
-125,6
+125,10
@@
jQuery.extend({
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
+ },
+
+ camelCase: function( string ) {
+ return string.replace( rdashAlpha, fcamelCase );
}
});
}
});
diff --git
a/src/effects.js
b/src/effects.js
index
9c8abe5
..
9db341a
100644
(file)
--- a/
src/effects.js
+++ b/
src/effects.js
@@
-3,7
+3,6
@@
var elemdisplay = {},
rfxtypes = /toggle|show|hide/,
rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
var elemdisplay = {},
rfxtypes = /toggle|show|hide/,
rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
- rdashAlpha = /-([a-z])/ig,
timerId,
fxAttrs = [
// height animations
timerId,
fxAttrs = [
// height animations
@@
-12,11
+11,7
@@
var elemdisplay = {},
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
- ],
-
- fcamelCase = function( all, letter ) {
- return letter.toUpperCase();
- };
+ ];
jQuery.fn.extend({
show: function( speed, callback ) {
jQuery.fn.extend({
show: function( speed, callback ) {
@@
-125,7
+120,7
@@
jQuery.fn.extend({
self = this;
for ( p in prop ) {
self = this;
for ( p in prop ) {
- var name = p.replace(rdashAlpha, fcamelCase);
+ var name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
if ( p !== name ) {
prop[ name ] = prop[ p ];