JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5
[ckeditor.git] / _source / plugins / fakeobjects / plugin.js
index 0b173c2..8dbf806 100644 (file)
@@ -12,13 +12,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        $ : function( element )\r
                        {\r
                                var attributes = element.attributes,\r
-                                       realHtml = attributes && attributes._cke_realelement,\r
+                                       realHtml = attributes && attributes[ 'data-cke-realelement' ],\r
                                        realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ),\r
                                        realElement = realFragment && realFragment.children[ 0 ];\r
 \r
                                // If we have width/height in the element, we must move it into\r
                                // the real element.\r
-                               if ( realElement && element.attributes._cke_resizable )\r
+                               if ( realElement && element.attributes[ 'data-cke-resizable' ] )\r
                                {\r
                                        var style = element.attributes.style;\r
 \r
@@ -62,23 +62,25 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
 CKEDITOR.editor.prototype.createFakeElement = function( realElement, className, realElementType, isResizable )\r
 {\r
-       var lang = this.lang.fakeobjects;\r
+       var lang = this.lang.fakeobjects,\r
+               label = lang[ realElementType ] || lang.unknown;\r
 \r
        var attributes =\r
        {\r
                'class' : className,\r
                src : CKEDITOR.getUrl( 'images/spacer.gif' ),\r
-               _cke_realelement : encodeURIComponent( realElement.getOuterHtml() ),\r
-               _cke_real_node_type : realElement.type,\r
-               alt : lang[ realElementType ] || lang.unknown,\r
+               'data-cke-realelement' : encodeURIComponent( realElement.getOuterHtml() ),\r
+               'data-cke-real-node-type' : realElement.type,\r
+               alt : label,\r
+               title : label,\r
                align : realElement.getAttribute( 'align' ) || ''\r
        };\r
 \r
        if ( realElementType )\r
-               attributes._cke_real_element_type = realElementType;\r
+               attributes[ 'data-cke-real-element-type' ] = realElementType;\r
 \r
        if ( isResizable )\r
-               attributes._cke_resizable = isResizable;\r
+               attributes[ 'data-cke-resizable' ] = isResizable;\r
 \r
        return this.document.createElement( 'img', { attributes : attributes } );\r
 };\r
@@ -86,6 +88,7 @@ CKEDITOR.editor.prototype.createFakeElement = function( realElement, className,
 CKEDITOR.editor.prototype.createFakeParserElement = function( realElement, className, realElementType, isResizable )\r
 {\r
        var lang = this.lang.fakeobjects,\r
+               label = lang[ realElementType ] || lang.unknown,\r
                html;\r
 \r
        var writer = new CKEDITOR.htmlParser.basicWriter();\r
@@ -96,27 +99,28 @@ CKEDITOR.editor.prototype.createFakeParserElement = function( realElement, class
        {\r
                'class' : className,\r
                src : CKEDITOR.getUrl( 'images/spacer.gif' ),\r
-               _cke_realelement : encodeURIComponent( html ),\r
-               _cke_real_node_type : realElement.type,\r
-               alt : lang[ realElementType ] || lang.unknown,\r
+               'data-cke-realelement' : encodeURIComponent( html ),\r
+               'data-cke-real-node-type' : realElement.type,\r
+               alt : label,\r
+               title : label,\r
                align : realElement.attributes.align || ''\r
        };\r
 \r
        if ( realElementType )\r
-               attributes._cke_real_element_type = realElementType;\r
+               attributes[ 'data-cke-real-element-type' ] = realElementType;\r
 \r
        if ( isResizable )\r
-               attributes._cke_resizable = isResizable;\r
+               attributes[ 'data-cke-resizable' ] = isResizable;\r
 \r
        return new CKEDITOR.htmlParser.element( 'img', attributes );\r
 };\r
 \r
 CKEDITOR.editor.prototype.restoreRealElement = function( fakeElement )\r
 {\r
-       if ( fakeElement.getAttribute( '_cke_real_node_type' ) != CKEDITOR.NODE_ELEMENT )\r
+       if ( fakeElement.data( 'cke-real-node-type' ) != CKEDITOR.NODE_ELEMENT )\r
                return null;\r
 \r
        return CKEDITOR.dom.element.createFromHtml(\r
-               decodeURIComponent( fakeElement.getAttribute( '_cke_realelement' ) ),\r
+               decodeURIComponent( fakeElement.data( 'cke-realelement' ) ),\r
                this.document );\r
 };\r