Ticket #6334: 6334_2.patch

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

     
    203203         */
    204204        domObjectProto.getCustomData = function( key )
    205205        {
    206                 var expandoNumber = this.$._cke_expando,
     206                var expandoNumber = this.$[ 'data-cke-expando' ],
    207207                        dataSlot = expandoNumber && customData[ expandoNumber ];
    208208
    209209                return dataSlot && dataSlot[ key ];
     
    214214         */
    215215        domObjectProto.removeCustomData = function( key )
    216216        {
    217                 var expandoNumber = this.$._cke_expando,
     217                var expandoNumber = this.$[ 'data-cke-expando' ],
    218218                        dataSlot = expandoNumber && customData[ expandoNumber ],
    219219                        retval = dataSlot && dataSlot[ key ];
    220220
     
    236236                // Clear all event listeners
    237237                this.removeAllListeners();
    238238
    239                 var expandoNumber = this.$._cke_expando;
     239                var expandoNumber = this.$[ 'data-cke-expando' ];
    240240                expandoNumber && delete customData[ expandoNumber ];
    241241        };
    242242
     
    249249         */
    250250        domObjectProto.getUniqueId = function()
    251251        {
    252                 return this.$._cke_expando || ( this.$._cke_expando = CKEDITOR.tools.getNextNumber() );
     252                return this.$[ 'data-cke-expando' ] || ( this.$[ 'data-cke-expando' ] = CKEDITOR.tools.getNextNumber() );
    253253        };
    254254
    255255        // 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.data( 'cke-bookmark' ) )
    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.data( 'cke-bookmark' )
    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
     
    15601560                getDirection : function( useComputed )
    15611561                {
    15621562                        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 );
    15631576                }
    15641577        });
  • _source/core/dom/node.js

     
    114114
    115115                                if ( !cloneId )
    116116                                        node.removeAttribute( 'id', false );
    117                                 node.removeAttribute( '_cke_expando', false );
     117                                node.removeAttribute( 'data-cke-expando', false );
    118118
    119119                                if ( includeChildren )
    120120                                {
  • _source/core/dom/range.js

     
    308308                return node.type != CKEDITOR.NODE_TEXT
    309309                            && node.getName() in CKEDITOR.dtd.$removeEmpty
    310310                            || !CKEDITOR.tools.trim( node.getText() )
    311                             || node.getParent().hasAttribute( '_cke_bookmark' );
     311                            || node.getParent().data( 'cke-bookmark' );
    312312        }
    313313
    314314        var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(),
     
    403403                        var collapsed = this.collapsed;
    404404
    405405                        startNode = this.document.createElement( 'span' );
    406                         startNode.setAttribute( '_cke_bookmark', 1 );
     406                        startNode.data( 'cke-bookmark', 1 );
    407407                        startNode.setStyle( 'display', 'none' );
    408408
    409409                        // For IE, it must have something inside, otherwise it may be
     
    713713                                endNode = this.endContainer;
    714714
    715715                        if ( startNode.is && startNode.is( 'span' )
    716                                 && startNode.hasAttribute( '_cke_bookmark' ) )
     716                                && startNode.data( 'cke-bookmark' ) )
    717717                                this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START );
    718718                        if ( endNode && endNode.is && endNode.is( 'span' )
    719                                 && endNode.hasAttribute( '_cke_bookmark' ) )
     719                                && endNode.data( 'cke-bookmark' ) )
    720720                                this.setEndAt( endNode,  CKEDITOR.POSITION_AFTER_END );
    721721                },
    722722
     
    922922                                                                // If this is a visible element.
    923923                                                                // We need to check for the bookmark attribute because IE insists on
    924924                                                                // 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' ) )
    926926                                                                {
    927927                                                                        // We'll accept it only if we need
    928928                                                                        // whitespace, and this is an inline
     
    10811081                                                                // If this is a visible element.
    10821082                                                                // We need to check for the bookmark attribute because IE insists on
    10831083                                                                // 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' ) )
    10851085                                                                {
    10861086                                                                        // We'll accept it only if we need
    10871087                                                                        // 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.data( 'cke-bookmark' ) );
    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.data( 'cke-div-added' ) )
    4141                                                        {
    4242                                                                toRemove.push( div );
    43                                                                 div.setAttribute( '_cke_div_added' );
     43                                                                div.data( 'cke-div-added' );
    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.data( 'cke-real-element-type' ) )
     86                                                                name = element.data( 'cke-real-element-type' );
    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.data( 'cke-real-node-type' ) != CKEDITOR.NODE_ELEMENT )
    117117                return null;
    118118
    119119        return CKEDITOR.dom.element.createFromHtml(
    120                 decodeURIComponent( fakeElement.getAttribute( '_cke_realelement' ) ),
     120                decodeURIComponent( fakeElement.data( 'cke-realelement' ) ),
    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.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'flash' )
    194194                                {
    195195                                        this.fakeImage = fakeImage;
    196196
  • _source/plugins/flash/plugin.js

     
    7575                                {
    7676                                        var element = evt.data.element;
    7777
    78                                         if ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'flash' )
     78                                        if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'flash' )
    7979                                                evt.data.dialog = 'flash';
    8080                                });
    8181
     
    8585                                editor.contextMenu.addListener( function( element, selection )
    8686                                        {
    8787                                                if ( element && element.is( 'img' ) && !element.isReadOnly()
    88                                                                 && element.getAttribute( '_cke_real_element_type' ) == 'flash' )
     88                                                                && element.data( 'cke-real-element-type' ) == 'flash' )
    8989                                                        return { flash : CKEDITOR.TRISTATE_OFF };
    9090                                        });
    9191                        }
  • _source/plugins/forms/dialogs/button.js

     
    5252                                                setup : function( element )
    5353                                                {
    5454                                                        this.setValue(
    55                                                                         element.getAttribute( '_cke_saved_name' ) ||
     55                                                                        element.data( 'cke-saved-name' ) ||
    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.data( 'cke-saved-name', this.getValue() );
    6565                                                        else
    6666                                                        {
    67                                                                 element.removeAttribute( '_cke_saved_name' );
     67                                                                element.removeAttribute( 'data-cke-saved-name' );
    6868                                                                element.removeAttribute( 'name' );
    6969                                                        }
    7070                                                }
  • _source/plugins/forms/dialogs/checkbox.js

     
    5151                                                setup : function( element )
    5252                                                {
    5353                                                        this.setValue(
    54                                                                         element.getAttribute( '_cke_saved_name' ) ||
     54                                                                        element.data( 'cke-saved-name' ) ||
    5555                                                                        element.getAttribute( 'name' ) ||
    5656                                                                        '' );
    5757                                                },
     
    6161
    6262                                                        // IE failed to update 'name' property on input elements, protect it now.
    6363                                                        if ( this.getValue() )
    64                                                                 element.setAttribute( '_cke_saved_name', this.getValue() );
     64                                                                element.data( 'cke-saved-name', this.getValue() );
    6565                                                        else
    6666                                                        {
    67                                                                 element.removeAttribute( '_cke_saved_name' );
     67                                                                element.removeAttribute( 'data-cke-saved-name' );
    6868                                                                element.removeAttribute( 'name' );
    6969                                                        }
    7070                                                }
  • _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.data( 'cke-saved-name' ) ||
    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.data( 'cke-saved-name', this.getValue() );
    9595                                                        else
    9696                                                        {
    97                                                                 element.removeAttribute( '_cke_saved_name' );
     97                                                                element.removeAttribute( 'data-cke-saved-name' );
    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.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == '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.data( 'cke-saved-name' ) ||
    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.data( 'cke-saved-name' ) ||
    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.data( 'cke-saved-name', this.getValue() );
    6464                                                        else
    6565                                                        {
    66                                                                 element.removeAttribute( '_cke_saved_name' );
     66                                                                element.removeAttribute( 'data-cke-saved-name' );
    6767                                                                element.removeAttribute( 'name' );
    6868                                                        }
    6969                                                }
  • _source/plugins/forms/dialogs/select.js

     
    193193                                                setup : function( name, element )
    194194                                                {
    195195                                                        if ( name == 'clear' )
    196                                                                 this.setValue( this['default'] || '' );
     196                                                                this.setValue( this[ 'default' ] || '' );
    197197                                                        else if ( name == 'select' )
    198198                                                        {
    199199                                                                this.setValue(
    200                                                                                 element.getAttribute( '_cke_saved_name' ) ||
     200                                                                                element.data( 'cke-saved-name' ) ||
    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.data( 'cke-saved-name', this.getValue() );
    209209                                                        else
    210210                                                        {
    211                                                                 element.removeAttribute( '_cke_saved_name' ) ;
     211                                                                element.removeAttribute( 'data-cke-saved-name' ) ;
    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.data( 'cke-saved-name' ) ||
    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.data( 'cke-saved-name', this.getValue() );
    6161                                                        else
    6262                                                        {
    63                                                                 element.removeAttribute( '_cke_saved_name' );
     63                                                                element.removeAttribute( 'data-cke-saved-name' );
    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.data( 'cke-saved-name' ) ||
    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.data( 'cke-saved-name', this.getValue() );
    111111                                                                        else
    112112                                                                        {
    113                                                                                 element.removeAttribute( '_cke_saved_name' );
     113                                                                                element.removeAttribute( 'data-cke-saved-name' );
    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.data( 'cke-real-element-type' ) == '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.data( 'cke-real-element-type' ) == 'hiddenfield' )
    187187                                        evt.data.dialog = 'hiddenfield';
    188188                                else if ( element.is( 'input' ) )
    189189                                {
  • _source/plugins/htmldataprocessor/plugin.js

     
    9898                [
    9999                        // Event attributes (onXYZ) must not be directly set. They can become
    100100                        // active in the editing area (IE|WebKit).
    101                         [ ( /^on/ ), '_cke_pa_on' ]
     101                        [ ( /^on/ ), 'data-cke-pa-on' ]
    102102                ]
    103103        };
    104104
     
    121121                        attributeNames :
    122122                        [
    123123                                // Attributes saved for changes and protected attributes.
    124                                 [ ( /^_cke_(saved|pa)_/ ), '' ],
     124                                [ ( /^data-cke-(saved|pa)-/ ), '' ],
    125125
    126                                 // All "_cke" attributes are to be ignored.
    127                                 [ ( /^_cke.*/ ), '' ],
     126                                // All "data-cke" attributes are to be ignored.
     127                                [ ( /^data-cke.*/ ), '' ],
    128128
    129129                                [ 'hidefocus', '' ]
    130130                        ],
     
    138138                                        if ( attribs )
    139139                                        {
    140140                                                // Elements marked as temporary are to be ignored.
    141                                                 if ( attribs.cke_temp )
     141                                                if ( attribs[ 'data-cke-temp' ] )
    142142                                                        return false;
    143143
    144144                                                // Remove duplicated attributes - #3789.
     
    146146                                                        savedAttributeName;
    147147                                                for ( var i = 0 ; i < attributeNames.length ; i++ )
    148148                                                {
    149                                                         savedAttributeName = '_cke_saved_' + attributeNames[ i ];
     149                                                        savedAttributeName = 'data-cke-saved-' + attributeNames[ i ];
    150150                                                        savedAttributeName in attribs && ( delete attribs[ attributeNames[ i ] ] );
    151151                                                }
    152152                                        }
     
    181181                                {
    182182                                        if ( !( element.children.length ||
    183183                                                        element.attributes.name ||
    184                                                         element.attributes._cke_saved_name ) )
     184                                                        element.attributes[ 'data-cke-saved-name' ] ) )
    185185                                        {
    186186                                                return false;
    187187                                        }
     
    211211                                title : function( element )
    212212                                {
    213213                                        var titleText = element.children[ 0 ];
    214                                         titleText && ( titleText.value = element.attributes[ '_cke_title' ] || '' );
     214                                        titleText && ( titleText.value = element.attributes[ 'data-cke-title' ] || '' );
    215215                                }
    216216                        },
    217217
     
    273273        }
    274274
    275275        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*=/;
    277277
    278278        var protectElementsRegex = /(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,
    279279                encodedElementsRegex = /<cke:encoded>([^<]*)<\/cke:encoded>/gi;
     
    291291                                if ( attrName == 'src' && findSavedSrcRegex.test( tag ) )
    292292                                        return tag;
    293293                                else
    294                                         return '<' + beginning + fullAttr + ' _cke_saved_' + fullAttr + end + '>';
     294                                        return '<' + beginning + fullAttr + ' data-cke-saved-' + fullAttr + end + '>';
    295295                        });
    296296        }
    297297
  • _source/plugins/iframe/dialogs/iframe.js

     
    5454                                this.fakeImage = this.iframeNode = null;
    5555
    5656                                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' )
    5858                                {
    5959                                        this.fakeImage = fakeImage;
    6060
  • _source/plugins/iframe/plugin.js

     
    5656                        editor.on( 'doubleclick', function( evt )
    5757                                {
    5858                                        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' )
    6060                                                evt.data.dialog = 'iframe';
    6161                                });
    6262
     
    7878                        {
    7979                                editor.contextMenu.addListener( function( element, selection )
    8080                                        {
    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' )
    8282                                                        return { iframe : CKEDITOR.TRISTATE_OFF };
    8383                                        });
    8484                        }
  • _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.data( 'cke-realelement' )
    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.data( 'cke-saved-src' ) || 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.data( 'cke-saved-src', decodeURI( this.getValue() ) );
    551551                                                                                                        element.setAttribute( 'src', decodeURI( this.getValue() ) );
    552552                                                                                                }
    553553                                                                                                else if ( type == CLEANUP )
     
    10941094                                                        {
    10951095                                                                if ( type == LINK )
    10961096                                                                {
    1097                                                                         var href = element.getAttribute( '_cke_saved_href' );
     1097                                                                        var href = element.data( 'cke-saved-href' );
    10981098                                                                        if ( !href )
    10991099                                                                                href = element.getAttribute( 'href' );
    11001100                                                                        this.setValue( href );
     
    11061106                                                                {
    11071107                                                                        if ( this.getValue() || this.isChanged() )
    11081108                                                                        {
    1109                                                                                 element.setAttribute( '_cke_saved_href', decodeURI( this.getValue() ) );
     1109                                                                                element.data( 'cke-saved-href', decodeURI( this.getValue() ) );
    11101110                                                                                element.setAttribute( 'href', 'javascript:void(0)/*' +
    11111111                                                                                        CKEDITOR.tools.getNextNumber() + '*/' );
    11121112
  • _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.data( 'cke-realelement' ) )
    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.data( 'cke-realelement' ) || element.isReadOnly() )
    5757                                                return null;
    5858
    5959                                        return { image : CKEDITOR.TRISTATE_OFF };
  • _source/plugins/link/dialogs/anchor.js

     
    3838                        }
    3939
    4040                        // Set name.
    41                         element.removeAttribute( '_cke_saved_name' );
     41                        element.removeAttribute( 'data-cke-saved-name' );
    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.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == '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.data( 'cke-saved-href' ) || 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.data( 'cke-pa-onclick' ) || 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.data( 'cke-realelement' ) && item.data( 'cke-real-element-type' ) == 'anchor' )
    246246                                anchors.push( editor.restoreRealElement( item ) );
    247247                }
    248248
     
    11451145                        if ( ( element = plugin.getSelectedLink( editor ) ) && element.hasAttribute( 'href' ) )
    11461146                                selection.selectElement( element );
    11471147                        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' )
    11501150                        {
    11511151                                this.fakeObj = element;
    11521152                                element = editor.restoreRealElement( this.fakeObj );
     
    11731173                                case 'url':
    11741174                                        var protocol = ( data.url && data.url.protocol != undefined ) ? data.url.protocol : 'http://',
    11751175                                                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;
    11771177                                        break;
    11781178                                case 'anchor':
    11791179                                        var name = ( data.anchor && data.anchor.name ),
    11801180                                                id = ( data.anchor && data.anchor.id );
    1181                                         attributes._cke_saved_href = '#' + ( name || id || '' );
     1181                                        attributes[ 'data-cke-saved-href' ] = '#' + ( name || id || '' );
    11821182                                        break;
    11831183                                case 'email':
    11841184
     
    12251225                                                }
    12261226                                        }
    12271227
    1228                                         attributes._cke_saved_href = linkHref.join( '' );
     1228                                        attributes[ 'data-cke-saved-href' ] = linkHref.join( '' );
    12291229                                        break;
    12301230                        }
    12311231
     
    12531253                                        addFeature( 'top' );
    12541254
    12551255                                        onclickList.push( featureList.join( ',' ), '\'); return false;' );
    1256                                         attributes[ '_cke_pa_onclick' ] = onclickList.join( '' );
     1256                                        attributes[ 'data-cke-pa-onclick' ] = onclickList.join( '' );
    12571257
    12581258                                        // Add the "target" attribute. (#5074)
    12591259                                        removeAttributes.push( 'target' );
     
    12651265                                        else
    12661266                                                removeAttributes.push( 'target' );
    12671267
    1268                                         removeAttributes.push( '_cke_pa_onclick', 'onclick' );
     1268                                        removeAttributes.push( 'data-cke-pa-onclick', 'onclick' );
    12691269                                }
    12701270                        }
    12711271
     
    13041304                                {
    13051305                                        // Short mailto link text view (#5736).
    13061306                                        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 );
    13081308                                        ranges[0].insertNode( text );
    13091309                                        ranges[0].selectNodeContents( text );
    13101310                                        selection.selectRanges( ranges );
     
    13331333                        {
    13341334                                // We're only editing an existing link, so just overwrite the attributes.
    13351335                                var element = this._.selectedElement,
    1336                                         href = element.getAttribute( '_cke_saved_href' ),
     1336                                        href = element.data( 'cke-saved-href' ),
    13371337                                        textView = element.getHtml();
    13381338
    13391339                                // IE BUG: Setting the name attribute to an existing link doesn't work.
     
    13601360                                {
    13611361                                        // Short mailto link text view (#5736).
    13621362                                        element.setHtml( data.type == 'email' ?
    1363                                                 data.email.address : attributes._cke_saved_href );
     1363                                                data.email.address : attributes[ 'data-cke-saved-href' ] );
    13641364                                }
    13651365                                // Make the element display as an anchor if a name has been set.
    13661366                                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.data( 'cke-real-element-type' ) == '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.data( 'cke-real-element-type' ) == 'anchor' );
    117117
    118118                                        if ( !isAnchor )
    119119                                        {
  • _source/plugins/placeholder/dialogs/placeholder.js

     
    5252                                        var range = editor.getSelection().getRanges()[0];
    5353                                        range.shrink( CKEDITOR.SHRINK_TEXT );
    5454                                        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' ) ) )
    5656                                                node = node.getParent();
    5757                                        this._element = node;
    5858                                }
  • _source/plugins/placeholder/plugin.js

     
    4848                                {
    4949                                        editor.contextMenu.addListener( function( element, selection )
    5050                                                {
    51                                                         if ( !element || !element.hasAttribute( '_cke_placeholder' ) )
     51                                                        if ( !element || !element.data( 'cke-placeholder' ) )
    5252                                                                return null;
    5353
    5454                                                        return { editplaceholder : CKEDITOR.TRISTATE_OFF };
     
    5959                        editor.on( 'doubleclick', function( evt )
    6060                                {
    6161                                        var element = evt.data.element;
    62                                         if ( element.hasAttribute( '_cke_placeholder' ) )
     62                                        if ( element.data( 'cke-placeholder' ) )
    6363                                                evt.data.dialog = 'editplaceholder';
    6464                                });
    6565
     
    7575                                {
    7676                                        editor.document.getBody().on( 'resizestart', function( evt )
    7777                                                {
    78                                                         if ( editor.getSelection().getSelectedElement().hasAttribute( '_cke_placeholder' ) )
     78                                                        if ( editor.getSelection().getSelectedElement().data( 'cke-placeholder' ) )
    7979                                                                evt.data.preventDefault();
    8080                                                });
    8181                                });
     
    111111                                        {
    112112                                                'span' : function( element )
    113113                                                {
    114                                                         if ( element.attributes && element.attributes._cke_placeholder )
     114                                                        if ( element.attributes && element.attributes[ 'data-cke-placeholder' ] )
    115115                                                                delete element.name;
    116116                                                }
    117117                                        }
     
    128128                var element = new CKEDITOR.dom.element( 'span', editor.document );
    129129                element.setAttributes(
    130130                        {
    131                                 contentEditable : 'false',
    132                                 _cke_placeholder        : 1,
    133                                 'class'         : 'cke_placeholder'
     131                                contentEditable         : 'false',
     132                                'data-cke-placeholder'  : 1,
     133                                'class'                 : 'cke_placeholder'
    134134                        }
    135135                );
    136136
  • _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.data( 'cke-realelement' ) )
    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                                        width : target.$.width,
  • _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.data( 'cke-bookmark' ) )
    410410                                {
    411411                                        currentNode = currentNode.getNextSourceNode( true );
    412412                                        continue;
     
    883883        {
    884884                // Exclude the ones at header OR at tail,
    885885                // 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,
    887887                        blockName = preBlock.getName(),
    888888                        splitedHtml = replace( preBlock.getOuterHtml(),
    889889                                duoBrRegex,
     
    905905                var headBookmark = '',
    906906                        tailBookmark = '';
    907907
    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,
    909909                        function( str, m1, m2 ){
    910910                                        m1 && ( headBookmark = m1 );
    911911                                        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.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();
     
    478478                                        // is fully editable even before the editing iframe is fully loaded (#4455).
    479479                                        contentDomReadyHandler = CKEDITOR.tools.addFunction( contentDomReady );
    480480                                        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">' +
    482482                                                        ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) +
    483483                                                        'window.parent.CKEDITOR.tools.callFunction( ' + contentDomReadyHandler + ', window );' +
    484484                                                '</script>';
     
    791791
    792792                                                                // Build the additional stuff to be included into <head>.
    793793                                                                var headExtra =
    794                                                                         '<style type="text/css" cke_temp="1">' +
     794                                                                        '<style type="text/css" data-cke-temp="1">' +
    795795                                                                                editor._.styles.join( '\n' ) +
    796796                                                                        '</style>';
    797797
     
    799799                                                                        CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
    800800                                                                        headExtra );
    801801
    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" />' : '';
    803803
    804804                                                                if ( fullPage )
    805805                                                                {
     
    971971                        editor.on( 'contentDom', function()
    972972                                {
    973973                                        var title = editor.document.getElementsByTag( 'title' ).getItem( 0 );
    974                                         title.setAttribute( '_cke_title', editor.document.$.title );
     974                                        title.data( 'cke-title', editor.document.$.title );
    975975                                        editor.document.$.title = frameLabel;
    976976                                });
    977977
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy