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 ,