2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
\r
3 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
\r
5 * == BEGIN LICENSE ==
\r
7 * Licensed under the terms of any of the following licenses at your
\r
10 * - GNU General Public License Version 2 or later (the "GPL")
\r
11 * http://www.gnu.org/licenses/gpl.html
\r
13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
\r
14 * http://www.gnu.org/licenses/lgpl.html
\r
16 * - Mozilla Public License Version 1.1 or later (the "MPL")
\r
17 * http://www.mozilla.org/MPL/MPL-1.1.html
\r
21 * Manages the DOM ascensors element list of a specific DOM node
\r
22 * (limited to body, inclusive).
\r
25 var FCKElementPath = function( lastNode )
\r
28 var eBlockLimit = null ;
\r
30 var aElements = new Array() ;
\r
35 if ( e.nodeType == 1 )
\r
37 if ( !this.LastElement )
\r
38 this.LastElement = e ;
\r
40 var sElementName = e.nodeName.toLowerCase() ;
\r
41 if ( FCKBrowserInfo.IsIE && e.scopeName != 'HTML' )
\r
42 sElementName = e.scopeName.toLowerCase() + ':' + sElementName ;
\r
46 if ( !eBlock && FCKListsLib.PathBlockElements[ sElementName ] != null )
\r
49 if ( FCKListsLib.PathBlockLimitElements[ sElementName ] != null )
\r
51 // DIV is considered the Block, if no block is available (#525)
\r
52 // and if it doesn't contain other blocks.
\r
53 if ( !eBlock && sElementName == 'div' && !FCKElementPath._CheckHasBlock( e ) )
\r
60 aElements.push( e ) ;
\r
62 if ( sElementName == 'body' )
\r
68 this.Block = eBlock ;
\r
69 this.BlockLimit = eBlockLimit ;
\r
70 this.Elements = aElements ;
\r
74 * Check if an element contains any block element.
\r
76 FCKElementPath._CheckHasBlock = function( element )
\r
78 var childNodes = element.childNodes ;
\r
80 for ( var i = 0, count = childNodes.length ; i < count ; i++ )
\r
82 var child = childNodes[i] ;
\r
84 if ( child.nodeType == 1 && FCKListsLib.BlockElements[ child.nodeName.toLowerCase() ] )
\r