Javascript error while using with Print My Blog plugin
-
Hi I’m the developer of another plugin, Print My Blog.
A user of mine reported getting an error which actually originated in Hustle’s JS code.
This is what I saw in my browser’s console, from `hustle-ui.js:formatted:6547:60
Uncaught TypeError: e(...).find(...).filter(...)[0] is undefined
????trapFocus hustle-ui.min.js:formatted:6547
????slideinLoad hustle-ui.min.js:formatted:5838
????setTimeout handler*HUI.slideinLoad hustle-ui.min.js:formatted:5833
????showModule front.min.js:1
????displayModule front.min.js:1
????display front.min.js:1
????exitTimer front.min.js:1
????setTimeout handler*4859/exit_intentTrigger/this.setExitTimer front.min.js:1
????exit_intentTrigger front.min.js:1
????Underscore 3
????jQuery 11
????exit_intentTrigger front.min.js:1
????displayOnTrigger front.min.js:1
????handleDisplay front.min.js:1
????initialize front.min.js:1
????View front.min.js:1
????s front.min.js:1
????s front.min.js:1
????1225 front.min.js:1
????N Underscore
????1225 front.min.js:1
????1225 front.min.js:1
????i front.min.js:1
????<anonymous> front.min.js:1
????<anonymous> front.min.js:1
????<anonymous> front.min.js:1
hustle-ui.min.js:formatted:6547:60It’s a bit hard for me to figure out what’s going on by reading the minimized code, but as I read it, the line that’s throwing the error is looking for the first button or link it or form input it can find in the popup and then focusing on that. That’s handy, but for some reason it’s not finding anything, and then indexing into an empty array (hence why it’s saying
...[0] is undefined
). The code should be more defensive, and double-check it finds something in the query before indexing into it (egvar thing_to_focus_on = e(…).find(…).filter(…);
if(thing_to_focus_on.length > 0){
thing_to_focus_on.focus();
}
- You must be logged in to reply to this topic.