From 6c3378990ebf61eb8f755667e192e01ad4e58618 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Mon, 20 Aug 2012 15:49:17 +0300 Subject: [PATCH] Fix apply() to work with an empty string. Change-Id: Ib7f7c9d9a0d99b3768cea4f7c77f8477c3421bae --- lib/jquery.webfonts.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/jquery.webfonts.js b/lib/jquery.webfonts.js index 23ca992a..ea14f917 100644 --- a/lib/jquery.webfonts.js +++ b/lib/jquery.webfonts.js @@ -70,8 +70,12 @@ apply : function(fontFamily, $element) { $element = $element || this.$element; var fontStack = this.options.fontStack.slice(0); - this.load(fontFamily); - fontStack.unshift(fontFamily); + // Loading an empty string is pointless. + // Putting an empty string into a font-family list doesn't work with jQuery.css(). + if ( fontFamily ) { + this.load(fontFamily); + fontStack.unshift(fontFamily); + } $element.css('font-family', fontStack.join() ); $element.find('textarea, input').css('font-family', fontStack.join()); },