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 * This class can be used to interate through nodes inside a range.
\r
23 * During interation, the provided range can become invalid, due to document
\r
24 * mutations, so CreateBookmark() used to restore it after processing, if
\r
28 var FCKHtmlIterator = function( source )
\r
30 this._sourceHtml = source ;
\r
32 FCKHtmlIterator.prototype =
\r
36 var sourceHtml = this._sourceHtml ;
\r
37 if ( sourceHtml == null )
\r
40 var match = FCKRegexLib.HtmlTag.exec( sourceHtml ) ;
\r
45 if ( match.index > 0 )
\r
47 value = sourceHtml.substr( 0, match.index ) ;
\r
48 this._sourceHtml = sourceHtml.substr( match.index ) ;
\r
54 this._sourceHtml = sourceHtml.substr( match[0].length ) ;
\r
59 value = sourceHtml ;
\r
60 this._sourceHtml = null ;
\r
62 return { 'isTag' : isTag, 'value' : value } ;
\r
65 Each : function( func )
\r
68 while ( ( chunk = this.Next() ) )
\r
69 func( chunk.isTag, chunk.value ) ;
\r
73 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
\r
74 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
\r
76 * == BEGIN LICENSE ==
\r
78 * Licensed under the terms of any of the following licenses at your
\r
81 * - GNU General Public License Version 2 or later (the "GPL")
\r
82 * http://www.gnu.org/licenses/gpl.html
\r
84 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
\r
85 * http://www.gnu.org/licenses/lgpl.html
\r
87 * - Mozilla Public License Version 1.1 or later (the "MPL")
\r
88 * http://www.mozilla.org/MPL/MPL-1.1.html
\r
92 * This class can be used to interate through nodes inside a range.
\r
94 * During interation, the provided range can become invalid, due to document
\r
95 * mutations, so CreateBookmark() used to restore it after processing, if
\r
99 var FCKHtmlIterator = function( source )
\r
101 this._sourceHtml = source ;
\r
103 FCKHtmlIterator.prototype =
\r
107 var sourceHtml = this._sourceHtml ;
\r
108 if ( sourceHtml == null )
\r
111 var match = FCKRegexLib.HtmlTag.exec( sourceHtml ) ;
\r
112 var isTag = false ;
\r
116 if ( match.index > 0 )
\r
118 value = sourceHtml.substr( 0, match.index ) ;
\r
119 this._sourceHtml = sourceHtml.substr( match.index ) ;
\r
125 this._sourceHtml = sourceHtml.substr( match[0].length ) ;
\r
130 value = sourceHtml ;
\r
131 this._sourceHtml = null ;
\r
133 return { 'isTag' : isTag, 'value' : value } ;
\r
136 Each : function( func )
\r
139 while ( ( chunk = this.Next() ) )
\r
140 func( chunk.isTag, chunk.value ) ;
\r