@@ -69,6 +69,8 @@ class JavascriptRenderer
69
69
protected $ ajaxHandlerClass = 'PhpDebugBar.AjaxHandler ' ;
70
70
71
71
protected $ ajaxHandlerBindToJquery = true ;
72
+
73
+ protected $ ajaxHandlerBindToXHR = false ;
72
74
73
75
protected $ openHandlerClass = 'PhpDebugBar.OpenHandler ' ;
74
76
@@ -446,6 +448,27 @@ public function isAjaxHandlerBoundToJquery()
446
448
return $ this ->ajaxHandlerBindToJquery ;
447
449
}
448
450
451
+ /**
452
+ * Sets whether to call bindToXHR() on the ajax handler
453
+ *
454
+ * @param boolean $bind
455
+ */
456
+ public function setBindAjaxHandlerToXHR ($ bind = true )
457
+ {
458
+ $ this ->ajaxHandlerBindToXHR = $ bind ;
459
+ return $ this ;
460
+ }
461
+
462
+ /**
463
+ * Checks whether bindToXHR() will be called on the ajax handler
464
+ *
465
+ * @return boolean
466
+ */
467
+ public function isAjaxHandlerBoundToXHR ()
468
+ {
469
+ return $ this ->ajaxHandlerBindToXHR ;
470
+ }
471
+
449
472
/**
450
473
* Sets the class name of the js open handler
451
474
*
@@ -817,7 +840,9 @@ protected function getJsInitializationCode()
817
840
818
841
if ($ this ->ajaxHandlerClass ) {
819
842
$ js .= sprintf ("%s.ajaxHandler = new %s(%s); \n" , $ this ->variableName , $ this ->ajaxHandlerClass , $ this ->variableName );
820
- if ($ this ->ajaxHandlerBindToJquery ) {
843
+ if ($ this ->ajaxHandlerBindToXHR ) {
844
+ $ js .= sprintf ("%s.ajaxHandler.bindToXHR(); \n" , $ this ->variableName );
845
+ } else if ($ this ->ajaxHandlerBindToJquery ) {
821
846
$ js .= sprintf ("if (jQuery) %s.ajaxHandler.bindToJquery(jQuery); \n" , $ this ->variableName );
822
847
}
823
848
}
0 commit comments