Subversion Repositories Applications.papyrus

Rev

Rev 1925 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1925 Rev 2048
Line 1... Line 1...
1
/*
1
/*
2
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
2
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
3
 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
4
 *
4
 *
5
 * == BEGIN LICENSE ==
5
 * == BEGIN LICENSE ==
6
 *
6
 *
7
 * Licensed under the terms of any of the following licenses at your
7
 * Licensed under the terms of any of the following licenses at your
8
 * choice:
8
 * choice:
Line 305... Line 305...
305
 
305
 
306
			oDest.setAttribute( sAttName, sAttValue, 0 ) ;	// 0 : Case Insensitive
306
			oDest.setAttribute( sAttName, sAttValue, 0 ) ;	// 0 : Case Insensitive
307
		}
307
		}
308
	}
308
	}
-
 
309
	// The style:
309
	// The style:
310
	if ( oSource.style.cssText !== '' )
-
 
311
		oDest.style.cssText = oSource.style.cssText ;
-
 
312
}
-
 
313
 
-
 
314
/**
-
 
315
* Replaces a tag with another one, keeping its contents:
-
 
316
* for example TD --> TH, and TH --> TD.
-
 
317
* input: the original node, and the new tag name
-
 
318
* http://www.w3.org/TR/DOM-Level-3-Core/core.html#Document3-renameNode
-
 
319
*/
-
 
320
function RenameNode( oNode , newTag )
-
 
321
{
-
 
322
	// TODO: if the browser natively supports document.renameNode call it.
-
 
323
	// does any browser currently support it in order to test?
-
 
324
 
-
 
325
	// Only rename element nodes.
-
 
326
	if ( oNode.nodeType != 1 )
-
 
327
		return null ;
-
 
328
 
-
 
329
	// If it's already correct exit here.
-
 
330
	if ( oNode.nodeName == newTag )
-
 
331
		return oNode ;
-
 
332
 
-
 
333
	var oDoc = oNode.ownerDocument ;
-
 
334
	// Create the new node
-
 
335
	var newNode = oDoc.createElement( newTag ) ;
-
 
336
 
-
 
337
	// Copy all attributes
-
 
338
	CopyAttributes( oNode, newNode, {} ) ;
-
 
339
 
-
 
340
	// Move children to the new node
-
 
341
	FCKDomTools.MoveChildren( oNode, newNode ) ;
-
 
342
 
-
 
343
	// Finally replace the node and return the new one
-
 
344
	oNode.parentNode.replaceChild( newNode, oNode ) ;
-
 
345
 
310
	oDest.style.cssText = oSource.style.cssText ;
346
	return newNode ;