Ticket #6334: 6334.patch
File 6334.patch, 44.5 KB (added by , 13 years ago) |
---|
-
_source/core/dom/domobject.js
141 141 142 142 (function( domObjectProto ) 143 143 { 144 var customData = {}; 144 var customData = {}, 145 customDataAttrs = {}; 145 146 146 147 CKEDITOR.on( 'reset', function() 147 148 { 148 149 customData = {}; 150 customDataAttrs = {}; 149 151 }); 150 152 151 153 /** … … 171 173 * @function 172 174 * @param {String} key A key used to identify the data slot. 173 175 * @param {Object} value The value to set to the data slot. 176 * @param {Boolean} useAttribute Whether to use an HTML5 data-* attribute to store the data. 174 177 * @returns {CKEDITOR.dom.domObject} This DOM object instance. 175 178 * @see CKEDITOR.dom.domObject.prototype.getCustomData 176 179 * @example 177 180 * var element = new CKEDITOR.dom.element( 'span' ); 178 181 * element.setCustomData( 'hasCustomData', true ); 179 182 */ 180 domObjectProto.setCustomData = function( key, value )183 domObjectProto.setCustomData = function( key, value, useAttribute ) 181 184 { 182 185 var expandoNumber = this.getUniqueId(), 186 dataSlot; 187 if ( useAttribute ) 188 { 189 this.setAttribute( 'data-' + key, value ); 190 dataSlot = customDataAttrs[ expandoNumber ] || ( customDataAttrs[ expandoNumber ] = {} ); 191 value = 1; 192 } 193 else 183 194 dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} ); 184 185 195 dataSlot[ key ] = value; 186 196 187 197 return this; … … 193 203 * @function 194 204 * @param {String} key The key used to identify the data slot. 195 205 * @returns {Object} This value set to the data slot. 206 * @param {Boolean} fromAttribute Whether to get the data from a HTML5 data-* attribute. 196 207 * @see CKEDITOR.dom.domObject.prototype.setCustomData 197 208 * @example 198 209 * var element = new CKEDITOR.dom.element( 'span' ); 199 210 * alert( element.getCustomData( 'hasCustomData' ) ); // e.g. 'true' 200 211 */ 201 domObjectProto.getCustomData = function( key )212 domObjectProto.getCustomData = function( key, fromAttribute ) 202 213 { 203 var expandoNumber = this.$._cke_expando, 214 if ( fromAttribute ) 215 return this.getAttribute( 'data-' + key ); 216 var expandoNumber = this.$[ 'data-cke-expando' ], 204 217 dataSlot = expandoNumber && customData[ expandoNumber ]; 205 218 206 219 return dataSlot && dataSlot[ key ]; … … 209 222 /** 210 223 * @name CKEDITOR.dom.domObject.prototype.removeCustomData 211 224 */ 212 domObjectProto.removeCustomData = function( key )225 domObjectProto.removeCustomData = function( key, fromAttribute ) 213 226 { 214 var expandoNumber = this.$ ._cke_expando,215 dataSlot = expandoNumber && customData[ expandoNumber ],227 var expandoNumber = this.$[ 'data-cke-expando' ], 228 dataSlot = expandoNumber && ( fromAttribute ? customDataAttrs : customData )[ expandoNumber ], 216 229 retval = dataSlot && dataSlot[ key ]; 217 230 218 231 if ( typeof retval != 'undefined' ) 219 232 delete dataSlot[ key ]; 233 fromAttribute && this.removeAttribute( 'data-' + key ); 220 234 221 235 return retval || null; 222 236 }; … … 233 247 // Clear all event listeners 234 248 this.removeAllListeners(); 235 249 236 var expandoNumber = this.$ ._cke_expando;250 var expandoNumber = this.$[ 'data-cke-expando' ]; 237 251 expandoNumber && delete customData[ expandoNumber ]; 252 253 var dataAttrs = expandoNumber && customDataAttrs[ expandoNumber ]; 254 if ( dataAttrs ) 255 { 256 for ( var i in dataAttrs ) 257 dataAttrs.hasOwnProperty( i ) && this.removeAttribute( 'data-' + dataAttrs[ i ] ); 258 delete customDataAttrs[ expandoNumber ]; 259 dataAttrs = null; 260 } 238 261 }; 239 262 240 263 /** … … 242 265 */ 243 266 domObjectProto.getUniqueId = function() 244 267 { 245 return this.$ ._cke_expando || ( this.$._cke_expando= CKEDITOR.tools.getNextNumber() );268 return this.$[ 'data-cke-expando' ] || ( this.$[ 'data-cke-expando' ] = CKEDITOR.tools.getNextNumber() ); 246 269 }; 247 270 248 271 // Implement CKEDITOR.event. -
_source/core/dom/element.js
728 728 { 729 729 var attribute = thisAttribs[ i ]; 730 730 731 if ( ( !CKEDITOR.env.ie || ( attribute.specified && attribute.nodeName != ' _cke_expando' ) ) && attribute.nodeValue != otherElement.getAttribute( attribute.nodeName ) )731 if ( ( !CKEDITOR.env.ie || ( attribute.specified && attribute.nodeName != 'data-cke-expando' ) ) && attribute.nodeValue != otherElement.getAttribute( attribute.nodeName ) ) 732 732 return false; 733 733 } 734 734 … … 739 739 for ( i = 0 ; i < otherLength ; i++ ) 740 740 { 741 741 attribute = otherAttribs[ i ]; 742 if ( attribute.specified && attribute.nodeName != ' _cke_expando'742 if ( attribute.specified && attribute.nodeName != 'data-cke-expando' 743 743 && attribute.nodeValue != this.getAttribute( attribute.nodeName ) ) 744 744 return false; 745 745 } … … 789 789 { 790 790 var child = children.getItem( i ); 791 791 792 if ( child.type == CKEDITOR.NODE_ELEMENT && child.get Attribute( '_cke_bookmark') )792 if ( child.type == CKEDITOR.NODE_ELEMENT && child.getCustomData( 'cke-bookmark', 1 ) ) 793 793 continue; 794 794 795 795 if ( child.type == CKEDITOR.NODE_ELEMENT && !child.isEmptyInlineRemoveable() … … 834 834 return true; 835 835 836 836 // Attributes to be ignored. 837 case ' _cke_expando' :837 case 'data-cke-expando' : 838 838 continue; 839 839 840 840 /*jsl:fallthru*/ … … 854 854 attrsNum = attrs.length; 855 855 856 856 // The _moz_dirty attribute might get into the element after pasting (#5455) 857 var execludeAttrs = { _cke_expando: 1, _moz_dirty : 1 };857 var execludeAttrs = { 'data-cke-expando' : 1, _moz_dirty : 1 }; 858 858 859 859 return attrsNum > 0 && 860 860 ( attrsNum > 2 || … … 917 917 // queuing them to be moved later. (#5567) 918 918 var pendingNodes = []; 919 919 920 while ( sibling.get Attribute( '_cke_bookmark')920 while ( sibling.getCustomData( 'cke-bookmark', 1 ) 921 921 || sibling.isEmptyInlineRemoveable() ) 922 922 { 923 923 pendingNodes.push( sibling ); … … 1483 1483 1484 1484 // Replace the node. 1485 1485 this.getParent() && this.$.parentNode.replaceChild( newNode.$, this.$ ); 1486 newNode.$ ._cke_expando = this.$._cke_expando;1486 newNode.$[ 'data-cke-expando' ] = this.$[ 'data-cke-expando' ]; 1487 1487 this.$ = newNode.$; 1488 1488 }, 1489 1489 -
_source/core/dom/node.js
115 115 return; 116 116 117 117 node.removeAttribute( 'id', false ) ; 118 node.removeAttribute( ' _cke_expando', false ) ;118 node.removeAttribute( 'data-cke-expando', false ) ; 119 119 120 120 var childs = node.childNodes; 121 121 for ( var i=0 ; i < childs.length ; i++ ) -
_source/core/dom/range.js
305 305 return node.type != CKEDITOR.NODE_TEXT 306 306 && node.getName() in CKEDITOR.dtd.$removeEmpty 307 307 || !CKEDITOR.tools.trim( node.getText() ) 308 || node.getParent(). hasAttribute( '_cke_bookmark');308 || node.getParent().getCustomData( 'cke-bookmark', 1 ); 309 309 } 310 310 311 311 var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(), … … 400 400 var collapsed = this.collapsed; 401 401 402 402 startNode = this.document.createElement( 'span' ); 403 startNode.set Attribute( '_cke_bookmark', 1 );403 startNode.setCustomData( 'cke-bookmark', 1, 1 ); 404 404 startNode.setStyle( 'display', 'none' ); 405 405 406 406 // For IE, it must have something inside, otherwise it may be … … 710 710 endNode = this.endContainer; 711 711 712 712 if ( startNode.is && startNode.is( 'span' ) 713 && startNode. hasAttribute( '_cke_bookmark') )713 && startNode.getCustomData( 'cke-bookmark', 1 ) ) 714 714 this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START ); 715 715 if ( endNode && endNode.is && endNode.is( 'span' ) 716 && endNode. hasAttribute( '_cke_bookmark') )716 && endNode.getCustomData( 'cke-bookmark', 1 ) ) 717 717 this.setEndAt( endNode, CKEDITOR.POSITION_AFTER_END ); 718 718 }, 719 719 … … 919 919 // If this is a visible element. 920 920 // We need to check for the bookmark attribute because IE insists on 921 921 // rendering the display:none nodes we use for bookmarks. (#3363) 922 if ( sibling.$.offsetWidth > 0 && !sibling.get Attribute( '_cke_bookmark') )922 if ( sibling.$.offsetWidth > 0 && !sibling.getCustomData( 'cke-bookmark', 1 ) ) 923 923 { 924 924 // We'll accept it only if we need 925 925 // whitespace, and this is an inline … … 1078 1078 // If this is a visible element. 1079 1079 // We need to check for the bookmark attribute because IE insists on 1080 1080 // rendering the display:none nodes we use for bookmarks. (#3363) 1081 if ( sibling.$.offsetWidth > 0 && !sibling.get Attribute( '_cke_bookmark') )1081 if ( sibling.$.offsetWidth > 0 && !sibling.getCustomData( 'cke-bookmark', 1 ) ) 1082 1082 { 1083 1083 // We'll accept it only if we need 1084 1084 // whitespace, and this is an inline -
_source/core/dom/walker.js
374 374 { 375 375 return ( node && node.getName 376 376 && node.getName() == 'span' 377 && node. hasAttribute('_cke_bookmark') );377 && node.getCustomData( 'cke-bookmark', 1 ) ); 378 378 } 379 379 380 380 return function( node ) -
_source/core/htmlparser/element.js
34 34 */ 35 35 this.children = []; 36 36 37 var tagName = attributes ._cke_real_element_type|| name;37 var tagName = attributes[ 'data-cke-real-element-type' ] || name; 38 38 39 39 var dtd = CKEDITOR.dtd, 40 40 isBlockLike = !!( dtd.$nonBodyContent[ tagName ] || dtd.$block[ tagName ] || dtd.$listItem[ tagName ] || dtd.$tableContent[ tagName ] || dtd.$nonEditable[ tagName ] || tagName == 'br' ), -
_source/core/htmlparser/fragment.js
125 125 var elementName, realElementName; 126 126 if ( element.attributes 127 127 && ( realElementName = 128 element.attributes[ ' _cke_real_element_type' ] ) )128 element.attributes[ 'data-cke-real-element-type' ] ) ) 129 129 elementName = realElementName; 130 130 else 131 131 elementName = element.name; -
_source/plugins/div/plugin.js
37 37 blockLimit = path.blockLimit, 38 38 div = blockLimit.is( 'div' ) && blockLimit; 39 39 40 if ( div && !div.get Attribute( '_cke_div_added') )40 if ( div && !div.getCustomData( 'cke-div-added', 1 ) ) 41 41 { 42 42 toRemove.push( div ); 43 div.set Attribute( '_cke_div_added');43 div.setCustomData( 'cke-div-added', 1, 1 ); 44 44 } 45 45 } 46 46 -
_source/plugins/elementspath/plugin.js
82 82 { 83 83 var index = elementsList.push( element ) - 1; 84 84 var name; 85 if ( element.get Attribute( '_cke_real_element_type') )86 name = element.get Attribute( '_cke_real_element_type');85 if ( element.getCustomData( 'cke-real-element-type', 1 ) ) 86 name = element.getCustomData( 'cke-real-element-type', 1 ); 87 87 else 88 88 name = element.getName(); 89 89 -
_source/plugins/fakeobjects/plugin.js
12 12 $ : function( element ) 13 13 { 14 14 var attributes = element.attributes, 15 realHtml = attributes && attributes ._cke_realelement,15 realHtml = attributes && attributes[ 'data-cke-realelement' ], 16 16 realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ), 17 17 realElement = realFragment && realFragment.children[ 0 ]; 18 18 19 19 // If we have width/height in the element, we must move it into 20 20 // the real element. 21 if ( realElement && element.attributes ._cke_resizable)21 if ( realElement && element.attributes[ 'data-cke-resizable' ] ) 22 22 { 23 23 var style = element.attributes.style; 24 24 … … 68 68 { 69 69 'class' : className, 70 70 src : CKEDITOR.getUrl( 'images/spacer.gif' ), 71 _cke_realelement: encodeURIComponent( realElement.getOuterHtml() ),72 _cke_real_node_type: realElement.type,71 'data-cke-realelement' : encodeURIComponent( realElement.getOuterHtml() ), 72 'data-cke-real-node-type' : realElement.type, 73 73 alt : lang[ realElementType ] || lang.unknown, 74 74 align : realElement.getAttribute( 'align' ) || '' 75 75 }; 76 76 77 77 if ( realElementType ) 78 attributes ._cke_real_element_type= realElementType;78 attributes[ 'data-cke-real-element-type' ] = realElementType; 79 79 80 80 if ( isResizable ) 81 attributes ._cke_resizable= isResizable;81 attributes[ 'data-cke-resizable' ] = isResizable; 82 82 83 83 return this.document.createElement( 'img', { attributes : attributes } ); 84 84 }; … … 96 96 { 97 97 'class' : className, 98 98 src : CKEDITOR.getUrl( 'images/spacer.gif' ), 99 _cke_realelement: encodeURIComponent( html ),100 _cke_real_node_type: realElement.type,99 'data-cke-realelement' : encodeURIComponent( html ), 100 'data-cke-real-node-type' : realElement.type, 101 101 alt : lang[ realElementType ] || lang.unknown, 102 102 align : realElement.attributes.align || '' 103 103 }; 104 104 105 105 if ( realElementType ) 106 attributes ._cke_real_element_type= realElementType;106 attributes[ 'data-cke-real-element-type' ] = realElementType; 107 107 108 108 if ( isResizable ) 109 attributes ._cke_resizable= isResizable;109 attributes[ 'data-cke-resizable' ] = isResizable; 110 110 111 111 return new CKEDITOR.htmlParser.element( 'img', attributes ); 112 112 }; 113 113 114 114 CKEDITOR.editor.prototype.restoreRealElement = function( fakeElement ) 115 115 { 116 if ( fakeElement.get Attribute( '_cke_real_node_type') != CKEDITOR.NODE_ELEMENT )116 if ( fakeElement.getCustomData( 'cke-real-node-type', 1 ) != CKEDITOR.NODE_ELEMENT ) 117 117 return null; 118 118 119 119 return CKEDITOR.dom.element.createFromHtml( 120 decodeURIComponent( fakeElement.get Attribute( '_cke_realelement') ),120 decodeURIComponent( fakeElement.getCustomData( 'cke-realelement', 1 ) ), 121 121 this.document ); 122 122 }; -
_source/plugins/flash/dialogs/flash.js
190 190 191 191 // Try to detect any embed or object tag that has Flash parameters. 192 192 var fakeImage = this.getSelectedElement(); 193 if ( fakeImage && fakeImage.get Attribute( '_cke_real_element_type' ) && fakeImage.getAttribute( '_cke_real_element_type') == 'flash' )193 if ( fakeImage && fakeImage.getCustomData( 'cke-real-element-type', 1 ) == 'flash' ) 194 194 { 195 195 this.fakeImage = fakeImage; 196 196 -
_source/plugins/flash/plugin.js
81 81 { 82 82 var element = evt.data.element; 83 83 84 if ( element.is( 'img' ) && element.get Attribute( '_cke_real_element_type') == 'flash' )84 if ( element.is( 'img' ) && element.getCustomData( 'cke-real-element-type', 1 ) == 'flash' ) 85 85 evt.data.dialog = 'flash'; 86 86 }); 87 87 … … 91 91 editor.contextMenu.addListener( function( element, selection ) 92 92 { 93 93 if ( element && element.is( 'img' ) && !element.isReadOnly() 94 && element.get Attribute( '_cke_real_element_type') == 'flash' )94 && element.getCustomData( 'cke-real-element-type', 1 ) == 'flash' ) 95 95 return { flash : CKEDITOR.TRISTATE_OFF }; 96 96 }); 97 97 } -
_source/plugins/forms/dialogs/button.js
52 52 setup : function( element ) 53 53 { 54 54 this.setValue( 55 element.get Attribute( '_cke_saved_name') ||55 element.getCustomData( 'cke-saved-name', 1 ) || 56 56 element.getAttribute( 'name' ) || 57 57 '' ); 58 58 }, … … 61 61 var element = data.element; 62 62 63 63 if ( this.getValue() ) 64 element.set Attribute( '_cke_saved_name', this.getValue());64 element.setCustomData( 'cke-saved-name', this.getValue(), 1 ); 65 65 else 66 66 { 67 element.remove Attribute( '_cke_saved_name');67 element.removeCustomData( 'cke-saved-name', 1 ); 68 68 element.removeAttribute( 'name' ); 69 69 } 70 70 } -
_source/plugins/forms/dialogs/checkbox.js
53 53 setup : function( element ) 54 54 { 55 55 this.setValue( 56 element.get Attribute( '_cke_saved_name') ||56 element.getCustomData( 'cke-saved-name', 1 ) || 57 57 element.getAttribute( 'name' ) || 58 58 '' ); 59 59 }, … … 63 63 64 64 // IE failed to update 'name' property on input elements, protect it now. 65 65 if ( this.getValue() ) 66 element.set Attribute( '_cke_saved_name', this.getValue());66 element.setCustomData( 'cke-saved-name', this.getValue(), 1 ); 67 67 else 68 68 { 69 element.remove Attribute( '_cke_saved_name');69 element.removeCustomData( 'cke-saved-name', 1 ); 70 70 element.removeAttribute( 'name' ); 71 71 } 72 72 } -
_source/plugins/forms/dialogs/form.js
84 84 accessKey : 'N', 85 85 setup : function( element ) 86 86 { 87 this.setValue( element.get Attribute( '_cke_saved_name') ||87 this.setValue( element.getCustomData( 'cke-saved-name', 1 ) || 88 88 element.getAttribute( 'name' ) || 89 89 '' ); 90 90 }, 91 91 commit : function( element ) 92 92 { 93 93 if ( this.getValue() ) 94 element.set Attribute( '_cke_saved_name', this.getValue());94 element.setCustomData( 'cke-saved-name', this.getValue(), 1 ); 95 95 else 96 96 { 97 element.remove Attribute( '_cke_saved_name');97 element.removeCustomData( 'cke-saved-name', 1 ); 98 98 element.removeAttribute( 'name' ); 99 99 } 100 100 } -
_source/plugins/forms/dialogs/hiddenfield.js
17 17 selection = editor.getSelection(), 18 18 element = selection.getSelectedElement(); 19 19 20 if ( element && element.get Attribute( '_cke_real_element_type' ) && element.getAttribute( '_cke_real_element_type') == 'hiddenfield' )20 if ( element && element.getCustomData( 'cke-real-element-type', 1 ) && element.getCustomData( 'cke-real-element-type', 1 ) == 'hiddenfield' ) 21 21 { 22 22 this.hiddenField = element; 23 23 element = editor.restoreRealElement( this.hiddenField ); … … 59 59 setup : function( element ) 60 60 { 61 61 this.setValue( 62 element.get Attribute( '_cke_saved_name') ||62 element.getCustomData( 'cke-saved-name', 1 ) || 63 63 element.getAttribute( 'name' ) || 64 64 '' ); 65 65 }, -
_source/plugins/forms/dialogs/radio.js
51 51 setup : function( element ) 52 52 { 53 53 this.setValue( 54 element.get Attribute( '_cke_saved_name') ||54 element.getCustomData( 'cke-saved-name', 1 ) || 55 55 element.getAttribute( 'name' ) || 56 56 '' ); 57 57 }, … … 60 60 var element = data.element; 61 61 62 62 if ( this.getValue() ) 63 element.set Attribute( '_cke_saved_name', this.getValue());63 element.setCustomData( 'cke-saved-name', this.getValue(), 1 ); 64 64 else 65 65 { 66 element.remove Attribute( '_cke_saved_name');66 element.removeCustomData( 'cke-saved-name', 1 ); 67 67 element.removeAttribute( 'name' ); 68 68 } 69 69 } -
_source/plugins/forms/dialogs/select.js
197 197 else if ( name == 'select' ) 198 198 { 199 199 this.setValue( 200 element.get Attribute( '_cke_saved_name') ||200 element.getCustomData( 'cke-saved-name', 1 ) || 201 201 element.getAttribute( 'name' ) || 202 202 '' ); 203 203 } … … 205 205 commit : function( element ) 206 206 { 207 207 if ( this.getValue() ) 208 element.set Attribute( '_cke_saved_name', this.getValue());208 element.setCustomData( 'cke-saved-name', this.getValue(), 1 ); 209 209 else 210 210 { 211 element.remove Attribute( '_cke_saved_name' );211 element.removeCustomData( 'cke-saved-name', 1 ); 212 212 element.removeAttribute( 'name' ); 213 213 } 214 214 } -
_source/plugins/forms/dialogs/textarea.js
50 50 setup : function( element ) 51 51 { 52 52 this.setValue( 53 element.get Attribute( '_cke_saved_name') ||53 element.getCustomData( 'cke-saved-name', 1 ) || 54 54 element.getAttribute( 'name' ) || 55 55 '' ); 56 56 }, 57 57 commit : function( element ) 58 58 { 59 59 if ( this.getValue() ) 60 element.set Attribute( '_cke_saved_name', this.getValue());60 element.setCustomData( 'cke-saved-name', this.getValue(), 1 ); 61 61 else 62 62 { 63 element.remove Attribute( '_cke_saved_name');63 element.removeCustomData( 'cke-saved-name', 1 ); 64 64 element.removeAttribute( 'name' ); 65 65 } 66 66 } -
_source/plugins/forms/dialogs/textfield.js
98 98 setup : function( element ) 99 99 { 100 100 this.setValue( 101 element.get Attribute( '_cke_saved_name') ||101 element.getCustomData( 'cke-saved-name', 1 ) || 102 102 element.getAttribute( 'name' ) || 103 103 '' ); 104 104 }, … … 107 107 var element = data.element; 108 108 109 109 if ( this.getValue() ) 110 element.set Attribute( '_cke_saved_name', this.getValue());110 element.setCustomData( 'cke-saved-name', this.getValue(), 1 ); 111 111 else 112 112 { 113 element.remove Attribute( '_cke_saved_name');113 element.removeCustomData( 'cke-saved-name', 1 ); 114 114 element.removeAttribute( 'name' ); 115 115 } 116 116 } -
_source/plugins/forms/plugin.js
167 167 return { imagebutton : CKEDITOR.TRISTATE_OFF }; 168 168 } 169 169 170 if ( name == 'img' && element.get Attribute( '_cke_real_element_type') == 'hiddenfield' )170 if ( name == 'img' && element.getCustomData( 'cke-real-element-type', 1 ) == 'hiddenfield' ) 171 171 return { hiddenfield : CKEDITOR.TRISTATE_OFF }; 172 172 } 173 173 }); … … 183 183 evt.data.dialog = 'select'; 184 184 else if ( element.is( 'textarea' ) ) 185 185 evt.data.dialog = 'textarea'; 186 else if ( element.is( 'img' ) && element.get Attribute( '_cke_real_element_type') == 'hiddenfield' )186 else if ( element.is( 'img' ) && element.getCustomData( 'cke-real-element-type', 1 ) == 'hiddenfield' ) 187 187 evt.data.dialog = 'hiddenfield'; 188 188 else if ( element.is( 'input' ) ) 189 189 { -
_source/plugins/htmldataprocessor/plugin.js
89 89 [ 90 90 // Event attributes (onXYZ) must not be directly set. They can become 91 91 // active in the editing area (IE|WebKit). 92 [ ( /^on/ ), ' _cke_pa_on' ]92 [ ( /^on/ ), 'data-cke-pa-on' ] 93 93 ] 94 94 }; 95 95 … … 112 112 attributeNames : 113 113 [ 114 114 // Attributes saved for changes and protected attributes. 115 [ ( /^ _cke_(saved|pa)_/ ), '' ],115 [ ( /^data-cke-(saved|pa)-/ ), '' ], 116 116 117 117 // All "_cke" attributes are to be ignored. 118 [ ( /^ _cke.*/ ), '' ],118 [ ( /^data-cke-.*/ ), '' ], 119 119 120 120 [ 'hidefocus', '' ] 121 121 ], … … 129 129 if ( attribs ) 130 130 { 131 131 // Elements marked as temporary are to be ignored. 132 if ( attribs .cke_temp)132 if ( attribs[ 'data-cke-temp' ] ) 133 133 return false; 134 134 135 135 // Remove duplicated attributes - #3789. … … 137 137 savedAttributeName; 138 138 for ( var i = 0 ; i < attributeNames.length ; i++ ) 139 139 { 140 savedAttributeName = ' _cke_saved_' + attributeNames[ i ];140 savedAttributeName = 'data-cke-saved-' + attributeNames[ i ]; 141 141 savedAttributeName in attribs && ( delete attribs[ attributeNames[ i ] ] ); 142 142 } 143 143 } … … 172 172 { 173 173 if ( !( element.children.length || 174 174 element.attributes.name || 175 element.attributes ._cke_saved_name) )175 element.attributes[ 'data-cke-saved-name' ] ) ) 176 176 { 177 177 return false; 178 178 } … … 202 202 title : function( element ) 203 203 { 204 204 var titleText = element.children[ 0 ]; 205 titleText && ( titleText.value = element.attributes[ ' _cke_title' ] || '' );205 titleText && ( titleText.value = element.attributes[ 'data-cke-title' ] || '' ); 206 206 } 207 207 }, 208 208 … … 264 264 } 265 265 266 266 var protectAttributeRegex = /<((?:a|area|img|input)[\s\S]*?\s)((href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))([^>]*)>/gi, 267 findSavedSrcRegex = /\s _cke_saved_src\s*=/;267 findSavedSrcRegex = /\sdata-cke-saved-src\s*=/; 268 268 269 269 var protectElementsRegex = /(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi, 270 270 encodedElementsRegex = /<cke:encoded>([^<]*)<\/cke:encoded>/gi; … … 282 282 if ( attrName == 'src' && findSavedSrcRegex.test( tag ) ) 283 283 return tag; 284 284 else 285 return '<' + beginning + fullAttr + ' _cke_saved_' + fullAttr + end + '>';285 return '<' + beginning + fullAttr + ' data-cke-saved-' + fullAttr + end + '>'; 286 286 }); 287 287 } 288 288 -
_source/plugins/image/dialogs/image.js
319 319 this.setupContent( LINK, link ); 320 320 } 321 321 322 if ( element && element.getName() == 'img' && !element.get Attribute( '_cke_realelement')322 if ( element && element.getName() == 'img' && !element.getCustomData( 'cke-realelement', 1 ) 323 323 || element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'image' ) 324 324 { 325 325 this.imageEditMode = element.getName(); … … 533 533 { 534 534 if ( type == IMAGE ) 535 535 { 536 var url = element.get Attribute( '_cke_saved_src') || element.getAttribute( 'src' );536 var url = element.getCustomData( 'cke-saved-src', 1 ) || element.getAttribute( 'src' ); 537 537 var field = this; 538 538 539 539 this.getDialog().dontResetSize = true; … … 547 547 { 548 548 if ( type == IMAGE && ( this.getValue() || this.isChanged() ) ) 549 549 { 550 element.set Attribute( '_cke_saved_src', decodeURI( this.getValue() ));550 element.setCustomData( 'cke-saved-src', decodeURI( this.getValue() ), 1 ); 551 551 element.setAttribute( 'src', decodeURI( this.getValue() ) ); 552 552 } 553 553 else if ( type == CLEANUP ) … … 1098 1098 { 1099 1099 if ( type == LINK ) 1100 1100 { 1101 var href = element.get Attribute( '_cke_saved_href');1101 var href = element.getCustomData( 'cke-saved-href', 1 ); 1102 1102 if ( !href ) 1103 1103 href = element.getAttribute( 'href' ); 1104 1104 this.setValue( href ); … … 1110 1110 { 1111 1111 if ( this.getValue() || this.isChanged() ) 1112 1112 { 1113 element.set Attribute( '_cke_saved_href', decodeURI( this.getValue() ));1113 element.setCustomData( 'cke-saved-href', decodeURI( this.getValue() ), 1 ); 1114 1114 element.setAttribute( 'href', 'javascript:void(0)/*' + 1115 1115 CKEDITOR.tools.getNextNumber() + '*/' ); 1116 1116 -
_source/plugins/image/plugin.js
30 30 { 31 31 var element = evt.data.element; 32 32 33 if ( element.is( 'img' ) && !element.get Attribute( '_cke_realelement') )33 if ( element.is( 'img' ) && !element.getCustomData( 'cke-realelement', 1 ) ) 34 34 evt.data.dialog = 'image'; 35 35 }); 36 36 … … 53 53 { 54 54 editor.contextMenu.addListener( function( element, selection ) 55 55 { 56 if ( !element || !element.is( 'img' ) || element.get Attribute( '_cke_realelement') || element.isReadOnly() )56 if ( !element || !element.is( 'img' ) || element.getCustomData( 'cke-realelement', 1 ) || element.isReadOnly() ) 57 57 return null; 58 58 59 59 return { image : CKEDITOR.TRISTATE_OFF }; -
_source/plugins/indent/plugin.js
283 283 284 284 var skipBookmarks = function( node ) 285 285 { 286 return ! node. hasAttribute( '_cke_bookmark');286 return ! node.getCustomData( 'cke-bookmark', 1 ); 287 287 }; 288 288 289 289 var iterator = ranges.createIterator(); -
_source/plugins/link/dialogs/anchor.js
38 38 } 39 39 40 40 // Set name. 41 element.remove Attribute( '_cke_saved_name');41 element.removeCustomData( 'cke-saved-name', 1 ); 42 42 element.setAttribute( 'name', name ); 43 43 44 44 // Insert a new anchor. … … 61 61 62 62 var selection = editor.getSelection(); 63 63 var element = selection.getSelectedElement(); 64 if ( element && element.get Attribute( '_cke_real_element_type' ) && element.getAttribute( '_cke_real_element_type') == 'anchor' )64 if ( element && element.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' ) 65 65 { 66 66 this.fakeObj = element; 67 67 element = editor.restoreRealElement( this.fakeObj ); -
_source/plugins/link/dialogs/link.js
94 94 95 95 var parseLink = function( editor, element ) 96 96 { 97 var href = ( element && ( element.get Attribute( '_cke_saved_href') || element.getAttribute( 'href' ) ) ) || '',97 var href = ( element && ( element.getCustomData( 'cke-saved-href', 1 ) || element.getAttribute( 'href' ) ) ) || '', 98 98 javascriptMatch, 99 99 emailMatch, 100 100 anchorMatch, … … 184 184 // IE BUG: target attribute is an empty string instead of null in IE if it's not set. 185 185 if ( !target ) 186 186 { 187 var onclick = element.get Attribute( '_cke_pa_onclick') || element.getAttribute( 'onclick' ),187 var onclick = element.getCustomData( 'cke-pa-onclick', 1 ) || element.getAttribute( 'onclick' ), 188 188 onclickMatch = onclick && onclick.match( popupRegex ); 189 189 if ( onclickMatch ) 190 190 { … … 242 242 for ( var i = 0; i < elements.count() ; i++ ) 243 243 { 244 244 var item = elements.getItem( i ); 245 if ( item.get Attribute( '_cke_realelement' ) && item.getAttribute( '_cke_real_element_type') == 'anchor' )245 if ( item.getCustomData( 'cke-realelement', 1 ) && item.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' ) 246 246 { 247 247 anchors.push( editor.restoreRealElement( item ) ); 248 248 } … … 1144 1144 if ( ( element = plugin.getSelectedLink( editor ) ) && element.hasAttribute( 'href' ) ) 1145 1145 selection.selectElement( element ); 1146 1146 else if ( ( element = selection.getSelectedElement() ) && element.is( 'img' ) 1147 && element.get Attribute( '_cke_real_element_type')1148 && element.get Attribute( '_cke_real_element_type') == 'anchor' )1147 && element.getCustomData( 'cke-real-element-type', 1 ) 1148 && element.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' ) 1149 1149 { 1150 1150 this.fakeObj = element; 1151 1151 element = editor.restoreRealElement( this.fakeObj ); … … 1172 1172 case 'url': 1173 1173 var protocol = ( data.url && data.url.protocol != undefined ) ? data.url.protocol : 'http://', 1174 1174 url = ( data.url && data.url.url ) || ''; 1175 attributes ._cke_saved_href= ( url.indexOf( '/' ) === 0 ) ? url : protocol + url;1175 attributes[ 'data-cke-saved-href' ] = ( url.indexOf( '/' ) === 0 ) ? url : protocol + url; 1176 1176 break; 1177 1177 case 'anchor': 1178 1178 var name = ( data.anchor && data.anchor.name ), 1179 1179 id = ( data.anchor && data.anchor.id ); 1180 attributes ._cke_saved_href= '#' + ( name || id || '' );1180 attributes[ 'data-cke-saved-href' ] = '#' + ( name || id || '' ); 1181 1181 break; 1182 1182 case 'email': 1183 1183 … … 1224 1224 } 1225 1225 } 1226 1226 1227 attributes ._cke_saved_href= linkHref.join( '' );1227 attributes[ 'data-cke-saved-href' ] = linkHref.join( '' ); 1228 1228 break; 1229 1229 } 1230 1230 … … 1252 1252 addFeature( 'top' ); 1253 1253 1254 1254 onclickList.push( featureList.join( ',' ), '\'); return false;' ); 1255 attributes[ ' _cke_pa_onclick' ] = onclickList.join( '' );1255 attributes[ 'data-cke-pa-onclick' ] = onclickList.join( '' ); 1256 1256 } 1257 1257 else 1258 1258 { … … 1261 1261 else 1262 1262 removeAttributes.push( 'target' ); 1263 1263 1264 removeAttributes.push( ' _cke_pa_onclick', 'onclick' );1264 removeAttributes.push( 'data-cke-pa-onclick', 'onclick' ); 1265 1265 } 1266 1266 } 1267 1267 … … 1300 1300 { 1301 1301 // Short mailto link text view (#5736). 1302 1302 var text = new CKEDITOR.dom.text( data.type == 'email' ? 1303 data.email.address : attributes ._cke_saved_href, editor.document );1303 data.email.address : attributes[ 'data-cke-saved-href' ], editor.document ); 1304 1304 ranges[0].insertNode( text ); 1305 1305 ranges[0].selectNodeContents( text ); 1306 1306 selection.selectRanges( ranges ); … … 1329 1329 { 1330 1330 // We're only editing an existing link, so just overwrite the attributes. 1331 1331 var element = this._.selectedElement, 1332 href = element.get Attribute( '_cke_saved_href'),1332 href = element.getCustomData( 'cke-saved-href', 1 ), 1333 1333 textView = element.getHtml(); 1334 1334 1335 1335 // IE BUG: Setting the name attribute to an existing link doesn't work. … … 1356 1356 { 1357 1357 // Short mailto link text view (#5736). 1358 1358 element.setHtml( data.type == 'email' ? 1359 data.email.address : attributes ._cke_saved_href);1359 data.email.address : attributes[ 'data-cke-saved-href' ] ); 1360 1360 } 1361 1361 // Make the element display as an anchor if a name has been set. 1362 1362 if ( element.getAttribute( 'name' ) ) -
_source/plugins/link/plugin.js
71 71 72 72 if ( element.is( 'a' ) ) 73 73 evt.data.dialog = ( element.getAttribute( 'name' ) && !element.getAttribute( 'href' ) ) ? 'anchor' : 'link'; 74 else if ( element.is( 'img' ) && element.get Attribute( '_cke_real_element_type') == 'anchor' )74 else if ( element.is( 'img' ) && element.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' ) 75 75 evt.data.dialog = 'anchor'; 76 76 }); 77 77 … … 113 113 if ( !element || element.isReadOnly() ) 114 114 return null; 115 115 116 var isAnchor = ( element.is( 'img' ) && element.get Attribute( '_cke_real_element_type') == 'anchor' );116 var isAnchor = ( element.is( 'img' ) && element.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' ); 117 117 118 118 if ( !isAnchor ) 119 119 { -
_source/plugins/removeformat/plugin.js
98 98 99 99 // This node must not be a fake element. 100 100 if ( !( currentNode.getName() == 'img' 101 && currentNode.get Attribute( '_cke_realelement') )101 && currentNode.getCustomData( 'cke-realelement', 1 ) ) 102 102 && filter( editor, currentNode ) ) 103 103 { 104 104 // Remove elements nodes that match with this style rules. -
_source/plugins/smiley/dialogs/smiley.js
34 34 attributes : 35 35 { 36 36 src : src, 37 _cke_saved_src: src,37 'data-cke-saved-src' : src, 38 38 title : title, 39 39 alt : title 40 40 } -
_source/plugins/styles/plugin.js
406 406 var nodeType = currentNode.type; 407 407 var nodeName = nodeType == CKEDITOR.NODE_ELEMENT ? currentNode.getName() : null; 408 408 409 if ( nodeName && currentNode.get Attribute( '_cke_bookmark') )409 if ( nodeName && currentNode.getCustomData( 'cke-bookmark', 1 ) ) 410 410 { 411 411 currentNode = currentNode.getNextSourceNode( true ); 412 412 continue; … … 849 849 { 850 850 // Exclude the ones at header OR at tail, 851 851 // and ignore bookmark content between them. 852 var duoBrRegex = /(\S\s*)\n(?:\s|(<span[^>]+ _cke_bookmark.*?\/span>))*\n(?!$)/gi,852 var duoBrRegex = /(\S\s*)\n(?:\s|(<span[^>]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi, 853 853 blockName = preBlock.getName(), 854 854 splitedHtml = replace( preBlock.getOuterHtml(), 855 855 duoBrRegex, … … 871 871 var headBookmark = '', 872 872 tailBookmark = ''; 873 873 874 str = str.replace( /(^<span[^>]+ _cke_bookmark.*?\/span>)|(<span[^>]+_cke_bookmark.*?\/span>$)/gi,874 str = str.replace( /(^<span[^>]+data-cke-bookmark.*?\/span>)|(<span[^>]+data-cke-bookmark.*?\/span>$)/gi, 875 875 function( str, m1, m2 ){ 876 876 m1 && ( headBookmark = m1 ); 877 877 m2 && ( tailBookmark = m2 ); -
_source/plugins/table/dialogs/table.js
167 167 { 168 168 var th = theRow.getChild( i ); 169 169 // Skip bookmark nodes. (#6155) 170 if ( th.type == CKEDITOR.NODE_ELEMENT && !th.hasAttribute( ' _cke_bookmark' ) )170 if ( th.type == CKEDITOR.NODE_ELEMENT && !th.hasAttribute( 'data-cke-bookmark' ) ) 171 171 { 172 172 th.renameNode( 'th' ); 173 173 th.setAttribute( 'scope', 'col' ); -
_source/plugins/tableresize/plugin.js
298 298 document = editor.document; 299 299 300 300 resizer = CKEDITOR.dom.element.createFromHtml( 301 '<div cke_temp=1 contenteditable=false unselectable=on '+301 '<div data-cke-temp=1 contenteditable=false unselectable=on '+ 302 302 'style="position:absolute;cursor:col-resize;filter:alpha(opacity=0);opacity:0;' + 303 303 'padding:0;background-color:#004;background-image:none;border:0px none;z-index:10"></div>', document ); 304 304 -
_source/plugins/undo/plugin.js
152 152 selection = contents && editor.getSelection(); 153 153 154 154 // In IE, we need to remove the expando attributes. 155 CKEDITOR.env.ie && contents && ( contents = contents.replace( /\s+ _cke_expando=".*?"/g, '' ) );155 CKEDITOR.env.ie && contents && ( contents = contents.replace( /\s+data-cke-expando=".*?"/g, '' ) ); 156 156 157 157 this.contents = contents; 158 158 this.bookmarks = selection && selection.createBookmarks2( true ); … … 267 267 268 268 // In IE, we need to remove the expando attributes. 269 269 if ( CKEDITOR.env.ie ) 270 currentSnapshot = currentSnapshot.replace( /\s+ _cke_expando=".*?"/g, '' );270 currentSnapshot = currentSnapshot.replace( /\s+data-cke-expando=".*?"/g, '' ); 271 271 272 272 if ( beforeTypeImage.contents != currentSnapshot ) 273 273 { -
_source/plugins/wysiwygarea/plugin.js
88 88 // Webkit does not scroll to the cursor position after pasting (#5558) 89 89 if ( CKEDITOR.env.webkit ) 90 90 { 91 this.document.$.execCommand( 'inserthtml', false, '<span id="cke_paste_marker" cke_temp="1"></span>' );91 this.document.$.execCommand( 'inserthtml', false, '<span id="cke_paste_marker" data-cke-temp="1"></span>' ); 92 92 var marker = this.document.getById( 'cke_paste_marker' ); 93 93 marker.scrollIntoView(); 94 94 marker.remove(); … … 477 477 // is fully editable even before the editing iframe is fully loaded (#4455). 478 478 contentDomReadyHandler = CKEDITOR.tools.addFunction( contentDomReady ); 479 479 var activationScript = 480 '<script id="cke_actscrpt" type="text/javascript" cke_temp="1">' +480 '<script id="cke_actscrpt" type="text/javascript" data-cke-temp="1">' + 481 481 ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) + 482 482 'window.parent.CKEDITOR.tools.callFunction( ' + contentDomReadyHandler + ', window );' + 483 483 '</script>'; … … 779 779 780 780 // Build the additional stuff to be included into <head>. 781 781 var headExtra = 782 '<style type="text/css" cke_temp="1">' +782 '<style type="text/css" data-cke-temp="1">' + 783 783 editor._.styles.join( '\n' ) + 784 784 '</style>'; 785 785 … … 787 787 CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) + 788 788 headExtra ); 789 789 790 var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" cke_temp="1" />' : '';790 var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" data-cke-temp="1" />' : ''; 791 791 792 792 if ( fullPage ) 793 793 { … … 955 955 editor.on( 'contentDom', function () 956 956 { 957 957 var title = editor.document.getElementsByTag( 'title' ).getItem( 0 ); 958 title.set Attribute( '_cke_title', editor.document.$.title);958 title.setCustomData( 'cke-title', editor.document.$.title, 1 ); 959 959 editor.document.$.title = frameLabel; 960 960 }); 961 961