X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fforms%2Fdialogs%2Fcheckbox.js;h=5a440465ed06584ff61d3683692dfd24c9189546;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=021163bb098571a2c8b37a76824986c28fc197ea;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d;p=ckeditor.git diff --git a/_source/plugins/forms/dialogs/checkbox.js b/_source/plugins/forms/dialogs/checkbox.js index 021163b..5a44046 100644 --- a/_source/plugins/forms/dialogs/checkbox.js +++ b/_source/plugins/forms/dialogs/checkbox.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'checkbox', function( editor ) @@ -14,7 +14,7 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) var element = this.getParentEditor().getSelection().getSelectedElement(); - if ( element && element.getAttribute( 'type' ) == "checkbox" ) + if ( element && element.getAttribute( 'type' ) == 'checkbox' ) { this.checkbox = element; this.setupContent( element ); @@ -31,10 +31,8 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) editor = this.getParentEditor(); element = editor.document.createElement( 'input' ); element.setAttribute( 'type', 'checkbox' ); - } - - if ( isInsertMode ) editor.insertElement( element ); + } this.commitContent( { element : element } ); }, contents : [ @@ -53,7 +51,7 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) setup : function( element ) { this.setValue( - element.getAttribute( '_cke_saved_name' ) || + element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' ); }, @@ -63,10 +61,10 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) // IE failed to update 'name' property on input elements, protect it now. if ( this.getValue() ) - element.setAttribute( '_cke_saved_name', this.getValue() ); + element.data( 'cke-saved-name', this.getValue() ); else { - element.removeAttribute( '_cke_saved_name' ); + element.data( 'cke-saved-name', false ); element.removeAttribute( 'name' ); } } @@ -91,7 +89,19 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) if ( value && !( CKEDITOR.env.ie && value == 'on' ) ) element.setAttribute( 'value', value ); else - element.removeAttribute( 'value' ); + { + if ( CKEDITOR.env.ie ) + { + // Remove attribute 'value' of checkbox (#4721). + var checkbox = new CKEDITOR.dom.element( 'input', element.getDocument() ); + element.copyAttributes( checkbox, { value: 1 } ); + checkbox.replace( element ); + editor.getSelection().selectElement( checkbox ); + data.element = checkbox; + } + else + element.removeAttribute( 'value' ); + } } }, { @@ -111,8 +121,8 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) if ( CKEDITOR.env.ie ) { - var isElementChecked = !!element.getAttribute( 'checked' ); - var isChecked = !!this.getValue(); + var isElementChecked = !!element.getAttribute( 'checked' ), + isChecked = !!this.getValue(); if ( isElementChecked != isChecked ) {