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