X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fforms%2Fdialogs%2Fcheckbox.js;h=92bcddbcd0b6272dfbdde754760fa8d824884db5;hb=refs%2Ftags%2Fv3.3.2;hp=96c356e0948ea4324df0dfbe892985cbe51c6363;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/forms/dialogs/checkbox.js b/_source/plugins/forms/dialogs/checkbox.js index 96c356e..92bcddb 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-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'checkbox', function( editor ) @@ -79,16 +79,31 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) accessKey : 'V', setup : function( element ) { - this.setValue( element.getAttribute( 'value' ) || '' ); + var value = element.getAttribute( 'value' ); + // IE Return 'on' as default attr value. + this.setValue( CKEDITOR.env.ie && value == 'on' ? '' : value ); }, commit : function( data ) { - var element = data.element; + var element = data.element, + value = this.getValue(); - if ( this.getValue() ) - element.setAttribute( 'value', this.getValue() ); + 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' ); + } } }, { @@ -115,7 +130,8 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) { var replace = CKEDITOR.dom.element.createFromHtml( '', editor.document ); + + '/>', editor.document ); + element.copyAttributes( replace, { type : 1, checked : 1 } ); replace.replace( element ); editor.getSelection().selectElement( replace ); @@ -124,8 +140,9 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) } else { - if ( this.getValue() ) - element.setAttribute( 'checked', this.getValue() ); + var value = this.getValue(); + if ( value ) + element.setAttribute( 'checked', 'checked' ); else element.removeAttribute( 'checked' ); }