From 947ba2f8a5ba5a8cddcb7b6d80b0575fd138f6de Mon Sep 17 00:00:00 2001 From: Anthony Ryan Date: Wed, 6 Nov 2013 20:09:28 -0500 Subject: [PATCH] Fix the jQuery tag creation process Move the rowBuffer definition closer to it's usage within the method --- jquery.flot.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index 59d1c95..96800e2 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -2928,8 +2928,7 @@ Licensed under the MIT license. return; } - var entries = [], rowBuffer = null, - lf = options.legend.labelFormatter, s, label, i; + var entries = [], lf = options.legend.labelFormatter, s, label, i; // Build a list of legend entries, with each having a label and a color @@ -2971,10 +2970,10 @@ Licensed under the MIT license. // Generate markup for the list of entries, in their final order - var table = $("").css({ + var table = $("
").css({ "font-size": "smaller", "color": options.grid.color - }); + }), rowBuffer = null; for (i = 0; i < entries.length; ++i) { @@ -2984,24 +2983,24 @@ Licensed under the MIT license. if (rowBuffer !== null) { table.append(rowBuffer); } - rowBuffer = $(""); + rowBuffer = $(""); } - var colorbox = $("
").css({ + var colorbox = $("
").css({ "width": "4px", "height": 0, "border": "5px solid " + entry.color, "overflow": "hidden" }), - borderbox = $("
").css({ + borderbox = $("
").css({ "border": "1px solid " + options.legend.labelBoxBorderColor, "padding": "1px" }); rowBuffer.append( - $("").addClass("legendColorBox").append(borderbox.append(colorbox)), - $("").addClass("legendLabel").html(entry.label) + $("").addClass("legendColorBox").append(borderbox.append(colorbox)), + $("").addClass("legendLabel").html(entry.label) ); } @@ -3026,7 +3025,7 @@ Licensed under the MIT license. } else if (p.charAt(1) === "w") { pos.left = (m[0] + plotOffset.left) + "px"; } - var legend = $("
").addClass("legend").append(table.css(pos)).appendTo(placeholder); + var legend = $("
").addClass("legend").append(table.css(pos)).appendTo(placeholder); if (options.legend.backgroundOpacity !== 0.0) { // put in the transparent background // separately to avoid blended labels and @@ -3045,7 +3044,7 @@ Licensed under the MIT license. var div = legend.children(); // Position also applies to this - $("
").css(pos).css({ + $("
").css(pos).css({ "width": div.width() + "px", "height": div.height() + "px", "background-color": c,