Permalink
Browse files

prevent JS error when nodes' not there yet for JSONP

  • Loading branch information...
1 parent 541caf1 commit ee4c3bba5120d11489dc98da75082a2c65eac9e1 @mikedeboer committed Apr 6, 2011
@@ -97,6 +97,8 @@ JSONPPolling.prototype._get = function(){
script.onerror = function(){
self._onDisconnect();
};
+ if (!this._insertAt || !this._insertAt.parentNode)
+ return; //@todo add error reporting or retries here?
this._insertAt.parentNode.insertBefore(script, this._insertAt);
this._script = script;
};
@@ -754,6 +754,8 @@ JSONPPolling.prototype._get = function(){
script.onerror = function(){
self._onDisconnect();
};
+ if (!this._insertAt || !this._insertAt.parentNode)
+ return; //@todo add error reporting or retries here?
this._insertAt.parentNode.insertBefore(script, this._insertAt);
this._script = script;
};

0 comments on commit ee4c3bb

Please sign in to comment.