diff options
author | Nilton Cesar <niltoncms@gmail.com> | 2017-11-22 14:43:44 -0500 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2018-01-08 11:21:22 -0500 |
commit | 64a289286a743516bce82462200062a647ef3ac0 (patch) | |
tree | a98de0017aa21c031f59d1b21bd9ccea01a66f8d /src/core | |
parent | 3c0f2cfb05c94adb164ac863a96eb2cf09e8110a (diff) | |
download | jquery-64a289286a743516bce82462200062a647ef3ac0.tar.gz jquery-64a289286a743516bce82462200062a647ef3ac0.zip |
Core: make camelCase function available only for internal usage
Close gh-3604
Fixes gh-3384
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/camelCase.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/camelCase.js b/src/core/camelCase.js new file mode 100644 index 000000000..799fb3752 --- /dev/null +++ b/src/core/camelCase.js @@ -0,0 +1,23 @@ +define( [], function() { + +"use strict"; + +// Matches dashed string for camelizing +var rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g; + +// Used by camelCase as callback to replace() +function fcamelCase( all, letter ) { + return letter.toUpperCase(); +} + +// Convert dashed to camelCase; used by the css and data modules +// Support: IE <=9 - 11, Edge 12 - 15 +// Microsoft forgot to hump their vendor prefix (#9572) +function camelCase( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); +} + +return camelCase; + +} ); |