Ticket #6334: 6334.patch

File 6334.patch, 44.5 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/core/dom/domobject.js

     
    141141
    142142(function( domObjectProto )
    143143{
    144         var customData = {};
     144        var customData = {},
     145                customDataAttrs = {};
    145146
    146147        CKEDITOR.on( 'reset', function()
    147148                {
    148149                        customData = {};
     150                        customDataAttrs = {};
    149151                });
    150152
    151153        /**
     
    171173         * @function
    172174         * @param {String} key A key used to identify the data slot.
    173175         * @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.
    174177         * @returns {CKEDITOR.dom.domObject} This DOM object instance.
    175178         * @see CKEDITOR.dom.domObject.prototype.getCustomData
    176179         * @example
    177180         * var element = new CKEDITOR.dom.element( 'span' );
    178181         * element.setCustomData( 'hasCustomData', true );
    179182         */
    180         domObjectProto.setCustomData = function( key, value )
     183        domObjectProto.setCustomData = function( key, value, useAttribute )
    181184        {
    182185                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
    183194                        dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} );
    184 
    185195                dataSlot[ key ] = value;
    186196
    187197                return this;
     
    193203         * @function
    194204         * @param {String} key The key used to identify the data slot.
    195205         * @returns {Object} This value set to the data slot.
     206         * @param {Boolean} fromAttribute Whether to get the data from a HTML5 data-* attribute.
    196207         * @see CKEDITOR.dom.domObject.prototype.setCustomData
    197208         * @example
    198209         * var element = new CKEDITOR.dom.element( 'span' );
    199210         * alert( element.getCustomData( 'hasCustomData' ) );  // e.g. 'true'
    200211         */
    201         domObjectProto.getCustomData = function( key )
     212        domObjectProto.getCustomData = function( key, fromAttribute )
    202213        {
    203                 var expandoNumber = this.$._cke_expando,
     214                if ( fromAttribute )
     215                        return this.getAttribute( 'data-' + key );
     216                var expandoNumber = this.$[ 'data-cke-expando' ],
    204217                        dataSlot = expandoNumber && customData[ expandoNumber ];
    205218
    206219                return dataSlot && dataSlot[ key ];
     
    209222        /**
    210223         * @name CKEDITOR.dom.domObject.prototype.removeCustomData
    211224         */
    212         domObjectProto.removeCustomData = function( key )
     225        domObjectProto.removeCustomData = function( key, fromAttribute )
    213226        {
    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 ],
    216229                        retval = dataSlot && dataSlot[ key ];
    217230
    218231                if ( typeof retval != 'undefined' )
    219232                        delete dataSlot[ key ];
     233                fromAttribute && this.removeAttribute( 'data-' + key );
    220234
    221235                return retval || null;
    222236        };
     
    233247                // Clear all event listeners
    234248                this.removeAllListeners();
    235249
    236                 var expandoNumber = this.$._cke_expando;
     250                var expandoNumber = this.$[ 'data-cke-expando' ];
    237251                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                }
    238261        };
    239262
    240263        /**
     
    242265         */
    243266        domObjectProto.getUniqueId = function()
    244267        {
    245                 return this.$._cke_expando || ( this.$._cke_expando = CKEDITOR.tools.getNextNumber() );
     268                return this.$[ 'data-cke-expando' ] || ( this.$[ 'data-cke-expando' ] = CKEDITOR.tools.getNextNumber() );
    246269        };
    247270
    248271        // Implement CKEDITOR.event.
  • _source/core/dom/element.js

     
    728728                        {
    729729                                var attribute = thisAttribs[ i ];
    730730
    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 ) )
    732732                                        return false;
    733733                        }
    734734
     
    739739                                for ( i = 0 ; i < otherLength ; i++ )
    740740                                {
    741741                                        attribute = otherAttribs[ i ];
    742                                         if ( attribute.specified && attribute.nodeName != '_cke_expando'
     742                                        if ( attribute.specified && attribute.nodeName != 'data-cke-expando'
    743743                                                        && attribute.nodeValue != this.getAttribute( attribute.nodeName ) )
    744744                                                return false;
    745745                                }
     
    789789                        {
    790790                                var child = children.getItem( i );
    791791
    792                                 if ( child.type == CKEDITOR.NODE_ELEMENT && child.getAttribute( '_cke_bookmark' ) )
     792                                if ( child.type == CKEDITOR.NODE_ELEMENT && child.getCustomData( 'cke-bookmark', 1 ) )
    793793                                        continue;
    794794
    795795                                if ( child.type == CKEDITOR.NODE_ELEMENT && !child.isEmptyInlineRemoveable()
     
    834834                                                                        return true;
    835835
    836836                                                        // Attributes to be ignored.
    837                                                         case '_cke_expando' :
     837                                                        case 'data-cke-expando' :
    838838                                                                continue;
    839839
    840840                                                        /*jsl:fallthru*/
     
    854854                                                attrsNum = attrs.length;
    855855
    856856                                        // 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 };
    858858
    859859                                        return attrsNum > 0 &&
    860860                                                ( attrsNum > 2 ||
     
    917917                                        // queuing them to be moved later. (#5567)
    918918                                        var pendingNodes = [];
    919919
    920                                         while ( sibling.getAttribute( '_cke_bookmark' )
     920                                        while ( sibling.getCustomData( 'cke-bookmark', 1 )
    921921                                                || sibling.isEmptyInlineRemoveable() )
    922922                                        {
    923923                                                pendingNodes.push( sibling );
     
    14831483
    14841484                        // Replace the node.
    14851485                        this.getParent() && this.$.parentNode.replaceChild( newNode.$, this.$ );
    1486                         newNode.$._cke_expando = this.$._cke_expando;
     1486                        newNode.$[ 'data-cke-expando' ] = this.$[ 'data-cke-expando' ];
    14871487                        this.$ = newNode.$;
    14881488                },
    14891489
  • _source/core/dom/node.js

     
    115115                                                return;
    116116
    117117                                        node.removeAttribute( 'id', false ) ;
    118                                         node.removeAttribute( '_cke_expando', false ) ;
     118                                        node.removeAttribute( 'data-cke-expando', false ) ;
    119119
    120120                                        var childs = node.childNodes;
    121121                                        for ( var i=0 ; i < childs.length ; i++ )
  • _source/core/dom/range.js

     
    305305                return node.type != CKEDITOR.NODE_TEXT
    306306                            && node.getName() in CKEDITOR.dtd.$removeEmpty
    307307                            || !CKEDITOR.tools.trim( node.getText() )
    308                             || node.getParent().hasAttribute( '_cke_bookmark' );
     308                            || node.getParent().getCustomData( 'cke-bookmark', 1 );
    309309        }
    310310
    311311        var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(),
     
    400400                        var collapsed = this.collapsed;
    401401
    402402                        startNode = this.document.createElement( 'span' );
    403                         startNode.setAttribute( '_cke_bookmark', 1 );
     403                        startNode.setCustomData( 'cke-bookmark', 1, 1 );
    404404                        startNode.setStyle( 'display', 'none' );
    405405
    406406                        // For IE, it must have something inside, otherwise it may be
     
    710710                                endNode = this.endContainer;
    711711
    712712                        if ( startNode.is && startNode.is( 'span' )
    713                                 && startNode.hasAttribute( '_cke_bookmark' ) )
     713                                && startNode.getCustomData( 'cke-bookmark', 1 ) )
    714714                                this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START );
    715715                        if ( endNode && endNode.is && endNode.is( 'span' )
    716                                 && endNode.hasAttribute( '_cke_bookmark' ) )
     716                                && endNode.getCustomData( 'cke-bookmark', 1 ) )
    717717                                this.setEndAt( endNode,  CKEDITOR.POSITION_AFTER_END );
    718718                },
    719719
     
    919919                                                                // If this is a visible element.
    920920                                                                // We need to check for the bookmark attribute because IE insists on
    921921                                                                // rendering the display:none nodes we use for bookmarks. (#3363)
    922                                                                 if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) )
     922                                                                if ( sibling.$.offsetWidth > 0 && !sibling.getCustomData( 'cke-bookmark', 1 ) )
    923923                                                                {
    924924                                                                        // We'll accept it only if we need
    925925                                                                        // whitespace, and this is an inline
     
    10781078                                                                // If this is a visible element.
    10791079                                                                // We need to check for the bookmark attribute because IE insists on
    10801080                                                                // rendering the display:none nodes we use for bookmarks. (#3363)
    1081                                                                 if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) )
     1081                                                                if ( sibling.$.offsetWidth > 0 && !sibling.getCustomData( 'cke-bookmark', 1 ) )
    10821082                                                                {
    10831083                                                                        // We'll accept it only if we need
    10841084                                                                        // whitespace, and this is an inline
  • _source/core/dom/walker.js

     
    374374                {
    375375                        return ( node && node.getName
    376376                                        && node.getName() == 'span'
    377                                         && node.hasAttribute('_cke_bookmark') );
     377                                        && node.getCustomData( 'cke-bookmark', 1 ) );
    378378                }
    379379
    380380                return function( node )
  • _source/core/htmlparser/element.js

     
    3434         */
    3535        this.children = [];
    3636
    37         var tagName = attributes._cke_real_element_type || name;
     37        var tagName = attributes[ 'data-cke-real-element-type' ] || name;
    3838
    3939        var dtd                 = CKEDITOR.dtd,
    4040                isBlockLike     = !!( dtd.$nonBodyContent[ tagName ] || dtd.$block[ tagName ] || dtd.$listItem[ tagName ] || dtd.$tableContent[ tagName ] || dtd.$nonEditable[ tagName ] || tagName == 'br' ),
  • _source/core/htmlparser/fragment.js

     
    125125                                var elementName, realElementName;
    126126                                if ( element.attributes
    127127                                         && ( realElementName =
    128                                                   element.attributes[ '_cke_real_element_type' ] ) )
     128                                                  element.attributes[ 'data-cke-real-element-type' ] ) )
    129129                                        elementName = realElementName;
    130130                                else
    131131                                        elementName =  element.name;
  • _source/plugins/div/plugin.js

     
    3737                                                                blockLimit = path.blockLimit,
    3838                                                                div = blockLimit.is( 'div' ) && blockLimit;
    3939
    40                                                         if ( div && !div.getAttribute( '_cke_div_added' ) )
     40                                                        if ( div && !div.getCustomData( 'cke-div-added', 1 ) )
    4141                                                        {
    4242                                                                toRemove.push( div );
    43                                                                 div.setAttribute( '_cke_div_added' );
     43                                                                div.setCustomData( 'cke-div-added', 1, 1 );
    4444                                                        }
    4545                                                }
    4646
  • _source/plugins/elementspath/plugin.js

     
    8282                                                {
    8383                                                        var index = elementsList.push( element ) - 1;
    8484                                                        var name;
    85                                                         if ( element.getAttribute( '_cke_real_element_type' ) )
    86                                                                 name = element.getAttribute( '_cke_real_element_type' );
     85                                                        if ( element.getCustomData( 'cke-real-element-type', 1 ) )
     86                                                                name = element.getCustomData( 'cke-real-element-type', 1 );
    8787                                                        else
    8888                                                                name = element.getName();
    8989
  • _source/plugins/fakeobjects/plugin.js

     
    1212                        $ : function( element )
    1313                        {
    1414                                var attributes = element.attributes,
    15                                         realHtml = attributes && attributes._cke_realelement,
     15                                        realHtml = attributes && attributes[ 'data-cke-realelement' ],
    1616                                        realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ),
    1717                                        realElement = realFragment && realFragment.children[ 0 ];
    1818
    1919                                // If we have width/height in the element, we must move it into
    2020                                // the real element.
    21                                 if ( realElement && element.attributes._cke_resizable )
     21                                if ( realElement && element.attributes[ 'data-cke-resizable' ] )
    2222                                {
    2323                                        var style = element.attributes.style;
    2424
     
    6868        {
    6969                'class' : className,
    7070                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,
    7373                alt : lang[ realElementType ] || lang.unknown,
    7474                align : realElement.getAttribute( 'align' ) || ''
    7575        };
    7676
    7777        if ( realElementType )
    78                 attributes._cke_real_element_type = realElementType;
     78                attributes[ 'data-cke-real-element-type' ] = realElementType;
    7979
    8080        if ( isResizable )
    81                 attributes._cke_resizable = isResizable;
     81                attributes[ 'data-cke-resizable' ] = isResizable;
    8282
    8383        return this.document.createElement( 'img', { attributes : attributes } );
    8484};
     
    9696        {
    9797                'class' : className,
    9898                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,
    101101                alt : lang[ realElementType ] || lang.unknown,
    102102                align : realElement.attributes.align || ''
    103103        };
    104104
    105105        if ( realElementType )
    106                 attributes._cke_real_element_type = realElementType;
     106                attributes[ 'data-cke-real-element-type' ] = realElementType;
    107107
    108108        if ( isResizable )
    109                 attributes._cke_resizable = isResizable;
     109                attributes[ 'data-cke-resizable' ] = isResizable;
    110110
    111111        return new CKEDITOR.htmlParser.element( 'img', attributes );
    112112};
    113113
    114114CKEDITOR.editor.prototype.restoreRealElement = function( fakeElement )
    115115{
    116         if ( fakeElement.getAttribute( '_cke_real_node_type' ) != CKEDITOR.NODE_ELEMENT )
     116        if ( fakeElement.getCustomData( 'cke-real-node-type', 1 ) != CKEDITOR.NODE_ELEMENT )
    117117                return null;
    118118
    119119        return CKEDITOR.dom.element.createFromHtml(
    120                 decodeURIComponent( fakeElement.getAttribute( '_cke_realelement' ) ),
     120                decodeURIComponent( fakeElement.getCustomData( 'cke-realelement', 1 ) ),
    121121                this.document );
    122122};
  • _source/plugins/flash/dialogs/flash.js

     
    190190
    191191                                // Try to detect any embed or object tag that has Flash parameters.
    192192                                var fakeImage = this.getSelectedElement();
    193                                 if ( fakeImage && fakeImage.getAttribute( '_cke_real_element_type' ) && fakeImage.getAttribute( '_cke_real_element_type' ) == 'flash' )
     193                                if ( fakeImage && fakeImage.getCustomData( 'cke-real-element-type', 1 ) == 'flash' )
    194194                                {
    195195                                        this.fakeImage = fakeImage;
    196196
  • _source/plugins/flash/plugin.js

     
    8181                                {
    8282                                        var element = evt.data.element;
    8383
    84                                         if ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'flash' )
     84                                        if ( element.is( 'img' ) && element.getCustomData( 'cke-real-element-type', 1 ) == 'flash' )
    8585                                                evt.data.dialog = 'flash';
    8686                                });
    8787
     
    9191                                editor.contextMenu.addListener( function( element, selection )
    9292                                        {
    9393                                                if ( element && element.is( 'img' ) && !element.isReadOnly()
    94                                                                 && element.getAttribute( '_cke_real_element_type' ) == 'flash' )
     94                                                                && element.getCustomData( 'cke-real-element-type', 1 ) == 'flash' )
    9595                                                        return { flash : CKEDITOR.TRISTATE_OFF };
    9696                                        });
    9797                        }
  • _source/plugins/forms/dialogs/button.js

     
    5252                                                setup : function( element )
    5353                                                {
    5454                                                        this.setValue(
    55                                                                         element.getAttribute( '_cke_saved_name' ) ||
     55                                                                        element.getCustomData( 'cke-saved-name', 1 ) ||
    5656                                                                        element.getAttribute( 'name' ) ||
    5757                                                                        '' );
    5858                                                },
     
    6161                                                        var element = data.element;
    6262
    6363                                                        if ( this.getValue() )
    64                                                                 element.setAttribute( '_cke_saved_name', this.getValue() );
     64                                                                element.setCustomData( 'cke-saved-name', this.getValue(), 1 );
    6565                                                        else
    6666                                                        {
    67                                                                 element.removeAttribute( '_cke_saved_name' );
     67                                                                element.removeCustomData( 'cke-saved-name', 1 );
    6868                                                                element.removeAttribute( 'name' );
    6969                                                        }
    7070                                                }
  • _source/plugins/forms/dialogs/checkbox.js

     
    5353                                                setup : function( element )
    5454                                                {
    5555                                                        this.setValue(
    56                                                                         element.getAttribute( '_cke_saved_name' ) ||
     56                                                                        element.getCustomData( 'cke-saved-name', 1 ) ||
    5757                                                                        element.getAttribute( 'name' ) ||
    5858                                                                        '' );
    5959                                                },
     
    6363
    6464                                                        // IE failed to update 'name' property on input elements, protect it now.
    6565                                                        if ( this.getValue() )
    66                                                                 element.setAttribute( '_cke_saved_name', this.getValue() );
     66                                                                element.setCustomData( 'cke-saved-name', this.getValue(), 1 );
    6767                                                        else
    6868                                                        {
    69                                                                 element.removeAttribute( '_cke_saved_name' );
     69                                                                element.removeCustomData( 'cke-saved-name', 1 );
    7070                                                                element.removeAttribute( 'name' );
    7171                                                        }
    7272                                                }
  • _source/plugins/forms/dialogs/form.js

     
    8484                                                accessKey : 'N',
    8585                                                setup : function( element )
    8686                                                {
    87                                                         this.setValue( element.getAttribute( '_cke_saved_name' ) ||
     87                                                        this.setValue( element.getCustomData( 'cke-saved-name', 1 ) ||
    8888                                                                        element.getAttribute( 'name' ) ||
    8989                                                                        '' );
    9090                                                },
    9191                                                commit : function( element )
    9292                                                {
    9393                                                        if ( this.getValue() )
    94                                                                 element.setAttribute( '_cke_saved_name', this.getValue() );
     94                                                                element.setCustomData( 'cke-saved-name', this.getValue(), 1 );
    9595                                                        else
    9696                                                        {
    97                                                                 element.removeAttribute( '_cke_saved_name' );
     97                                                                element.removeCustomData( 'cke-saved-name', 1 );
    9898                                                                element.removeAttribute( 'name' );
    9999                                                        }
    100100                                                }
  • _source/plugins/forms/dialogs/hiddenfield.js

     
    1717                                selection = editor.getSelection(),
    1818                                element = selection.getSelectedElement();
    1919
    20                         if ( element && element.getAttribute( '_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' )
    2121                        {
    2222                                this.hiddenField = element;
    2323                                element = editor.restoreRealElement( this.hiddenField );
     
    5959                                                setup : function( element )
    6060                                                {
    6161                                                        this.setValue(
    62                                                                         element.getAttribute( '_cke_saved_name' ) ||
     62                                                                        element.getCustomData( 'cke-saved-name', 1 ) ||
    6363                                                                        element.getAttribute( 'name' ) ||
    6464                                                                        '' );
    6565                                                },
  • _source/plugins/forms/dialogs/radio.js

     
    5151                                                setup : function( element )
    5252                                                {
    5353                                                        this.setValue(
    54                                                                         element.getAttribute( '_cke_saved_name' ) ||
     54                                                                        element.getCustomData( 'cke-saved-name', 1 ) ||
    5555                                                                        element.getAttribute( 'name' ) ||
    5656                                                                        '' );
    5757                                                },
     
    6060                                                        var element = data.element;
    6161
    6262                                                        if ( this.getValue() )
    63                                                                 element.setAttribute( '_cke_saved_name', this.getValue() );
     63                                                                element.setCustomData( 'cke-saved-name', this.getValue(), 1 );
    6464                                                        else
    6565                                                        {
    66                                                                 element.removeAttribute( '_cke_saved_name' );
     66                                                                element.removeCustomData( 'cke-saved-name', 1 );
    6767                                                                element.removeAttribute( 'name' );
    6868                                                        }
    6969                                                }
  • _source/plugins/forms/dialogs/select.js

     
    197197                                                        else if ( name == 'select' )
    198198                                                        {
    199199                                                                this.setValue(
    200                                                                                 element.getAttribute( '_cke_saved_name' ) ||
     200                                                                                element.getCustomData( 'cke-saved-name', 1 ) ||
    201201                                                                                element.getAttribute( 'name' ) ||
    202202                                                                                '' );
    203203                                                        }
     
    205205                                                commit : function( element )
    206206                                                {
    207207                                                        if ( this.getValue() )
    208                                                                 element.setAttribute( '_cke_saved_name', this.getValue() );
     208                                                                element.setCustomData( 'cke-saved-name', this.getValue(), 1 );
    209209                                                        else
    210210                                                        {
    211                                                                 element.removeAttribute( '_cke_saved_name' ) ;
     211                                                                element.removeCustomData( 'cke-saved-name', 1 );
    212212                                                                element.removeAttribute( 'name' );
    213213                                                        }
    214214                                                }
  • _source/plugins/forms/dialogs/textarea.js

     
    5050                                                setup : function( element )
    5151                                                {
    5252                                                        this.setValue(
    53                                                                         element.getAttribute( '_cke_saved_name' ) ||
     53                                                                        element.getCustomData( 'cke-saved-name', 1 ) ||
    5454                                                                        element.getAttribute( 'name' ) ||
    5555                                                                        '' );
    5656                                                },
    5757                                                commit : function( element )
    5858                                                {
    5959                                                        if ( this.getValue() )
    60                                                                 element.setAttribute( '_cke_saved_name', this.getValue() );
     60                                                                element.setCustomData( 'cke-saved-name', this.getValue(), 1 );
    6161                                                        else
    6262                                                        {
    63                                                                 element.removeAttribute( '_cke_saved_name' );
     63                                                                element.removeCustomData( 'cke-saved-name', 1 );
    6464                                                                element.removeAttribute( 'name' );
    6565                                                        }
    6666                                                }
  • _source/plugins/forms/dialogs/textfield.js

     
    9898                                                                setup : function( element )
    9999                                                                {
    100100                                                                        this.setValue(
    101                                                                                         element.getAttribute( '_cke_saved_name' ) ||
     101                                                                                        element.getCustomData( 'cke-saved-name', 1 ) ||
    102102                                                                                        element.getAttribute( 'name' ) ||
    103103                                                                                        '' );
    104104                                                                },
     
    107107                                                                        var element = data.element;
    108108
    109109                                                                        if ( this.getValue() )
    110                                                                                 element.setAttribute( '_cke_saved_name', this.getValue() );
     110                                                                                element.setCustomData( 'cke-saved-name', this.getValue(), 1 );
    111111                                                                        else
    112112                                                                        {
    113                                                                                 element.removeAttribute( '_cke_saved_name' );
     113                                                                                element.removeCustomData( 'cke-saved-name', 1 );
    114114                                                                                element.removeAttribute( 'name' );
    115115                                                                        }
    116116                                                                }
  • _source/plugins/forms/plugin.js

     
    167167                                                                return { imagebutton : CKEDITOR.TRISTATE_OFF };
    168168                                                }
    169169
    170                                                 if ( name == 'img' && element.getAttribute( '_cke_real_element_type' ) == 'hiddenfield' )
     170                                                if ( name == 'img' && element.getCustomData( 'cke-real-element-type', 1 ) == 'hiddenfield' )
    171171                                                        return { hiddenfield : CKEDITOR.TRISTATE_OFF };
    172172                                        }
    173173                                });
     
    183183                                        evt.data.dialog = 'select';
    184184                                else if ( element.is( 'textarea' ) )
    185185                                        evt.data.dialog = 'textarea';
    186                                 else if ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'hiddenfield' )
     186                                else if ( element.is( 'img' ) && element.getCustomData( 'cke-real-element-type', 1 ) == 'hiddenfield' )
    187187                                        evt.data.dialog = 'hiddenfield';
    188188                                else if ( element.is( 'input' ) )
    189189                                {
  • _source/plugins/htmldataprocessor/plugin.js

     
    8989                [
    9090                        // Event attributes (onXYZ) must not be directly set. They can become
    9191                        // active in the editing area (IE|WebKit).
    92                         [ ( /^on/ ), '_cke_pa_on' ]
     92                        [ ( /^on/ ), 'data-cke-pa-on' ]
    9393                ]
    9494        };
    9595
     
    112112                        attributeNames :
    113113                        [
    114114                                // Attributes saved for changes and protected attributes.
    115                                 [ ( /^_cke_(saved|pa)_/ ), '' ],
     115                                [ ( /^data-cke-(saved|pa)-/ ), '' ],
    116116
    117117                                // All "_cke" attributes are to be ignored.
    118                                 [ ( /^_cke.*/ ), '' ],
     118                                [ ( /^data-cke-.*/ ), '' ],
    119119
    120120                                [ 'hidefocus', '' ]
    121121                        ],
     
    129129                                        if ( attribs )
    130130                                        {
    131131                                                // Elements marked as temporary are to be ignored.
    132                                                 if ( attribs.cke_temp )
     132                                                if ( attribs[ 'data-cke-temp' ] )
    133133                                                        return false;
    134134
    135135                                                // Remove duplicated attributes - #3789.
     
    137137                                                        savedAttributeName;
    138138                                                for ( var i = 0 ; i < attributeNames.length ; i++ )
    139139                                                {
    140                                                         savedAttributeName = '_cke_saved_' + attributeNames[ i ];
     140                                                        savedAttributeName = 'data-cke-saved-' + attributeNames[ i ];
    141141                                                        savedAttributeName in attribs && ( delete attribs[ attributeNames[ i ] ] );
    142142                                                }
    143143                                        }
     
    172172                                {
    173173                                        if ( !( element.children.length ||
    174174                                                        element.attributes.name ||
    175                                                         element.attributes._cke_saved_name ) )
     175                                                        element.attributes[ 'data-cke-saved-name' ] ) )
    176176                                        {
    177177                                                return false;
    178178                                        }
     
    202202                                title : function( element )
    203203                                {
    204204                                        var titleText = element.children[ 0 ];
    205                                         titleText && ( titleText.value = element.attributes[ '_cke_title' ] || '' );
     205                                        titleText && ( titleText.value = element.attributes[ 'data-cke-title' ] || '' );
    206206                                }
    207207                        },
    208208
     
    264264        }
    265265
    266266        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*=/;
    268268
    269269        var protectElementsRegex = /(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,
    270270                encodedElementsRegex = /<cke:encoded>([^<]*)<\/cke:encoded>/gi;
     
    282282                                if ( attrName == 'src' && findSavedSrcRegex.test( tag ) )
    283283                                        return tag;
    284284                                else
    285                                         return '<' + beginning + fullAttr + ' _cke_saved_' + fullAttr + end + '>';
     285                                        return '<' + beginning + fullAttr + ' data-cke-saved-' + fullAttr + end + '>';
    286286                        });
    287287        }
    288288
  • _source/plugins/image/dialogs/image.js

     
    319319                                                this.setupContent( LINK, link );
    320320                                }
    321321
    322                                 if ( element && element.getName() == 'img' && !element.getAttribute( '_cke_realelement' )
     322                                if ( element && element.getName() == 'img' && !element.getCustomData( 'cke-realelement', 1 )
    323323                                        || element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'image' )
    324324                                {
    325325                                        this.imageEditMode = element.getName();
     
    533533                                                                                        {
    534534                                                                                                if ( type == IMAGE )
    535535                                                                                                {
    536                                                                                                         var url = element.getAttribute( '_cke_saved_src' ) || element.getAttribute( 'src' );
     536                                                                                                        var url = element.getCustomData( 'cke-saved-src', 1 ) || element.getAttribute( 'src' );
    537537                                                                                                        var field = this;
    538538
    539539                                                                                                        this.getDialog().dontResetSize = true;
     
    547547                                                                                        {
    548548                                                                                                if ( type == IMAGE && ( this.getValue() || this.isChanged() ) )
    549549                                                                                                {
    550                                                                                                         element.setAttribute( '_cke_saved_src', decodeURI( this.getValue() ) );
     550                                                                                                        element.setCustomData( 'cke-saved-src', decodeURI( this.getValue() ), 1 );
    551551                                                                                                        element.setAttribute( 'src', decodeURI( this.getValue() ) );
    552552                                                                                                }
    553553                                                                                                else if ( type == CLEANUP )
     
    10981098                                                        {
    10991099                                                                if ( type == LINK )
    11001100                                                                {
    1101                                                                         var href = element.getAttribute( '_cke_saved_href' );
     1101                                                                        var href = element.getCustomData( 'cke-saved-href', 1 );
    11021102                                                                        if ( !href )
    11031103                                                                                href = element.getAttribute( 'href' );
    11041104                                                                        this.setValue( href );
     
    11101110                                                                {
    11111111                                                                        if ( this.getValue() || this.isChanged() )
    11121112                                                                        {
    1113                                                                                 element.setAttribute( '_cke_saved_href', decodeURI( this.getValue() ) );
     1113                                                                                element.setCustomData( 'cke-saved-href', decodeURI( this.getValue() ), 1 );
    11141114                                                                                element.setAttribute( 'href', 'javascript:void(0)/*' +
    11151115                                                                                        CKEDITOR.tools.getNextNumber() + '*/' );
    11161116
  • _source/plugins/image/plugin.js

     
    3030                        {
    3131                                var element = evt.data.element;
    3232
    33                                 if ( element.is( 'img' ) && !element.getAttribute( '_cke_realelement' ) )
     33                                if ( element.is( 'img' ) && !element.getCustomData( 'cke-realelement', 1 ) )
    3434                                        evt.data.dialog = 'image';
    3535                        });
    3636
     
    5353                {
    5454                        editor.contextMenu.addListener( function( element, selection )
    5555                                {
    56                                         if ( !element || !element.is( 'img' ) || element.getAttribute( '_cke_realelement' ) || element.isReadOnly() )
     56                                        if ( !element || !element.is( 'img' ) || element.getCustomData( 'cke-realelement', 1 ) || element.isReadOnly() )
    5757                                                return null;
    5858
    5959                                        return { image : CKEDITOR.TRISTATE_OFF };
  • _source/plugins/indent/plugin.js

     
    283283
    284284                        var skipBookmarks = function( node )
    285285                        {
    286                                 return ! node.hasAttribute( '_cke_bookmark' );
     286                                return ! node.getCustomData( 'cke-bookmark', 1 );
    287287                        };
    288288
    289289                        var iterator = ranges.createIterator();
  • _source/plugins/link/dialogs/anchor.js

     
    3838                        }
    3939
    4040                        // Set name.
    41                         element.removeAttribute( '_cke_saved_name' );
     41                        element.removeCustomData( 'cke-saved-name', 1 );
    4242                        element.setAttribute( 'name', name );
    4343
    4444                        // Insert a new anchor.
     
    6161
    6262                        var selection = editor.getSelection();
    6363                        var element = selection.getSelectedElement();
    64                         if ( element && element.getAttribute( '_cke_real_element_type' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' )
     64                        if ( element && element.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' )
    6565                        {
    6666                                this.fakeObj = element;
    6767                                element = editor.restoreRealElement( this.fakeObj );
  • _source/plugins/link/dialogs/link.js

     
    9494
    9595        var parseLink = function( editor, element )
    9696        {
    97                 var href = ( element  && ( element.getAttribute( '_cke_saved_href' ) || element.getAttribute( 'href' ) ) ) || '',
     97                var href = ( element  && ( element.getCustomData( 'cke-saved-href', 1 ) || element.getAttribute( 'href' ) ) ) || '',
    9898                        javascriptMatch,
    9999                        emailMatch,
    100100                        anchorMatch,
     
    184184                        // IE BUG: target attribute is an empty string instead of null in IE if it's not set.
    185185                        if ( !target )
    186186                        {
    187                                 var onclick = element.getAttribute( '_cke_pa_onclick' ) || element.getAttribute( 'onclick' ),
     187                                var onclick = element.getCustomData( 'cke-pa-onclick', 1 ) || element.getAttribute( 'onclick' ),
    188188                                        onclickMatch = onclick && onclick.match( popupRegex );
    189189                                if ( onclickMatch )
    190190                                {
     
    242242                for ( var i = 0; i < elements.count() ; i++ )
    243243                {
    244244                        var item = elements.getItem( i );
    245                         if ( item.getAttribute( '_cke_realelement' ) && item.getAttribute( '_cke_real_element_type' ) == 'anchor' )
     245                        if ( item.getCustomData( 'cke-realelement', 1 ) && item.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' )
    246246                        {
    247247                                anchors.push( editor.restoreRealElement( item ) );
    248248                        }
     
    11441144                        if ( ( element = plugin.getSelectedLink( editor ) ) && element.hasAttribute( 'href' ) )
    11451145                                selection.selectElement( element );
    11461146                        else if ( ( element = selection.getSelectedElement() ) && element.is( 'img' )
    1147                                         && element.getAttribute( '_cke_real_element_type' )
    1148                                         && element.getAttribute( '_cke_real_element_type' ) == 'anchor' )
     1147                                        && element.getCustomData( 'cke-real-element-type', 1 )
     1148                                        && element.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' )
    11491149                        {
    11501150                                this.fakeObj = element;
    11511151                                element = editor.restoreRealElement( this.fakeObj );
     
    11721172                                case 'url':
    11731173                                        var protocol = ( data.url && data.url.protocol != undefined ) ? data.url.protocol : 'http://',
    11741174                                                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;
    11761176                                        break;
    11771177                                case 'anchor':
    11781178                                        var name = ( data.anchor && data.anchor.name ),
    11791179                                                id = ( data.anchor && data.anchor.id );
    1180                                         attributes._cke_saved_href = '#' + ( name || id || '' );
     1180                                        attributes[ 'data-cke-saved-href' ] = '#' + ( name || id || '' );
    11811181                                        break;
    11821182                                case 'email':
    11831183
     
    12241224                                                }
    12251225                                        }
    12261226
    1227                                         attributes._cke_saved_href = linkHref.join( '' );
     1227                                        attributes[ 'data-cke-saved-href' ] = linkHref.join( '' );
    12281228                                        break;
    12291229                        }
    12301230
     
    12521252                                        addFeature( 'top' );
    12531253
    12541254                                        onclickList.push( featureList.join( ',' ), '\'); return false;' );
    1255                                         attributes[ '_cke_pa_onclick' ] = onclickList.join( '' );
     1255                                        attributes[ 'data-cke-pa-onclick' ] = onclickList.join( '' );
    12561256                                }
    12571257                                else
    12581258                                {
     
    12611261                                        else
    12621262                                                removeAttributes.push( 'target' );
    12631263
    1264                                         removeAttributes.push( '_cke_pa_onclick', 'onclick' );
     1264                                        removeAttributes.push( 'data-cke-pa-onclick', 'onclick' );
    12651265                                }
    12661266                        }
    12671267
     
    13001300                                {
    13011301                                        // Short mailto link text view (#5736).
    13021302                                        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 );
    13041304                                        ranges[0].insertNode( text );
    13051305                                        ranges[0].selectNodeContents( text );
    13061306                                        selection.selectRanges( ranges );
     
    13291329                        {
    13301330                                // We're only editing an existing link, so just overwrite the attributes.
    13311331                                var element = this._.selectedElement,
    1332                                         href = element.getAttribute( '_cke_saved_href' ),
     1332                                        href = element.getCustomData( 'cke-saved-href', 1 ),
    13331333                                        textView = element.getHtml();
    13341334
    13351335                                // IE BUG: Setting the name attribute to an existing link doesn't work.
     
    13561356                                {
    13571357                                        // Short mailto link text view (#5736).
    13581358                                        element.setHtml( data.type == 'email' ?
    1359                                                 data.email.address : attributes._cke_saved_href );
     1359                                                data.email.address : attributes[ 'data-cke-saved-href' ] );
    13601360                                }
    13611361                                // Make the element display as an anchor if a name has been set.
    13621362                                if ( element.getAttribute( 'name' ) )
  • _source/plugins/link/plugin.js

     
    7171
    7272                                if ( element.is( 'a' ) )
    7373                                        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.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' )
    7575                                        evt.data.dialog = 'anchor';
    7676                        });
    7777
     
    113113                                        if ( !element || element.isReadOnly() )
    114114                                                return null;
    115115
    116                                         var isAnchor = ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' );
     116                                        var isAnchor = ( element.is( 'img' ) && element.getCustomData( 'cke-real-element-type', 1 ) == 'anchor' );
    117117
    118118                                        if ( !isAnchor )
    119119                                        {
  • _source/plugins/removeformat/plugin.js

     
    9898
    9999                                                // This node must not be a fake element.
    100100                                                if ( !( currentNode.getName() == 'img'
    101                                                         && currentNode.getAttribute( '_cke_realelement' ) )
     101                                                        && currentNode.getCustomData( 'cke-realelement', 1 ) )
    102102                                                        && filter( editor, currentNode ) )
    103103                                                {
    104104                                                        // Remove elements nodes that match with this style rules.
  • _source/plugins/smiley/dialogs/smiley.js

     
    3434                                attributes :
    3535                                {
    3636                                        src : src,
    37                                         _cke_saved_src : src,
     37                                        'data-cke-saved-src' : src,
    3838                                        title : title,
    3939                                        alt : title
    4040                                }
  • _source/plugins/styles/plugin.js

     
    406406                                var nodeType = currentNode.type;
    407407                                var nodeName = nodeType == CKEDITOR.NODE_ELEMENT ? currentNode.getName() : null;
    408408
    409                                 if ( nodeName && currentNode.getAttribute( '_cke_bookmark' ) )
     409                                if ( nodeName && currentNode.getCustomData( 'cke-bookmark', 1 ) )
    410410                                {
    411411                                        currentNode = currentNode.getNextSourceNode( true );
    412412                                        continue;
     
    849849        {
    850850                // Exclude the ones at header OR at tail,
    851851                // 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,
    853853                        blockName = preBlock.getName(),
    854854                        splitedHtml = replace( preBlock.getOuterHtml(),
    855855                                duoBrRegex,
     
    871871                var headBookmark = '',
    872872                        tailBookmark = '';
    873873
    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,
    875875                        function( str, m1, m2 ){
    876876                                        m1 && ( headBookmark = m1 );
    877877                                        m2 && ( tailBookmark = m2 );
  • _source/plugins/table/dialogs/table.js

     
    167167                                                {
    168168                                                        var th = theRow.getChild( i );
    169169                                                        // 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' ) )
    171171                                                        {
    172172                                                                th.renameNode( 'th' );
    173173                                                                th.setAttribute( 'scope', 'col' );
  • _source/plugins/tableresize/plugin.js

     
    298298                document = editor.document;
    299299
    300300                resizer = CKEDITOR.dom.element.createFromHtml(
    301                         '<div cke_temp=1 contenteditable=false unselectable=on '+
     301                        '<div data-cke-temp=1 contenteditable=false unselectable=on '+
    302302                        'style="position:absolute;cursor:col-resize;filter:alpha(opacity=0);opacity:0;' +
    303303                                'padding:0;background-color:#004;background-image:none;border:0px none;z-index:10"></div>', document );
    304304
  • _source/plugins/undo/plugin.js

     
    152152                        selection       = contents && editor.getSelection();
    153153
    154154                // 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, '' ) );
    156156
    157157                this.contents   = contents;
    158158                this.bookmarks  = selection && selection.createBookmarks2( true );
     
    267267
    268268                                                // In IE, we need to remove the expando attributes.
    269269                                                if ( CKEDITOR.env.ie )
    270                                                         currentSnapshot = currentSnapshot.replace( /\s+_cke_expando=".*?"/g, '' );
     270                                                        currentSnapshot = currentSnapshot.replace( /\s+data-cke-expando=".*?"/g, '' );
    271271
    272272                                                if ( beforeTypeImage.contents != currentSnapshot )
    273273                                                {
  • _source/plugins/wysiwygarea/plugin.js

     
    8888                        // Webkit does not scroll to the cursor position after pasting (#5558)
    8989                        if ( CKEDITOR.env.webkit )
    9090                        {
    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>' );
    9292                                var marker = this.document.getById( 'cke_paste_marker' );
    9393                                marker.scrollIntoView();
    9494                                marker.remove();
     
    477477                                        // is fully editable even before the editing iframe is fully loaded (#4455).
    478478                                        contentDomReadyHandler = CKEDITOR.tools.addFunction( contentDomReady );
    479479                                        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">' +
    481481                                                        ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) +
    482482                                                        'window.parent.CKEDITOR.tools.callFunction( ' + contentDomReadyHandler + ', window );' +
    483483                                                '</script>';
     
    779779
    780780                                                                // Build the additional stuff to be included into <head>.
    781781                                                                var headExtra =
    782                                                                         '<style type="text/css" cke_temp="1">' +
     782                                                                        '<style type="text/css" data-cke-temp="1">' +
    783783                                                                                editor._.styles.join( '\n' ) +
    784784                                                                        '</style>';
    785785
     
    787787                                                                        CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
    788788                                                                        headExtra );
    789789
    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" />' : '';
    791791
    792792                                                                if ( fullPage )
    793793                                                                {
     
    955955                        editor.on( 'contentDom', function ()
    956956                                {
    957957                                        var title = editor.document.getElementsByTag( 'title' ).getItem( 0 );
    958                                         title.setAttribute( '_cke_title', editor.document.$.title );
     958                                        title.setCustomData( 'cke-title', editor.document.$.title, 1 );
    959959                                        editor.document.$.title = frameLabel;
    960960                                });
    961961
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy