X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fforms%2Fdialogs%2Fcheckbox.js;h=56a9c35ee7a6b1d97f79c9f4dbcdd333d83153fe;hb=3fe9cac293e090ea459a3ee10d78cbe9e1dd0e03;hp=92bcddbcd0b6272dfbdde754760fa8d824884db5;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/plugins/forms/dialogs/checkbox.js b/_source/plugins/forms/dialogs/checkbox.js index 92bcddb..56a9c35 100644 --- a/_source/plugins/forms/dialogs/checkbox.js +++ b/_source/plugins/forms/dialogs/checkbox.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2013, 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' ); } } @@ -94,7 +92,7 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) { if ( CKEDITOR.env.ie ) { - // Remove attribute 'value' of checkbox #4721. + // Remove attribute 'value' of checkbox (#4721). var checkbox = new CKEDITOR.dom.element( 'input', element.getDocument() ); element.copyAttributes( checkbox, { value: 1 } ); checkbox.replace( element ); @@ -123,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 ) {