Skip to content

Commit

Permalink
Replace jQuery.isNumeric() checks with typeof
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbenner committed Feb 21, 2024
1 parent 44bd9c0 commit 02b4e71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/csscoordinates.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function CSSCoordinates() {
* @param {number} value The value of the property.
*/
me.set = function(property, value) {
if ($.isNumeric(value)) {
if (typeof value === 'number') {
me[property] = Math.round(value);
}
};
Expand Down
16 changes: 8 additions & 8 deletions test/unit/placementcalculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,33 @@ $(function() {
case 'ne':
case 'nw-alt':
assert.strictEqual(coords.top, 'auto', key + ': top property is set to auto');
assert.strictEqual($.isNumeric(coords.left), true, key + ': left property is set to a number');
assert.strictEqual(typeof coords.left, 'number', key + ': left property is set to a number');
assert.strictEqual(coords.right, 'auto', key + ': right property is set to auto');
assert.strictEqual($.isNumeric(coords.bottom), true, key + ': bottom property is set to a number');
assert.strictEqual(typeof coords.bottom, 'number', key + ': bottom property is set to a number');
break;
case 'e':
case 's':
case 'se':
case 'sw-alt':
assert.strictEqual($.isNumeric(coords.top), true, key + ': top property is set to a number');
assert.strictEqual($.isNumeric(coords.left), true, key + ': left property is set to a number');
assert.strictEqual(typeof coords.top, 'number', key + ': top property is set to a number');
assert.strictEqual(typeof coords.left, 'number', key + ': left property is set to a number');
assert.strictEqual(coords.right, 'auto', key + ': right property is set to auto');
assert.strictEqual(coords.bottom, 'auto', key + ': bottom property is set to auto');
break;
case 'w':
case 'sw':
case 'se-alt':
assert.strictEqual($.isNumeric(coords.top), true, key + ': top property is set to a number');
assert.strictEqual(typeof coords.top, 'number', key + ': top property is set to a number');
assert.strictEqual(coords.left, 'auto', key + ': left property is set to auto');
assert.strictEqual($.isNumeric(coords.right), true, key + ': right property is set to a number');
assert.strictEqual(typeof coords.right, 'number', key + ': right property is set to a number');
assert.strictEqual(coords.bottom, 'auto', key + ': bottom property is set to auto');
break;
case 'nw':
case 'ne-alt':
assert.strictEqual(coords.top, 'auto', key + ': top property is set to auto');
assert.strictEqual(coords.left, 'auto', key + ': left property is set to auto');
assert.strictEqual($.isNumeric(coords.right), true, key + ': right property is set to a number');
assert.strictEqual($.isNumeric(coords.bottom), true, key + ': bottom property is set to a number');
assert.strictEqual(typeof coords.right, 'number', key + ': right property is set to a number');
assert.strictEqual(typeof coords.bottom, 'number', key + ': bottom property is set to a number');
break;
}
});
Expand Down

0 comments on commit 02b4e71

Please sign in to comment.