Index: /CKEditor/trunk/_source/core/dom/document.js
===================================================================
--- /CKEditor/trunk/_source/core/dom/document.js	(revision 3331)
+++ /CKEditor/trunk/_source/core/dom/document.js	(revision 3332)
@@ -134,4 +134,11 @@
 		},
 
+		getElementsByTag : function( tagName, namespace )
+		{
+			if ( !CKEDITOR.env.ie && namespace )
+				tagName = namespace + ':' + tagName;
+			return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
+		},
+
 		/**
 		 * Gets the &lt;head&gt; element for this document.
Index: /CKEditor/trunk/_source/core/dom/element.js
===================================================================
--- /CKEditor/trunk/_source/core/dom/element.js	(revision 3331)
+++ /CKEditor/trunk/_source/core/dom/element.js	(revision 3332)
@@ -478,10 +478,5 @@
 		},
 
-		getElementsByTag : function( tagName, namespace )
-		{
-			if ( !CKEDITOR.env.ie && namespace )
-				tagName = namespace + ':' + tagName;
-			return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
-		},
+		getElementsByTag : CKEDITOR.dom.document.prototype.getElementsByTag,
 
 		/**
Index: /CKEditor/trunk/_source/core/loader.js
===================================================================
--- /CKEditor/trunk/_source/core/loader.js	(revision 3331)
+++ /CKEditor/trunk/_source/core/loader.js	(revision 3332)
@@ -32,5 +32,5 @@
 			'core/config'			: [ 'core/ckeditor_base' ],
 			'core/dom'				: [],
-			'core/dom/document'		: [ 'core/dom','core/dom/element', 'core/dom/domobject', 'core/dom/window' ],
+			'core/dom/document'		: [ 'core/dom', 'core/dom/domobject', 'core/dom/window' ],
 			'core/dom/documentfragment'	: [ 'core/dom/element' ],
 			'core/dom/element'		: [ 'core/dom', 'core/dom/document', 'core/dom/domobject', 'core/dom/node', 'core/dom/nodelist', 'core/tools' ],
Index: /CKEditor/trunk/_source/plugins/link/dialogs/link.js
===================================================================
--- /CKEditor/trunk/_source/plugins/link/dialogs/link.js	(revision 3331)
+++ /CKEditor/trunk/_source/plugins/link/dialogs/link.js	(revision 3332)
@@ -180,21 +180,25 @@
 		// Find out whether we have any anchors in the editor.
 		// Get all IMG elements in CK document.
-		var elements = editor.document.$.getElementsByTagName( 'img' ),
-			realAnchors = editor.document.$.anchors,
+		var elements = editor.document.getElementsByTag( 'img' ),
+			realAnchors = new CKEDITOR.dom.nodeList( editor.document.$.anchors ),
 			anchors = retval.anchors = [];
-		for( var i = 0; i < elements.length ; i++ )
-		{
-			var item = elements.item( i );
+
+		for( var i = 0; i < elements.count() ; i++ )
+		{
+			var item = elements.getItem( i );
 			if ( item.getAttribute( '_cke_realelement' ) && item.getAttribute( '_cke_real_element_type' ) == 'anchor' )
 			{
-				var domElement = new CKEDITOR.dom.element( item );
-				domElement = editor.restoreRealElement( domElement );
-				anchors.push( domElement );
+				anchors.push( editor.restoreRealElement( item ) );
 			}
 		}
-		for ( i = 0 ; i < realAnchors.length ; i++ )
-			anchors.push( realAnchors[i] );
-		for ( i = 0, length = anchors.length ; i < length && ( item = anchors.shift() ) ; i++ )
-			anchors.push( { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) } );
+
+		for ( i = 0 ; i < realAnchors.count() ; i++ )
+			anchors.push( realAnchors.getItem( i ) );
+
+		for ( i = 0 ; i < anchors.length ; i++ )
+		{
+			item = anchors[ i ];
+			anchors[ i ] = { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) };
+		}
 
 		// Record down the selected element in the dialog.
Index: /CKEditor/trunk/ckeditor.pack
===================================================================
--- /CKEditor/trunk/ckeditor.pack	(revision 3331)
+++ /CKEditor/trunk/ckeditor.pack	(revision 3332)
@@ -91,9 +91,9 @@
 					'_source/core/dom/event.js',
 					'_source/core/dom/domobject.js',
+					'_source/core/dom/window.js',
+					'_source/core/dom/document.js',
 					'_source/core/dom/node.js',
 					'_source/core/dom/nodelist.js',
 					'_source/core/dom/element.js',
-					'_source/core/dom/window.js',
-					'_source/core/dom/document.js',
 					'_source/core/command.js',
 					'_source/core/config.js',
