AnanthaKN / jquery-in-place-editor

Automatically exported from code.google.com/p/jquery-in-place-editor
Other
0 stars 0 forks source link

callback function does not receive parameters in IE8 #64

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
callback function does not receive parameters in IE8

What steps will reproduce the problem?
1. I used this snippet to activate editInPlace

$('div.editme').editInPlace({
    callback: function (idOfEditor, enteredText, orinalHTMLContent, settingsParams, animationCallbacks) {
        console.log(idOfEditor, enteredText, orinalHTMLContent, settingsParams);
        if (enteredText.length > 0) {
            <!-- do some servercalls -->
            return (enteredText);
        }
        else {
            return (orinalHTMLContent);
        }
    },
    saving_image: '/images/other/wait16trans.gif'
});

2. I firefox it works you can edit the field and save, but in InternetExplorer 
(8.0.7600.16385) I get an error on saving the new value:
'length' is undefined in 'enteredText.length'
The console.log displays 5 times 'undefined'

I'm using version 2.2.0 on Windows7 with IIS7.

I solved the problem by changing line 517 in the code to:

var callbackArguments = Array.prototype.splice.call(arguments, 1, 
arguments.length-1);

In the original code the third argument of splice was omitted. Firefox allows 
this, but IE8 does not.

I hope this is enough info to check this problem out.

Original issue reported on code.google.com by 2flyf...@gmail.com on 20 Jul 2010 at 2:14

GoogleCodeExporter commented 8 years ago
Wanted to add I experienced a similar problem in IE, and solved it with this 
technique as well. Please commit this change.

Original comment by jacklu...@gmail.com on 6 Oct 2010 at 8:22

GoogleCodeExporter commented 8 years ago
Came across the same problem. Replacing splice with slice is all that is needed.

Original comment by jonas.je...@gmail.com on 19 Jan 2011 at 1:49

GoogleCodeExporter commented 8 years ago
fixed.

Original comment by mhaec...@gmail.com on 27 Jan 2011 at 9:25