Permalink
Browse files

src : use logError instead of $.error

  • Loading branch information...
1 parent b6b8b2d commit a5e0a3ca2217ed75c16aaecc147e70c21db75902 @desandro desandro committed Jun 4, 2011
Showing with 13 additions and 3 deletions.
  1. +12 −2 jquery.masonry.js
  2. +1 −1 jquery.masonry.min.js
View
@@ -411,6 +411,14 @@
return this;
};
+
+ // helper function for logging errors
+ // $.error breaks jQuery chaining
+ var logError = function( message ) {
+ if ( this.console ) {
+ console.error( message );
+ }
+ };
// ======================= Plugin bridge ===============================
// leverages data method to either create or return $.Mason constructor
@@ -427,11 +435,13 @@
this.each(function(){
var instance = $.data( this, 'masonry' );
if ( !instance ) {
- return $.error( "cannot call methods on masonry prior to initialization; " +
+ logError( "cannot call methods on masonry prior to initialization; " +
"attempted to call method '" + options + "'" );
+ return;
}
if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
- return $.error( "no such method '" + options + "' for masonry instance" );
+ logError( "no such method '" + options + "' for masonry instance" );
+ return;
}
// apply method
instance[ options ].apply( instance, args );
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit a5e0a3c

Please sign in to comment.