PluginProbe
Wp-Insert / 1.2
Wp-Insert v1.2
trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.3.0 1.3.1 1.3.3 1.4 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 2.0 All 63 releases
wp-insert / fckeditor / editor / _source / classes / fckelementpath.js

fckelementpath.js in Wp-Insert 1.2, at fckeditor/editor/_source/classes/fckelementpath.js

179 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*
2
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
5 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
6
7 *
8
9 * == BEGIN LICENSE ==
10
11 *
12
13 * Licensed under the terms of any of the following licenses at your
14
15 * choice:
16
17 *
18
19 * - GNU General Public License Version 2 or later (the "GPL")
20
21 * http://www.gnu.org/licenses/gpl.html
22
23 *
24
25 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
26
27 * http://www.gnu.org/licenses/lgpl.html
28
29 *
30
31 * - Mozilla Public License Version 1.1 or later (the "MPL")
32
33 * http://www.mozilla.org/MPL/MPL-1.1.html
34
35 *
36
37 * == END LICENSE ==
38
39 *
40
41 * Manages the DOM ascensors element list of a specific DOM node
42
43 * (limited to body, inclusive).
44
45 */
46
47
48
49 var FCKElementPath = function( lastNode )
50
51 {
52
53 var eBlock = null ;
54
55 var eBlockLimit = null ;
56
57
58
59 var aElements = new Array() ;
60
61
62
63 var e = lastNode ;
64
65 while ( e )
66
67 {
68
69 if ( e.nodeType == 1 )
70
71 {
72
73 if ( !this.LastElement )
74
75 this.LastElement = e ;
76
77
78
79 var sElementName = e.nodeName.toLowerCase() ;
80
81 if ( FCKBrowserInfo.IsIE && e.scopeName != 'HTML' )
82
83 sElementName = e.scopeName.toLowerCase() + ':' + sElementName ;
84
85
86
87 if ( !eBlockLimit )
88
89 {
90
91 if ( !eBlock && FCKListsLib.PathBlockElements[ sElementName ] != null )
92
93 eBlock = e ;
94
95
96
97 if ( FCKListsLib.PathBlockLimitElements[ sElementName ] != null )
98
99 {
100
101 // DIV is considered the Block, if no block is available (#525)
102
103 // and if it doesn't contain other blocks.
104
105 if ( !eBlock && sElementName == 'div' && !FCKElementPath._CheckHasBlock( e ) )
106
107 eBlock = e ;
108
109 else
110
111 eBlockLimit = e ;
112
113 }
114
115 }
116
117
118
119 aElements.push( e ) ;
120
121
122
123 if ( sElementName == 'body' )
124
125 break ;
126
127 }
128
129 e = e.parentNode ;
130
131 }
132
133
134
135 this.Block = eBlock ;
136
137 this.BlockLimit = eBlockLimit ;
138
139 this.Elements = aElements ;
140
141 }
142
143
144
145 /**
146
147 * Check if an element contains any block element.
148
149 */
150
151 FCKElementPath._CheckHasBlock = function( element )
152
153 {
154
155 var childNodes = element.childNodes ;
156
157
158
159 for ( var i = 0, count = childNodes.length ; i < count ; i++ )
160
161 {
162
163 var child = childNodes[i] ;
164
165
166
167 if ( child.nodeType == 1 && FCKListsLib.BlockElements[ child.nodeName.toLowerCase() ] )
168
169 return true ;
170
171 }
172
173
174
175 return false ;
176
177 }
178
179