From 0940cb9bd2b8967c8eac15f3097933f5aee7e551 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 8 May 2017 10:47:27 -0400 Subject: [PATCH] All: Remove uses of `jQuery.camelCase()` Ref #15160 Ref gh-1813 --- tests/lib/qunit-assert-domequal.js | 8 +++++++- ui/effect.js | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/lib/qunit-assert-domequal.js b/tests/lib/qunit-assert-domequal.js index b22bd90b9..35695c4f1 100644 --- a/tests/lib/qunit-assert-domequal.js +++ b/tests/lib/qunit-assert-domequal.js @@ -59,6 +59,12 @@ domEqual.attributes = [ "title" ]; +function camelCase( string ) { + return string.replace( /-([\da-z])/gi, function( all, letter ) { + return letter.toUpperCase(); + } ); +} + function getElementStyles( elem ) { var styles = {}; var style = elem.ownerDocument.defaultView ? @@ -71,7 +77,7 @@ function getElementStyles( elem ) { while ( len-- ) { key = style[ len ]; if ( typeof style[ key ] === "string" ) { - styles[ $.camelCase( key ) ] = style[ key ]; + styles[ camelCase( key ) ] = style[ key ]; } } diff --git a/ui/effect.js b/ui/effect.js index 31e6024a1..2d17affd1 100644 --- a/ui/effect.js +++ b/ui/effect.js @@ -746,6 +746,12 @@ $.each( } ); +function camelCase( string ) { + return string.replace( /-([\da-z])/gi, function( all, letter ) { + return letter.toUpperCase(); + } ); +} + function getElementStyles( elem ) { var key, len, style = elem.ownerDocument.defaultView ? @@ -758,7 +764,7 @@ function getElementStyles( elem ) { while ( len-- ) { key = style[ len ]; if ( typeof style[ key ] === "string" ) { - styles[ $.camelCase( key ) ] = style[ key ]; + styles[ camelCase( key ) ] = style[ key ]; } } -- 2.39.5