File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 216216 $inputor = this . $inputor ;
217217 if ( oDocument . selection ) {
218218 offset = this . getIEOffset ( pos ) ;
219- offset . top += $ ( oWindow ) . scrollTop ( ) + $inputor . scrollTop ( ) ;
220- offset . left += $ ( oWindow ) . scrollLeft ( ) + $inputor . scrollLeft ( ) ;
219+ // Check if oWindow is a window object by checking for window-specific properties
220+ function isValidWindow ( obj ) {
221+ return obj && typeof obj === 'object' && 'scrollTo' in obj && obj . document && obj . self === obj ;
222+ }
223+ // Then use this function in your conditionals
224+ if ( isValidWindow ( oWindow ) ) {
225+ offset . top += $ ( oWindow ) . scrollTop ( ) ;
226+ offset . left += $ ( oWindow ) . scrollLeft ( ) ;
227+ } else {
228+ console . error ( 'oWindow is not a valid window object.' ) ;
229+ }
230+ offset . top += $inputor . scrollTop ( ) ;
231+ offset . left += $inputor . scrollLeft ( ) ;
221232 return offset ;
222233 } else {
223234 offset = $inputor . offset ( ) ;
You can’t perform that action at this time.
0 commit comments