From ed7589c3b88fe60e2ce663bf683ed5ed1a8e976d Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Wed, 10 Jul 2013 18:26:22 +0300 Subject: [PATCH] Update jquery.webfonts from upstream Bug: 50836 Change-Id: I6c1f79b2392d458214c897cf8542ed9a89c550f8 --- lib/jquery.webfonts.js | 167 ++++++++++++++++++++++++++--------------- 1 file changed, 107 insertions(+), 60 deletions(-) diff --git a/lib/jquery.webfonts.js b/lib/jquery.webfonts.js index 58f3cdbd..a7bbee54 100644 --- a/lib/jquery.webfonts.js +++ b/lib/jquery.webfonts.js @@ -23,9 +23,11 @@ this.options = $.extend( {}, $.fn.webfonts.defaults, options ); this.$element = $( element ); this.repository = $.extend( WebFonts.repository, this.options.repository ); + // List of loaded fonts this.fonts = []; this.originalFontFamily = this.$element.css( 'font-family' ); this.language = this.$element.attr( 'lang' ) || $( 'html' ).attr( 'lang' ); + this.init(); }; @@ -37,9 +39,11 @@ // Utility methods to work on the repository. defaultFont: function( language ) { var defaultFont = null; + if ( this.languages[language] ) { defaultFont = this.languages[language][0]; } + return defaultFont; }, @@ -63,11 +67,10 @@ * Initialize. */ init: function() { - var fontFamily; if ( this.language ) { - fontFamily = this.getFont( this.language ); - this.apply( fontFamily ); + this.apply( this.getFont( this.language ) ); } + this.parse(); }, @@ -102,9 +105,7 @@ } // Set the font of this element if it's not excluded - if ( !$element.is( this.options.exclude ) ) { - $element.css( 'font-family', fontStack.join() ); - } + $element.not( this.options.exclude ).css( 'font-family', fontStack.join() ); // Set the font of this element's children if they are not excluded. // font-family of ,