+ var sel = editor.getSelection(),\r
+ range = sel && sel.getRanges()[ 0 ];\r
+\r
+ // Empty anchor\r
+ if ( range.collapsed )\r
+ {\r
+ if ( CKEDITOR.plugins.link.synAnchorSelector )\r
+ attributes[ 'class' ] = 'cke_anchor_empty';\r
+\r
+ if ( CKEDITOR.plugins.link.emptyAnchorFix )\r
+ {\r
+ attributes[ 'contenteditable' ] = 'false';\r
+ attributes[ 'data-cke-editable' ] = 1;\r
+ }\r
+\r
+ var anchor = editor.document.createElement( 'a', { attributes: attributes } );\r
+\r
+ // Transform the anchor into a fake element for browsers that need it.\r
+ if ( CKEDITOR.plugins.link.fakeAnchor )\r
+ anchor = createFakeAnchor( editor, anchor );\r
+\r
+ range.insertNode( anchor );\r
+ }\r
+ else\r
+ {\r
+ if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )\r
+ attributes['class'] = 'cke_anchor';\r
+\r
+ // Apply style.\r
+ var style = new CKEDITOR.style( { element : 'a', attributes : attributes } );\r
+ style.type = CKEDITOR.STYLE_INLINE;\r
+ style.apply( editor.document );\r
+ }\r