Ticket #6334: 6334_2.patch
File 6334_2.patch, 45.9 KB (added by , 12 years ago) |
---|
-
_source/core/dom/domobject.js
203 203 */ 204 204 domObjectProto.getCustomData = function( key ) 205 205 { 206 var expandoNumber = this.$ ._cke_expando,206 var expandoNumber = this.$[ 'data-cke-expando' ], 207 207 dataSlot = expandoNumber && customData[ expandoNumber ]; 208 208 209 209 return dataSlot && dataSlot[ key ]; … … 214 214 */ 215 215 domObjectProto.removeCustomData = function( key ) 216 216 { 217 var expandoNumber = this.$ ._cke_expando,217 var expandoNumber = this.$[ 'data-cke-expando' ], 218 218 dataSlot = expandoNumber && customData[ expandoNumber ], 219 219 retval = dataSlot && dataSlot[ key ]; 220 220 … … 236 236 // Clear all event listeners 237 237 this.removeAllListeners(); 238 238 239 var expandoNumber = this.$ ._cke_expando;239 var expandoNumber = this.$[ 'data-cke-expando' ]; 240 240 expandoNumber && delete customData[ expandoNumber ]; 241 241 }; 242 242 … … 249 249 */ 250 250 domObjectProto.getUniqueId = function() 251 251 { 252 return this.$ ._cke_expando || ( this.$._cke_expando= CKEDITOR.tools.getNextNumber() );252 return this.$[ 'data-cke-expando' ] || ( this.$[ 'data-cke-expando' ] = CKEDITOR.tools.getNextNumber() ); 253 253 }; 254 254 255 255 // 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. getAttribute( '_cke_bookmark' ) )792 if ( child.type == CKEDITOR.NODE_ELEMENT && child.data( 'cke-bookmark' ) ) 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. getAttribute( '_cke_bookmark' )920 while ( sibling.data( 'cke-bookmark' ) 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 … … 1560 1560 getDirection : function( useComputed ) 1561 1561 { 1562 1562 return useComputed ? this.getComputedStyle( 'direction' ) : this.getStyle( 'direction' ) || this.getAttribute( 'dir' ); 1563 }, 1564 1565 /** 1566 * Gets or sets custom data to be stored as HTML5 data-* attributes. 1567 * @name CKEDITOR.dom.element.data 1568 * @param {String} name The name of the attribute, execluding the 'data-' part. 1569 * @param {String} [value] The value to set. 1570 */ 1571 data : function ( name, value ) 1572 { 1573 if ( value === undefined ) 1574 return this.getAttribute( 'data-' + name ); 1575 this.setAttribute( 'data-' + name, value ); 1563 1576 } 1564 1577 }); -
_source/core/dom/node.js
114 114 115 115 if ( !cloneId ) 116 116 node.removeAttribute( 'id', false ); 117 node.removeAttribute( ' _cke_expando', false );117 node.removeAttribute( 'data-cke-expando', false ); 118 118 119 119 if ( includeChildren ) 120 120 { -
_source/core/dom/range.js
308 308 return node.type != CKEDITOR.NODE_TEXT 309 309 && node.getName() in CKEDITOR.dtd.$removeEmpty 310 310 || !CKEDITOR.tools.trim( node.getText() ) 311 || node.getParent(). hasAttribute( '_cke_bookmark' );311 || node.getParent().data( 'cke-bookmark' ); 312 312 } 313 313 314 314 var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(), … … 403 403 var collapsed = this.collapsed; 404 404 405 405 startNode = this.document.createElement( 'span' ); 406 startNode. setAttribute( '_cke_bookmark', 1 );406 startNode.data( 'cke-bookmark', 1 ); 407 407 startNode.setStyle( 'display', 'none' ); 408 408 409 409 // For IE, it must have something inside, otherwise it may be … … 713 713 endNode = this.endContainer; 714 714 715 715 if ( startNode.is && startNode.is( 'span' ) 716 && startNode. hasAttribute( '_cke_bookmark' ) )716 && startNode.data( 'cke-bookmark' ) ) 717 717 this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START ); 718 718 if ( endNode && endNode.is && endNode.is( 'span' ) 719 && endNode. hasAttribute( '_cke_bookmark' ) )719 && endNode.data( 'cke-bookmark' ) ) 720 720 this.setEndAt( endNode, CKEDITOR.POSITION_AFTER_END ); 721 721 }, 722 722 … … 922 922 // If this is a visible element. 923 923 // We need to check for the bookmark attribute because IE insists on 924 924 // rendering the display:none nodes we use for bookmarks. (#3363) 925 if ( sibling.$.offsetWidth > 0 && !sibling. getAttribute( '_cke_bookmark' ) )925 if ( sibling.$.offsetWidth > 0 && !sibling.data( 'cke-bookmark' ) ) 926 926 { 927 927 // We'll accept it only if we need 928 928 // whitespace, and this is an inline … … 1081 1081 // If this is a visible element. 1082 1082 // We need to check for the bookmark attribute because IE insists on 1083 1083 // rendering the display:none nodes we use for bookmarks. (#3363) 1084 if ( sibling.$.offsetWidth > 0 && !sibling. getAttribute( '_cke_bookmark' ) )1084 if ( sibling.$.offsetWidth > 0 && !sibling.data( 'cke-bookmark' ) ) 1085 1085 { 1086 1086 // We'll accept it only if we need 1087 1087 // 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.data( 'cke-bookmark' ) ); 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. getAttribute( '_cke_div_added' ) )40 if ( div && !div.data( 'cke-div-added' ) ) 41 41 { 42 42 toRemove.push( div ); 43 div. setAttribute( '_cke_div_added' );43 div.data( 'cke-div-added' ); 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. getAttribute( '_cke_real_element_type' ) )86 name = element. getAttribute( '_cke_real_element_type' );85 if ( element.data( 'cke-real-element-type' ) ) 86 name = element.data( 'cke-real-element-type' ); 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. getAttribute( '_cke_real_node_type' ) != CKEDITOR.NODE_ELEMENT )116 if ( fakeElement.data( 'cke-real-node-type' ) != CKEDITOR.NODE_ELEMENT ) 117 117 return null; 118 118 119 119 return CKEDITOR.dom.element.createFromHtml( 120 decodeURIComponent( fakeElement. getAttribute( '_cke_realelement' ) ),120 decodeURIComponent( fakeElement.data( 'cke-realelement' ) ), 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. getAttribute( '_cke_real_element_type' ) && fakeImage.getAttribute( '_cke_real_element_type' ) == 'flash' )193 if ( fakeImage && fakeImage.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'flash' ) 194 194 { 195 195 this.fakeImage = fakeImage; 196 196 -
_source/plugins/flash/plugin.js
75 75 { 76 76 var element = evt.data.element; 77 77 78 if ( element.is( 'img' ) && element. getAttribute( '_cke_real_element_type' ) == 'flash' )78 if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'flash' ) 79 79 evt.data.dialog = 'flash'; 80 80 }); 81 81 … … 85 85 editor.contextMenu.addListener( function( element, selection ) 86 86 { 87 87 if ( element && element.is( 'img' ) && !element.isReadOnly() 88 && element. getAttribute( '_cke_real_element_type' ) == 'flash' )88 && element.data( 'cke-real-element-type' ) == 'flash' ) 89 89 return { flash : CKEDITOR.TRISTATE_OFF }; 90 90 }); 91 91 } -
_source/plugins/forms/dialogs/button.js
52 52 setup : function( element ) 53 53 { 54 54 this.setValue( 55 element. getAttribute( '_cke_saved_name' ) ||55 element.data( 'cke-saved-name' ) || 56 56 element.getAttribute( 'name' ) || 57 57 '' ); 58 58 }, … … 61 61 var element = data.element; 62 62 63 63 if ( this.getValue() ) 64 element. setAttribute( '_cke_saved_name', this.getValue() );64 element.data( 'cke-saved-name', this.getValue() ); 65 65 else 66 66 { 67 element.removeAttribute( ' _cke_saved_name' );67 element.removeAttribute( 'data-cke-saved-name' ); 68 68 element.removeAttribute( 'name' ); 69 69 } 70 70 } -
_source/plugins/forms/dialogs/checkbox.js
51 51 setup : function( element ) 52 52 { 53 53 this.setValue( 54 element. getAttribute( '_cke_saved_name' ) ||54 element.data( 'cke-saved-name' ) || 55 55 element.getAttribute( 'name' ) || 56 56 '' ); 57 57 }, … … 61 61 62 62 // IE failed to update 'name' property on input elements, protect it now. 63 63 if ( this.getValue() ) 64 element. setAttribute( '_cke_saved_name', this.getValue() );64 element.data( 'cke-saved-name', this.getValue() ); 65 65 else 66 66 { 67 element.removeAttribute( ' _cke_saved_name' );67 element.removeAttribute( 'data-cke-saved-name' ); 68 68 element.removeAttribute( 'name' ); 69 69 } 70 70 } -
_source/plugins/forms/dialogs/form.js
84 84 accessKey : 'N', 85 85 setup : function( element ) 86 86 { 87 this.setValue( element. getAttribute( '_cke_saved_name' ) ||87 this.setValue( element.data( 'cke-saved-name' ) || 88 88 element.getAttribute( 'name' ) || 89 89 '' ); 90 90 }, 91 91 commit : function( element ) 92 92 { 93 93 if ( this.getValue() ) 94 element. setAttribute( '_cke_saved_name', this.getValue() );94 element.data( 'cke-saved-name', this.getValue() ); 95 95 else 96 96 { 97 element.removeAttribute( ' _cke_saved_name' );97 element.removeAttribute( 'data-cke-saved-name' ); 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. getAttribute( '_cke_real_element_type' ) && element.getAttribute( '_cke_real_element_type' ) == 'hiddenfield' )20 if ( element && element.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == '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. getAttribute( '_cke_saved_name' ) ||62 element.data( 'cke-saved-name' ) || 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. getAttribute( '_cke_saved_name' ) ||54 element.data( 'cke-saved-name' ) || 55 55 element.getAttribute( 'name' ) || 56 56 '' ); 57 57 }, … … 60 60 var element = data.element; 61 61 62 62 if ( this.getValue() ) 63 element. setAttribute( '_cke_saved_name', this.getValue() );63 element.data( 'cke-saved-name', this.getValue() ); 64 64 else 65 65 { 66 element.removeAttribute( ' _cke_saved_name' );66 element.removeAttribute( 'data-cke-saved-name' ); 67 67 element.removeAttribute( 'name' ); 68 68 } 69 69 } -
_source/plugins/forms/dialogs/select.js
193 193 setup : function( name, element ) 194 194 { 195 195 if ( name == 'clear' ) 196 this.setValue( this[ 'default'] || '' );196 this.setValue( this[ 'default' ] || '' ); 197 197 else if ( name == 'select' ) 198 198 { 199 199 this.setValue( 200 element. getAttribute( '_cke_saved_name' ) ||200 element.data( 'cke-saved-name' ) || 201 201 element.getAttribute( 'name' ) || 202 202 '' ); 203 203 } … … 205 205 commit : function( element ) 206 206 { 207 207 if ( this.getValue() ) 208 element. setAttribute( '_cke_saved_name', this.getValue() );208 element.data( 'cke-saved-name', this.getValue() ); 209 209 else 210 210 { 211 element.removeAttribute( ' _cke_saved_name' ) ;211 element.removeAttribute( 'data-cke-saved-name' ) ; 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. getAttribute( '_cke_saved_name' ) ||53 element.data( 'cke-saved-name' ) || 54 54 element.getAttribute( 'name' ) || 55 55 '' ); 56 56 }, 57 57 commit : function( element ) 58 58 { 59 59 if ( this.getValue() ) 60 element. setAttribute( '_cke_saved_name', this.getValue() );60 element.data( 'cke-saved-name', this.getValue() ); 61 61 else 62 62 { 63 element.removeAttribute( ' _cke_saved_name' );63 element.removeAttribute( 'data-cke-saved-name' ); 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. getAttribute( '_cke_saved_name' ) ||101 element.data( 'cke-saved-name' ) || 102 102 element.getAttribute( 'name' ) || 103 103 '' ); 104 104 }, … … 107 107 var element = data.element; 108 108 109 109 if ( this.getValue() ) 110 element. setAttribute( '_cke_saved_name', this.getValue() );110 element.data( 'cke-saved-name', this.getValue() ); 111 111 else 112 112 { 113 element.removeAttribute( ' _cke_saved_name' );113 element.removeAttribute( 'data-cke-saved-name' ); 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. getAttribute( '_cke_real_element_type' ) == 'hiddenfield' )170 if ( name == 'img' && element.data( 'cke-real-element-type' ) == '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. getAttribute( '_cke_real_element_type' ) == 'hiddenfield' )186 else if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'hiddenfield' ) 187 187 evt.data.dialog = 'hiddenfield'; 188 188 else if ( element.is( 'input' ) ) 189 189 { -
_source/plugins/htmldataprocessor/plugin.js
98 98 [ 99 99 // Event attributes (onXYZ) must not be directly set. They can become 100 100 // active in the editing area (IE|WebKit). 101 [ ( /^on/ ), ' _cke_pa_on' ]101 [ ( /^on/ ), 'data-cke-pa-on' ] 102 102 ] 103 103 }; 104 104 … … 121 121 attributeNames : 122 122 [ 123 123 // Attributes saved for changes and protected attributes. 124 [ ( /^ _cke_(saved|pa)_/ ), '' ],124 [ ( /^data-cke-(saved|pa)-/ ), '' ], 125 125 126 // All " _cke" attributes are to be ignored.127 [ ( /^ _cke.*/ ), '' ],126 // All "data-cke" attributes are to be ignored. 127 [ ( /^data-cke.*/ ), '' ], 128 128 129 129 [ 'hidefocus', '' ] 130 130 ], … … 138 138 if ( attribs ) 139 139 { 140 140 // Elements marked as temporary are to be ignored. 141 if ( attribs .cke_temp)141 if ( attribs[ 'data-cke-temp' ] ) 142 142 return false; 143 143 144 144 // Remove duplicated attributes - #3789. … … 146 146 savedAttributeName; 147 147 for ( var i = 0 ; i < attributeNames.length ; i++ ) 148 148 { 149 savedAttributeName = ' _cke_saved_' + attributeNames[ i ];149 savedAttributeName = 'data-cke-saved-' + attributeNames[ i ]; 150 150 savedAttributeName in attribs && ( delete attribs[ attributeNames[ i ] ] ); 151 151 } 152 152 } … … 181 181 { 182 182 if ( !( element.children.length || 183 183 element.attributes.name || 184 element.attributes ._cke_saved_name) )184 element.attributes[ 'data-cke-saved-name' ] ) ) 185 185 { 186 186 return false; 187 187 } … … 211 211 title : function( element ) 212 212 { 213 213 var titleText = element.children[ 0 ]; 214 titleText && ( titleText.value = element.attributes[ ' _cke_title' ] || '' );214 titleText && ( titleText.value = element.attributes[ 'data-cke-title' ] || '' ); 215 215 } 216 216 }, 217 217 … … 273 273 } 274 274 275 275 var protectAttributeRegex = /<((?:a|area|img|input)[\s\S]*?\s)((href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))([^>]*)>/gi, 276 findSavedSrcRegex = /\s _cke_saved_src\s*=/;276 findSavedSrcRegex = /\sdata-cke-saved-src\s*=/; 277 277 278 278 var protectElementsRegex = /(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi, 279 279 encodedElementsRegex = /<cke:encoded>([^<]*)<\/cke:encoded>/gi; … … 291 291 if ( attrName == 'src' && findSavedSrcRegex.test( tag ) ) 292 292 return tag; 293 293 else 294 return '<' + beginning + fullAttr + ' _cke_saved_' + fullAttr + end + '>';294 return '<' + beginning + fullAttr + ' data-cke-saved-' + fullAttr + end + '>'; 295 295 }); 296 296 } 297 297 -
_source/plugins/iframe/dialogs/iframe.js
54 54 this.fakeImage = this.iframeNode = null; 55 55 56 56 var fakeImage = this.getSelectedElement(); 57 if ( fakeImage && fakeImage. getAttribute( '_cke_real_element_type' ) && fakeImage.getAttribute( '_cke_real_element_type' ) == 'iframe' )57 if ( fakeImage && fakeImage.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'iframe' ) 58 58 { 59 59 this.fakeImage = fakeImage; 60 60 -
_source/plugins/iframe/plugin.js
56 56 editor.on( 'doubleclick', function( evt ) 57 57 { 58 58 var element = evt.data.element; 59 if ( element.is( 'img' ) && element. getAttribute( '_cke_real_element_type' ) == 'iframe' )59 if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'iframe' ) 60 60 evt.data.dialog = 'iframe'; 61 61 }); 62 62 … … 78 78 { 79 79 editor.contextMenu.addListener( function( element, selection ) 80 80 { 81 if ( element && element.is( 'img' ) && element. getAttribute( '_cke_real_element_type' ) == 'iframe' )81 if ( element && element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'iframe' ) 82 82 return { iframe : CKEDITOR.TRISTATE_OFF }; 83 83 }); 84 84 } -
_source/plugins/image/dialogs/image.js
319 319 this.setupContent( LINK, link ); 320 320 } 321 321 322 if ( element && element.getName() == 'img' && !element. getAttribute( '_cke_realelement' )322 if ( element && element.getName() == 'img' && !element.data( 'cke-realelement' ) 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. getAttribute( '_cke_saved_src' ) || element.getAttribute( 'src' );536 var url = element.data( 'cke-saved-src' ) || 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. setAttribute( '_cke_saved_src', decodeURI( this.getValue() ) );550 element.data( 'cke-saved-src', decodeURI( this.getValue() ) ); 551 551 element.setAttribute( 'src', decodeURI( this.getValue() ) ); 552 552 } 553 553 else if ( type == CLEANUP ) … … 1094 1094 { 1095 1095 if ( type == LINK ) 1096 1096 { 1097 var href = element. getAttribute( '_cke_saved_href' );1097 var href = element.data( 'cke-saved-href' ); 1098 1098 if ( !href ) 1099 1099 href = element.getAttribute( 'href' ); 1100 1100 this.setValue( href ); … … 1106 1106 { 1107 1107 if ( this.getValue() || this.isChanged() ) 1108 1108 { 1109 element. setAttribute( '_cke_saved_href', decodeURI( this.getValue() ) );1109 element.data( 'cke-saved-href', decodeURI( this.getValue() ) ); 1110 1110 element.setAttribute( 'href', 'javascript:void(0)/*' + 1111 1111 CKEDITOR.tools.getNextNumber() + '*/' ); 1112 1112 -
_source/plugins/image/plugin.js
30 30 { 31 31 var element = evt.data.element; 32 32 33 if ( element.is( 'img' ) && !element. getAttribute( '_cke_realelement' ) )33 if ( element.is( 'img' ) && !element.data( 'cke-realelement' ) ) 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. getAttribute( '_cke_realelement' ) || element.isReadOnly() )56 if ( !element || !element.is( 'img' ) || element.data( 'cke-realelement' ) || element.isReadOnly() ) 57 57 return null; 58 58 59 59 return { image : CKEDITOR.TRISTATE_OFF }; -
_source/plugins/link/dialogs/anchor.js
38 38 } 39 39 40 40 // Set name. 41 element.removeAttribute( ' _cke_saved_name' );41 element.removeAttribute( 'data-cke-saved-name' ); 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. getAttribute( '_cke_real_element_type' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' )64 if ( element && element.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == '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. getAttribute( '_cke_saved_href' ) || element.getAttribute( 'href' ) ) ) || '',97 var href = ( element && ( element.data( 'cke-saved-href' ) || 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. getAttribute( '_cke_pa_onclick' ) || element.getAttribute( 'onclick' ),187 var onclick = element.data( 'cke-pa-onclick' ) || 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. getAttribute( '_cke_realelement' ) && item.getAttribute( '_cke_real_element_type' ) == 'anchor' )245 if ( item.data( 'cke-realelement' ) && item.data( 'cke-real-element-type' ) == 'anchor' ) 246 246 anchors.push( editor.restoreRealElement( item ) ); 247 247 } 248 248 … … 1145 1145 if ( ( element = plugin.getSelectedLink( editor ) ) && element.hasAttribute( 'href' ) ) 1146 1146 selection.selectElement( element ); 1147 1147 else if ( ( element = selection.getSelectedElement() ) && element.is( 'img' ) 1148 && element. getAttribute( '_cke_real_element_type' )1149 && element. getAttribute( '_cke_real_element_type' ) == 'anchor' )1148 && element.data( 'cke-real-element-type' ) 1149 && element.data( 'cke-real-element-type' ) == 'anchor' ) 1150 1150 { 1151 1151 this.fakeObj = element; 1152 1152 element = editor.restoreRealElement( this.fakeObj ); … … 1173 1173 case 'url': 1174 1174 var protocol = ( data.url && data.url.protocol != undefined ) ? data.url.protocol : 'http://', 1175 1175 url = ( data.url && data.url.url ) || ''; 1176 attributes ._cke_saved_href= ( url.indexOf( '/' ) === 0 ) ? url : protocol + url;1176 attributes[ 'data-cke-saved-href' ] = ( url.indexOf( '/' ) === 0 ) ? url : protocol + url; 1177 1177 break; 1178 1178 case 'anchor': 1179 1179 var name = ( data.anchor && data.anchor.name ), 1180 1180 id = ( data.anchor && data.anchor.id ); 1181 attributes ._cke_saved_href= '#' + ( name || id || '' );1181 attributes[ 'data-cke-saved-href' ] = '#' + ( name || id || '' ); 1182 1182 break; 1183 1183 case 'email': 1184 1184 … … 1225 1225 } 1226 1226 } 1227 1227 1228 attributes ._cke_saved_href= linkHref.join( '' );1228 attributes[ 'data-cke-saved-href' ] = linkHref.join( '' ); 1229 1229 break; 1230 1230 } 1231 1231 … … 1253 1253 addFeature( 'top' ); 1254 1254 1255 1255 onclickList.push( featureList.join( ',' ), '\'); return false;' ); 1256 attributes[ ' _cke_pa_onclick' ] = onclickList.join( '' );1256 attributes[ 'data-cke-pa-onclick' ] = onclickList.join( '' ); 1257 1257 1258 1258 // Add the "target" attribute. (#5074) 1259 1259 removeAttributes.push( 'target' ); … … 1265 1265 else 1266 1266 removeAttributes.push( 'target' ); 1267 1267 1268 removeAttributes.push( ' _cke_pa_onclick', 'onclick' );1268 removeAttributes.push( 'data-cke-pa-onclick', 'onclick' ); 1269 1269 } 1270 1270 } 1271 1271 … … 1304 1304 { 1305 1305 // Short mailto link text view (#5736). 1306 1306 var text = new CKEDITOR.dom.text( data.type == 'email' ? 1307 data.email.address : attributes ._cke_saved_href, editor.document );1307 data.email.address : attributes[ 'data-cke-saved-href' ], editor.document ); 1308 1308 ranges[0].insertNode( text ); 1309 1309 ranges[0].selectNodeContents( text ); 1310 1310 selection.selectRanges( ranges ); … … 1333 1333 { 1334 1334 // We're only editing an existing link, so just overwrite the attributes. 1335 1335 var element = this._.selectedElement, 1336 href = element. getAttribute( '_cke_saved_href' ),1336 href = element.data( 'cke-saved-href' ), 1337 1337 textView = element.getHtml(); 1338 1338 1339 1339 // IE BUG: Setting the name attribute to an existing link doesn't work. … … 1360 1360 { 1361 1361 // Short mailto link text view (#5736). 1362 1362 element.setHtml( data.type == 'email' ? 1363 data.email.address : attributes ._cke_saved_href);1363 data.email.address : attributes[ 'data-cke-saved-href' ] ); 1364 1364 } 1365 1365 // Make the element display as an anchor if a name has been set. 1366 1366 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. getAttribute( '_cke_real_element_type' ) == 'anchor' )74 else if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == '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. getAttribute( '_cke_real_element_type' ) == 'anchor' );116 var isAnchor = ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'anchor' ); 117 117 118 118 if ( !isAnchor ) 119 119 { -
_source/plugins/placeholder/dialogs/placeholder.js
52 52 var range = editor.getSelection().getRanges()[0]; 53 53 range.shrink( CKEDITOR.SHRINK_TEXT ); 54 54 var node = range.startContainer; 55 while( node && !( node.type == CKEDITOR.NODE_ELEMENT && node. hasAttributes( '_cke_placeholder' ) ) )55 while( node && !( node.type == CKEDITOR.NODE_ELEMENT && node.data( 'cke-placeholder' ) ) ) 56 56 node = node.getParent(); 57 57 this._element = node; 58 58 } -
_source/plugins/placeholder/plugin.js
48 48 { 49 49 editor.contextMenu.addListener( function( element, selection ) 50 50 { 51 if ( !element || !element. hasAttribute( '_cke_placeholder' ) )51 if ( !element || !element.data( 'cke-placeholder' ) ) 52 52 return null; 53 53 54 54 return { editplaceholder : CKEDITOR.TRISTATE_OFF }; … … 59 59 editor.on( 'doubleclick', function( evt ) 60 60 { 61 61 var element = evt.data.element; 62 if ( element. hasAttribute( '_cke_placeholder' ) )62 if ( element.data( 'cke-placeholder' ) ) 63 63 evt.data.dialog = 'editplaceholder'; 64 64 }); 65 65 … … 75 75 { 76 76 editor.document.getBody().on( 'resizestart', function( evt ) 77 77 { 78 if ( editor.getSelection().getSelectedElement(). hasAttribute( '_cke_placeholder' ) )78 if ( editor.getSelection().getSelectedElement().data( 'cke-placeholder' ) ) 79 79 evt.data.preventDefault(); 80 80 }); 81 81 }); … … 111 111 { 112 112 'span' : function( element ) 113 113 { 114 if ( element.attributes && element.attributes ._cke_placeholder)114 if ( element.attributes && element.attributes[ 'data-cke-placeholder' ] ) 115 115 delete element.name; 116 116 } 117 117 } … … 128 128 var element = new CKEDITOR.dom.element( 'span', editor.document ); 129 129 element.setAttributes( 130 130 { 131 contentEditable : 'false',132 _cke_placeholder: 1,133 'class' : 'cke_placeholder'131 contentEditable : 'false', 132 'data-cke-placeholder' : 1, 133 'class' : 'cke_placeholder' 134 134 } 135 135 ); 136 136 -
_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. getAttribute( '_cke_realelement' ) )101 && currentNode.data( 'cke-realelement' ) ) 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 width : target.$.width, -
_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. getAttribute( '_cke_bookmark' ) )409 if ( nodeName && currentNode.data( 'cke-bookmark' ) ) 410 410 { 411 411 currentNode = currentNode.getNextSourceNode( true ); 412 412 continue; … … 883 883 { 884 884 // Exclude the ones at header OR at tail, 885 885 // and ignore bookmark content between them. 886 var duoBrRegex = /(\S\s*)\n(?:\s|(<span[^>]+ _cke_bookmark.*?\/span>))*\n(?!$)/gi,886 var duoBrRegex = /(\S\s*)\n(?:\s|(<span[^>]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi, 887 887 blockName = preBlock.getName(), 888 888 splitedHtml = replace( preBlock.getOuterHtml(), 889 889 duoBrRegex, … … 905 905 var headBookmark = '', 906 906 tailBookmark = ''; 907 907 908 str = str.replace( /(^<span[^>]+ _cke_bookmark.*?\/span>)|(<span[^>]+_cke_bookmark.*?\/span>$)/gi,908 str = str.replace( /(^<span[^>]+data-cke-bookmark.*?\/span>)|(<span[^>]+data-cke-bookmark.*?\/span>$)/gi, 909 909 function( str, m1, m2 ){ 910 910 m1 && ( headBookmark = m1 ); 911 911 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.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(); … … 478 478 // is fully editable even before the editing iframe is fully loaded (#4455). 479 479 contentDomReadyHandler = CKEDITOR.tools.addFunction( contentDomReady ); 480 480 var activationScript = 481 '<script id="cke_actscrpt" type="text/javascript" cke_temp="1">' +481 '<script id="cke_actscrpt" type="text/javascript" data-cke-temp="1">' + 482 482 ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) + 483 483 'window.parent.CKEDITOR.tools.callFunction( ' + contentDomReadyHandler + ', window );' + 484 484 '</script>'; … … 791 791 792 792 // Build the additional stuff to be included into <head>. 793 793 var headExtra = 794 '<style type="text/css" cke_temp="1">' +794 '<style type="text/css" data-cke-temp="1">' + 795 795 editor._.styles.join( '\n' ) + 796 796 '</style>'; 797 797 … … 799 799 CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) + 800 800 headExtra ); 801 801 802 var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" cke_temp="1" />' : '';802 var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" data-cke-temp="1" />' : ''; 803 803 804 804 if ( fullPage ) 805 805 { … … 971 971 editor.on( 'contentDom', function() 972 972 { 973 973 var title = editor.document.getElementsByTag( 'title' ).getItem( 0 ); 974 title. setAttribute( '_cke_title', editor.document.$.title );974 title.data( 'cke-title', editor.document.$.title ); 975 975 editor.document.$.title = frameLabel; 976 976 }); 977 977