Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing element shouldn't be fatal #11

Open
pushred opened this issue Apr 7, 2015 · 0 comments
Open

Missing element shouldn't be fatal #11

pushred opened this issue Apr 7, 2015 · 0 comments

Comments

@pushred
Copy link

pushred commented Apr 7, 2015

If SubscribeEmail is instantiated on a page without the specified element it currently blows up like this:

Uncaught TypeError: Cannot read property 'id' of null
scripts.js:2283 _setDefaults
scripts.js:2200 SubscribeEmail
scripts.js:393 module.exports
scripts.js:486 (anonymous function)
scripts.js:25725 jQuery.Callbacks.fire
scripts.js:25837 jQuery.Callbacks.self.fireWith
scripts.js:26043 jQuery.extend.ready
scripts.js:26059 completed

//get/set the ID of the HTML element (may be different than the value of element)
options.id = instance.theForm.id || ('subscribe-email-' + options.service);

This error isn't horrible, but it could handle things a bit better for what's probably going to be a fairly common scenario. I think it should throw and log a more direct, helpful error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant