Commit 3de9c0e9 authored by David Schnur's avatar David Schnur

Don't cache hasOwnProperty.

It's a little confusing, JSHint complains, and it doesn't make a big
difference anyway.
parent 2b744b1d
...@@ -35,10 +35,6 @@ browser, but needs to redraw with canvas text when exporting as an image. ...@@ -35,10 +35,6 @@ browser, but needs to redraw with canvas text when exporting as an image.
var render, getTextInfo, addText; var render, getTextInfo, addText;
// Cache the prototype hasOwnProperty for faster access
var hasOwnProperty = Object.prototype.hasOwnProperty;
function init(plot, classes) { function init(plot, classes) {
var Canvas = classes.Canvas; var Canvas = classes.Canvas;
...@@ -70,14 +66,14 @@ browser, but needs to redraw with canvas text when exporting as an image. ...@@ -70,14 +66,14 @@ browser, but needs to redraw with canvas text when exporting as an image.
context.textBaseline = "middle"; context.textBaseline = "middle";
for (var layerKey in cache) { for (var layerKey in cache) {
if (hasOwnProperty.call(cache, layerKey)) { if (Object.prototype.hasOwnProperty.call(cache, layerKey)) {
var layerCache = cache[layerKey]; var layerCache = cache[layerKey];
for (var styleKey in layerCache) { for (var styleKey in layerCache) {
if (hasOwnProperty.call(layerCache, styleKey)) { if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) {
var styleCache = layerCache[styleKey], var styleCache = layerCache[styleKey],
updateStyles = true; updateStyles = true;
for (var key in styleCache) { for (var key in styleCache) {
if (hasOwnProperty.call(styleCache, key)) { if (Object.prototype.hasOwnProperty.call(styleCache, key)) {
var info = styleCache[key], var info = styleCache[key],
positions = info.positions, positions = info.positions,
......
...@@ -34,10 +34,6 @@ Licensed under the MIT license. ...@@ -34,10 +34,6 @@ Licensed under the MIT license.
// the actual Flot code // the actual Flot code
(function($) { (function($) {
// Cache the prototype hasOwnProperty for faster access
var hasOwnProperty = Object.prototype.hasOwnProperty;
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// The Canvas object is a wrapper around an HTML5 <canvas> tag. // The Canvas object is a wrapper around an HTML5 <canvas> tag.
// //
...@@ -172,7 +168,7 @@ Licensed under the MIT license. ...@@ -172,7 +168,7 @@ Licensed under the MIT license.
// already been rendered, and remove those that are no longer active. // already been rendered, and remove those that are no longer active.
for (var layerKey in cache) { for (var layerKey in cache) {
if (hasOwnProperty.call(cache, layerKey)) { if (Object.prototype.hasOwnProperty.call(cache, layerKey)) {
var layer = this.getTextLayer(layerKey), var layer = this.getTextLayer(layerKey),
layerCache = cache[layerKey]; layerCache = cache[layerKey];
...@@ -180,10 +176,10 @@ Licensed under the MIT license. ...@@ -180,10 +176,10 @@ Licensed under the MIT license.
layer.hide(); layer.hide();
for (var styleKey in layerCache) { for (var styleKey in layerCache) {
if (hasOwnProperty.call(layerCache, styleKey)) { if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) {
var styleCache = layerCache[styleKey]; var styleCache = layerCache[styleKey];
for (var key in styleCache) { for (var key in styleCache) {
if (hasOwnProperty.call(styleCache, key)) { if (Object.prototype.hasOwnProperty.call(styleCache, key)) {
var positions = styleCache[key].positions; var positions = styleCache[key].positions;
...@@ -464,10 +460,10 @@ Licensed under the MIT license. ...@@ -464,10 +460,10 @@ Licensed under the MIT license.
var layerCache = this._textCache[layer]; var layerCache = this._textCache[layer];
if (layerCache != null) { if (layerCache != null) {
for (var styleKey in layerCache) { for (var styleKey in layerCache) {
if (hasOwnProperty.call(layerCache, styleKey)) { if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) {
var styleCache = layerCache[styleKey]; var styleCache = layerCache[styleKey];
for (var key in styleCache) { for (var key in styleCache) {
if (hasOwnProperty.call(styleCache, key)) { if (Object.prototype.hasOwnProperty.call(styleCache, key)) {
positions = styleCache[key].positions; positions = styleCache[key].positions;
for (i = 0; position = positions[i]; i++) { for (i = 0; position = positions[i]; i++) {
position.active = false; position.active = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment