Opened 13 years ago
Last modified 12 years ago
#8288 confirmed Bug
Internet Explorer will not run blank javascript function as per documentation
Reported by: | Keven | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 3.1.1 |
Keywords: | IE HasPatch | Cc: |
Description
Example 4 works fine in all browsers I have tested except IE. Both IE 8 and 9 will not run the additional javascript called, returning only the URL of the image.
Attachments (1)
Change History (10)
Changed 13 years ago by
Attachment: | CKeditor_javascriptie.JPG added |
---|
comment:1 Changed 13 years ago by
Code on custom BROWSE SERVER as follows:
<script> window.opener.CKEDITOR.tools.callFunction( <%=CKEditorFuncNum%>,'http://bcalpine.com/news/ads/P2P2009.gif', function() { // Get the reference to a dialog window. var element, dialog = this.getDialog(); // Check if this is the Image dialog window. if (dialog.getName() == 'image') { // Get the reference to a text field that holds the "alt" attribute. element = dialog.getContentElement( 'info', 'txtAlt' ); // Assign the new value. if ( element ) element.setValue( 'this value' ); element = dialog.getContentElement( 'info', 'txtBorder' ); // Assign the new value. if ( element ) element.setValue( '2' ); element = dialog.getContentElement( 'info', 'txtHSpace' ); // Assign the new value. if ( element ) element.setValue( '3' ); element = dialog.getContentElement( 'info', 'txtVSpace' ); // Assign the new value. if ( element ) element.setValue( '4' ); element = dialog.getContentElement( 'Link', 'txtUrl' ); // Assign the new value. if ( element ) element.setValue( 'http://bcalpine.com/news/' ); } // Return false to stop further execution - in such case CKEditor will ignore the second argument (fileUrl) // and the onSelect function assigned to a button that called the file browser (if defined). // return false; }); window.close(); </script>
comment:2 Changed 13 years ago by
Additional testing included replacing the entire blank function with function() {alert('TEST')} which fired on all browsers EXCEPT internet explorer on any version.
comment:3 Changed 13 years ago by
Keywords: | filebrowserImageBrowseUrl removed |
---|---|
Status: | new → confirmed |
Confirmed. In IE, when passing a function as an argument from a popup window, typeof
returns object
instead of a function
in the following line:
line 375
A different method of checking whether variable is a function is needed here.
comment:4 follow-up: 5 Changed 13 years ago by
Version: | 3.6.1 → 3.1.1 |
---|
comment:5 Changed 13 years ago by
Hi. When run ckeditor from source code, its work fine (tested in IE6). In ie6 function typeof is non-deterministic.
I replace problematic condition with test exist function call: if (data.call && ...
Its work in IE6 and Fireofx 3.6, other browser hasn't tested.
comment:6 Changed 13 years ago by
This is also discussed on the community forum: http://cksource.com/forums/viewtopic.php?f=11&t=23539
comment:7 Changed 13 years ago by
I am attempting to fix this locally for myself as I was the person bothering the community forum. I am not getting any different results with z.kwiecinski's check in IE9. Sorry if this is the wrong place to contribute.
comment:8 Changed 12 years ago by
In Explorer the type seems to be changed from function to object during cross-page call to callFunction.
The local method gives "function" and the remote methods ckeditors code gives "object".
The following is tested using todays trunk.
In my own filebrowser code:
function testTypeOf(x) { alert ("local typeOf: " + typeof x); alert ("local typeOf arg: " + typeof arguments[0]); } ... var f = function() { alert("Inside function"); } testTypeOf(f); window.opener.CKEDITOR.tools.testTypeOf(f); window.opener.CKEDITOR.tools.callFunction( ckEditFuncNum, url, f);
modified code in core/tools.js
... testTypeOf : function ( x ) { alert ("remote typeOf: " + typeof x); alert ("remote typeOf arg: " + typeof arguments[0]); }, callFunction : function( ref ) { if (ref == 2) alert("IN callFunction:" + ref + " arg0=" + arguments[0] + " arg1=" + arguments[1] + " arg2=" + arguments[2] + " Targ0=" + typeof arguments[0] + " Targ1=" + typeof arguments[1] + " Targ2=" + typeof arguments[2]); var fn = functions[ ref ]; return fn && fn.apply( window, Array.prototype.slice.call( arguments, 1 ) ); }, ...
Seems like other have the same problem: http://stackoverflow.com/questions/10499623/cant-pass-a-function-from-one-window-to-another-in-ie?rq=1
Their solution is to check:
if ( data && data.call ...
instead of
if ( typeof data == 'function' ...
comment:9 Changed 12 years ago by
Keywords: | HasPatch added |
---|
Same page on IE (left) and Chrome (right) the browse server calls the same page which returns different results on IE than other browsers.