~ubuntu-branches/ubuntu/gutsy/moin/gutsy

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/editor/_source/internals/fckxhtml.js

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-02-14 16:09:24 UTC
  • mfrom: (0.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20060214160924-fyrx3gvknzqvt4vj
Tags: 1.5.2-1ubuntu1
Drop python2.3 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
{
92
92
        var iCount = 0 ;
93
93
        
94
 
        if ( htmlNode.hasChildNodes() )
 
94
        var oNode = htmlNode.firstChild ;
 
95
 
 
96
        while ( oNode )
95
97
        {
96
 
                // Get all children nodes.
97
 
                var oChildren = htmlNode.childNodes ;
 
98
                if ( this._AppendNode( xmlNode, oNode ) )
 
99
                        iCount++ ;
98
100
 
99
 
                for ( var i = 0 ; i < oChildren.length ; i++ )
100
 
                {
101
 
                        if ( this._AppendNode( xmlNode, oChildren[i] ) )
102
 
                                iCount++ ;
103
 
                }
 
101
                oNode = oNode.nextSibling ;
104
102
        }
105
103
        
106
104
        if ( iCount == 0 )
120
118
 
121
119
FCKXHtml._AppendNode = function( xmlNode, htmlNode )
122
120
{
 
121
        if ( !htmlNode )
 
122
                return ;
 
123
 
123
124
        switch ( htmlNode.nodeType )
124
125
        {
125
126
                // Element Node.
134
135
                        if ( htmlNode.getAttribute('_fckdelete') )
135
136
                                return false ;
136
137
 
137
 
                        // Create the Element.
 
138
                        // Get the element name.
138
139
                        var sNodeName = htmlNode.nodeName ;
 
140
                        
 
141
                        //Add namespace:
 
142
                        if ( FCKBrowserInfo.IsIE && htmlNode.scopeName && htmlNode.scopeName != 'HTML' )
 
143
                                sNodeName = htmlNode.scopeName + ':' + sNodeName ;
139
144
 
140
145
                        // Check if the node name is valid, otherwise ignore this tag.
 
146
                        // If the nodeName starts with a slash, it is a orphan closing tag.
 
147
                        // On some strange cases, the nodeName is empty, even if the node exists.
141
148
                        if ( !FCKRegexLib.ElementName.test( sNodeName ) )
142
149
                                return false ;
143
150
 
150
157
                        // So here, the "mark" is checked... if the element is Ok, then mark it.
151
158
                        if ( htmlNode._fckxhtmljob && htmlNode._fckxhtmljob == FCKXHtml.CurrentJobNum )
152
159
                                return false ;
153
 
                        else
154
 
                                htmlNode._fckxhtmljob = FCKXHtml.CurrentJobNum ;
155
 
 
156
 
                        // If the nodeName starts with a slash, it is a orphan closing tag.
157
 
                        // On some strange cases, the nodeName is empty, even if the node exists.
158
 
//                      if ( sNodeName.length == 0 || sNodeName.substr(0,1) == '/' )
159
 
//                              break ;
160
160
 
161
161
                        var oNode = this._CreateNode( sNodeName ) ;
162
162
                        
163
163
                        // Add all attributes.
164
164
                        FCKXHtml._AppendAttributes( xmlNode, htmlNode, oNode, sNodeName ) ;
 
165
                        
 
166
                        htmlNode._fckxhtmljob = FCKXHtml.CurrentJobNum ;
165
167
 
166
168
                        // Tag specific processing.
167
169
                        var oTagProcessor = FCKXHtml.TagProcessors[ sNodeName ] ;
227
229
        return '___FCKsi___' + FCKXHtml.SpecialBlocks.addItem( item ) ;
228
230
}
229
231
 
230
 
if ( FCKConfig.ProcessHTMLEntities )
231
 
{
 
232
//if ( FCKConfig.ProcessHTMLEntities )
 
233
//{
232
234
        FCKXHtml._AppendTextNode = function( targetNode, textValue )
233
235
        {
234
236
                // We can't just replace the special chars with entities and create a
253
255
                        }
254
256
                }
255
257
        }
256
 
}
257
 
else
258
 
{
259
 
        FCKXHtml._AppendTextNode = function( targetNode, textValue )
260
 
        {
261
 
                targetNode.appendChild( this.XML.createTextNode( textValue ) ) ;
262
 
        }
263
 
}
 
258
//}
 
259
//else
 
260
//{
 
261
//      FCKXHtml._AppendTextNode = function( targetNode, textValue )
 
262
//      {
 
263
//              targetNode.appendChild( this.XML.createTextNode( textValue ) ) ;
 
264
//      }
 
265
//}
264
266
 
265
267
// An object that hold tag specific operations.
266
268
FCKXHtml.TagProcessors = new Object() ;
267
269
 
268
 
FCKXHtml.TagProcessors['img'] = function( node )
 
270
FCKXHtml.TagProcessors['img'] = function( node, htmlNode )
269
271
{
270
272
        // The "ALT" attribute is required in XHTML.
271
273
        if ( ! node.attributes.getNamedItem( 'alt' ) )
272
274
                FCKXHtml._AppendAttribute( node, 'alt', '' ) ;
273
275
 
 
276
        var sSavedUrl = htmlNode.getAttribute( '_fcksavedurl' ) ;
 
277
        if ( sSavedUrl && sSavedUrl.length > 0 )
 
278
                FCKXHtml._AppendAttribute( node, 'src', sSavedUrl ) ;
 
279
 
 
280
        return node ;
 
281
}
 
282
 
 
283
FCKXHtml.TagProcessors['a'] = function( node, htmlNode )
 
284
{
 
285
        var sSavedUrl = htmlNode.getAttribute( '_fcksavedurl' ) ;
 
286
        if ( sSavedUrl && sSavedUrl.length > 0 )
 
287
                FCKXHtml._AppendAttribute( node, 'href', sSavedUrl ) ;
 
288
 
 
289
        FCKXHtml._AppendChildNodes( node, htmlNode, false ) ;
 
290
 
274
291
        return node ;
275
292
}
276
293