Ticket #6126: 6126.patch

File 6126.patch, 1.5 KB (added by Alfonso Martínez de Lizarrondo, 13 years ago)

Proposed patch

  • _source/core/editor.js

     
    362362                                }
    363363                                form.on( 'submit',onSubmit );
    364364
     365                                // #6126 Browsers provide in the form.submit any input with name="submit"
     366                                // Let's rename them for a little while to get the original submit method
     367                                var submits = [],
     368                                        node;
     369                                if( form.$.submit.length )
     370                                {
     371                                        // Don't do the full loop here. In IE works, but Firefox updates the collection
     372                                        // and it's no longer an array when there's only one
     373                                        for (var i = form.$.submit.length - 1; i > 0; i--)
     374                                        {
     375                                                node = form.$.submit[ i ];
     376                                                submits.push( node );
     377                                                node.name = 'ckeTmp';
     378                                        }
     379                                }
     380                                if ( form.$.submit.nodeName )
     381                                {
     382                                        node = form.$.submit;
     383                                        submits.push( node );
     384                                        node.name = 'ckeTmp';
     385                                }
     386
    365387                                // Setup the submit function because it doesn't fire the
    366388                                // "submit" event.
    367                                 if ( !form.$.submit.nodeName )
     389                                if ( !form.$.submit.nodeName && !form.$.submit.length )
    368390                                {
    369391                                        form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit )
    370392                                                {
     
    382404                                                });
    383405                                }
    384406
     407                                // Restore the "submit" name to the inputs
     408                                while ( node = submits.pop() )
     409                                        node.name = "submit";
     410
    385411                                // Remove 'submit' events registered on form element before destroying.(#3988)
    386412                                editor.on( 'destroy', function()
    387413                                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy