Ticket #4527: 4527_2.patch
File 4527_2.patch, 4.7 KB (added by , 15 years ago) |
---|
-
_source/plugins/forms/dialogs/checkbox.js
79 79 accessKey : 'V', 80 80 setup : function( element ) 81 81 { 82 this.setValue( element.getAttribute( 'value' ) || '' ); 82 var value = element.getAttribute( 'value' ); 83 // IE Return 'on' as default attr value. 84 this.setValue( CKEDITOR.env.ie && value == 'on' ? '' : value ); 83 85 }, 84 86 commit : function( data ) 85 87 { 86 var element = data.element; 88 var element = data.element, 89 value = this.getValue(); 87 90 88 if ( this.getValue() )89 element.setAttribute( 'value', this.getValue());91 if ( value && !( CKEDITOR.env.ie && value == 'on' ) ) 92 element.setAttribute( 'value', value ); 90 93 else 91 94 element.removeAttribute( 'value' ); 92 95 } … … 115 118 { 116 119 var replace = CKEDITOR.dom.element.createFromHtml( '<input type="checkbox"' 117 120 + ( isChecked ? ' checked="checked"' : '' ) 118 + '></input>', editor.document ); 121 + '/>', editor.document ); 122 119 123 element.copyAttributes( replace, { type : 1, checked : 1 } ); 120 124 replace.replace( element ); 121 125 editor.getSelection().selectElement( replace ); … … 124 128 } 125 129 else 126 130 { 127 if ( this.getValue() ) 128 element.setAttribute( 'checked', this.getValue() ); 131 var value = this.getValue(); 132 if ( value ) 133 element.setAttribute( 'checked', 'checked' ); 129 134 else 130 135 element.removeAttribute( 'checked' ); 131 136 } -
_source/core/dom/element.js
425 425 break; 426 426 427 427 case 'checked': 428 return this.$.checked; 429 break; 430 428 { 429 var attr = this.$.attributes.getNamedItem( name ), 430 attrValue = attr.specified ? attr.nodeValue // For value given by parser. 431 : this.$.checked; // For value created via DOM interface. 432 433 return attrValue ? 'checked' : null; 434 } 435 431 436 case 'style': 432 437 // IE does not return inline styles via getAttribute(). See #2947. 433 438 return this.$.style.cssText; … … 1323 1328 { 1324 1329 var attribute = attributes[n]; 1325 1330 1326 // IE BUG: value attribute is never specified even if it exists.1327 if ( attribute.specified ||1328 ( CKEDITOR.env.ie && attribute.nodeValue && attribute.nodeName.toLowerCase() == 'value' ) )1329 {1330 var attrName = attribute.nodeName; 1331 1332 1333 1331 // Lowercase attribute name hard rule is broken for 1332 // some attribute on IE, e.g. CHECKED. 1333 var attrName = attribute.nodeName.toLowerCase(), 1334 attrValue; 1335 1336 // We can set the type only once, so do it with the proper value, not copying it. 1337 if ( attrName in skipAttributes ) 1338 continue; 1334 1339 1335 var attrValue = this.getAttribute( attrName ); 1340 if( attrName == 'checked' && ( attrValue = this.getAttribute( attrName ) ) ) 1341 dest.setAttribute( attrName, attrValue ); 1342 // IE BUG: value attribute is never specified even if it exists. 1343 else if ( attribute.specified || 1344 ( CKEDITOR.env.ie && attribute.nodeValue && attrName == 'value' ) ) 1345 { 1346 attrValue = this.getAttribute( attrName ); 1336 1347 if ( attrValue === null ) 1337 1348 attrValue = attribute.nodeValue; 1338 1349 -
_source/plugins/forms/plugin.js
162 162 }); 163 163 } 164 164 }, 165 166 afterInit : function( editor ) 167 { 168 // Cleanup certain IE form elements default values. 169 if( CKEDITOR.env.ie ) 170 { 171 var dataProcessor = editor.dataProcessor, 172 htmlFilter = dataProcessor && dataProcessor.htmlFilter; 173 174 htmlFilter && htmlFilter.addRules( 175 { 176 elements : 177 { 178 input : function( input ) 179 { 180 var attrs = input.attributes, 181 type = attrs.type; 182 if( type == 'checkbox' || type == 'radio' ) 183 attrs.value == 'on' && delete attrs.value; 184 } 185 } 186 } ); 187 } 188 }, 165 189 requires : [ 'image' ] 166 190 } ); 167 191