From 3de9c0e99c68dc8af55b51970d915e2e76a4fdac Mon Sep 17 00:00:00 2001 From: David Schnur Date: Wed, 29 May 2013 22:20:57 -0400 Subject: [PATCH] Don't cache hasOwnProperty. It's a little confusing, JSHint complains, and it doesn't make a big difference anyway. --- jquery.flot.canvas.js | 10 +++------- jquery.flot.js | 14 +++++--------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/jquery.flot.canvas.js b/jquery.flot.canvas.js index 4a2369e..139d019 100644 --- a/jquery.flot.canvas.js +++ b/jquery.flot.canvas.js @@ -35,10 +35,6 @@ browser, but needs to redraw with canvas text when exporting as an image. var render, getTextInfo, addText; - // Cache the prototype hasOwnProperty for faster access - - var hasOwnProperty = Object.prototype.hasOwnProperty; - function init(plot, classes) { var Canvas = classes.Canvas; @@ -70,14 +66,14 @@ browser, but needs to redraw with canvas text when exporting as an image. context.textBaseline = "middle"; for (var layerKey in cache) { - if (hasOwnProperty.call(cache, layerKey)) { + if (Object.prototype.hasOwnProperty.call(cache, layerKey)) { var layerCache = cache[layerKey]; for (var styleKey in layerCache) { - if (hasOwnProperty.call(layerCache, styleKey)) { + if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) { var styleCache = layerCache[styleKey], updateStyles = true; for (var key in styleCache) { - if (hasOwnProperty.call(styleCache, key)) { + if (Object.prototype.hasOwnProperty.call(styleCache, key)) { var info = styleCache[key], positions = info.positions, diff --git a/jquery.flot.js b/jquery.flot.js index 4f577b0..976fa7e 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -34,10 +34,6 @@ Licensed under the MIT license. // the actual Flot code (function($) { - // Cache the prototype hasOwnProperty for faster access - - var hasOwnProperty = Object.prototype.hasOwnProperty; - /////////////////////////////////////////////////////////////////////////// // The Canvas object is a wrapper around an HTML5 tag. // @@ -172,7 +168,7 @@ Licensed under the MIT license. // already been rendered, and remove those that are no longer active. for (var layerKey in cache) { - if (hasOwnProperty.call(cache, layerKey)) { + if (Object.prototype.hasOwnProperty.call(cache, layerKey)) { var layer = this.getTextLayer(layerKey), layerCache = cache[layerKey]; @@ -180,10 +176,10 @@ Licensed under the MIT license. layer.hide(); for (var styleKey in layerCache) { - if (hasOwnProperty.call(layerCache, styleKey)) { + if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) { var styleCache = layerCache[styleKey]; for (var key in styleCache) { - if (hasOwnProperty.call(styleCache, key)) { + if (Object.prototype.hasOwnProperty.call(styleCache, key)) { var positions = styleCache[key].positions; @@ -464,10 +460,10 @@ Licensed under the MIT license. var layerCache = this._textCache[layer]; if (layerCache != null) { for (var styleKey in layerCache) { - if (hasOwnProperty.call(layerCache, styleKey)) { + if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) { var styleCache = layerCache[styleKey]; for (var key in styleCache) { - if (hasOwnProperty.call(styleCache, key)) { + if (Object.prototype.hasOwnProperty.call(styleCache, key)) { positions = styleCache[key].positions; for (i = 0; position = positions[i]; i++) { position.active = false;