Today, the Baobao Steamed Stuffed Bun shows that QW. eventh. getevent in qwrap may generate an endless loop.
CodeAs follows:
 
 
         /*  ** Obtain the event object * @ method getevent * @ Param {event} event (optional) the event object is the event * @ Param {element} element (optional) of the host where the call location is located by default) event * @ return {event} event object of the host Where any element object is located  */  Getevent:  Function  (Event, element ){  If  (Event ){  Return Event ;}  Else   If  (Element ){  If (Element.doc ument ){ Return  Element.doc ument. parentwindow. event ;}  If (Element. parentwindow ){ Return  Element. parentwindow. event ;}}  If  (Window. Event ){  Return Window. event ;}  Else  {  VaR F = Arguments. callee;  Do  {  If (/Event/. Test (F. Arguments [0]) { Return F. Arguments [0 ] ;}}  While (F = F. Caller );}},  
 
 
 
 
 
This endless loop problem was also discussed in an example in:
 
 
VaR Getevent_count = 0 ;  Function  Getevent (e) {e = E | Window. event;  If (! E ){  VaR C = Arguments. callee. Caller;  While  (C ){  If (Getevent_count ++> 1000) ) {Alert ( 'Endless loops! ');  Return  ;} E = C. Arguments [0 ];  If (E && Typeof (E. altkey) = "Boolean "){ //  Duck typing                  Break  ;} C = C. Caller; e = Null  ;}} Return  E ;}  Function  Test (n ){  Return N? Test (n-1 ): Getevent ();} test ( 2 ); 
 
Causes of endless loops:Sometimes there is a closed loop in the caller chain.For example, the caller of a function may be equal to itself.
 
 
 
 
 
 
 
In addition, the QW. eventh. getevent method is not directly available to the Business Code personnel. Currently, no one has stepped on the issue and there is no need to change the implementation method.