![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've written some code that looks like this: function search(win){ /* * search stuff here * if you find the object return a reference to it */ if (win.opener && !win.opener.closed) return search(win.opener); return null; }; var foundObj = search(window); (...) What is happening is that, if the object can't be found, I'm getting an endless loop as it keeps feeding window.opener to 'search'. If the opener itself does not have an opener I would expect the function to not be called again. Why does win.opener continue to be window.opener? |
op(1);">popup</a></p>
#3
| |||
| |||
|
|
I've written some code that looks like this: function search(win){ /* * search stuff here * if you find the object return a reference to it */ if (win.opener && !win.opener.closed) return search(win.opener); return null; }; var foundObj = search(window); It looks for an "known" object in the current window. If it can't find it, it tries the window opener. |
|
[...] What is happening is that, if the object can't be found, I'm getting an endless loop as it keeps feeding window.opener to 'search'. |
![]() |
| Thread Tools | |
| Display Modes | |
| |