Skip to content

Commit

Permalink
throw errors instead of returning. closes issue #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgv committed Apr 23, 2012
1 parent a91d0c6 commit a3355b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/averageShadow.js
@@ -1,3 +1,9 @@
/*
* Average Shadow v1.1
* Jonathan Vingiano
*
*/

(function($){

$.avgShadow = function(el, options){
Expand All @@ -14,16 +20,16 @@
// make sure we're working with an image
// first look for $.prop and if it doesnt exist fallback to attr
if ($.prop == null) {
if (base.$el.attr('tagName').toLowerCase() !== 'img') return;
if (base.$el.attr('tagName').toLowerCase() !== 'img') throw "Average Shadow: This plugin will only work with an <img> element.";
} else {
if (base.$el.prop('tagNmae').toLowerCase() !== 'img') return;
if (base.$el.prop('tagNmae').toLowerCase() !== 'img') throw "Average Shadow: This plugin will only work with an <img> element.";
}

// if no canvas support but fallback is specified
if (!base.supportsCanvas() && base.options.fallbackColor) base.fallback();

// no canvas support and dgaf
if (!base.supportsCanvas()) return;
if (!base.supportsCanvas()) throw "Average Shadow: This browser doesn't support the canvas element.";

// wait for image to load
if (base.el.complete || base.el.readystate === 4) {
Expand Down Expand Up @@ -131,7 +137,7 @@


// options object
$.avgShadow.options = {
$.avgShadow.options = {
horizontal: 0,
vertical: 0,
blur: '10px',
Expand Down
11 changes: 10 additions & 1 deletion src/averageshadow.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a3355b9

Please sign in to comment.