X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fforms%2Fdialogs%2Fcheckbox.js;h=1016d38795fd397c35299119ed19d2134b065911;hp=96c356e0948ea4324df0dfbe892985cbe51c6363;hb=941b0a9ba4e673e292510d80a5a86806994b8ea6;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91 diff --git a/_source/plugins/forms/dialogs/checkbox.js b/_source/plugins/forms/dialogs/checkbox.js index 96c356e..1016d38 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,14 +79,17 @@ 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' ); } @@ -115,7 +118,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 +128,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' ); }