[44] | 1 | /*
|
---|
| 2 | * FCKeditor - The text editor for internet
|
---|
| 3 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
---|
| 4 | *
|
---|
| 5 | * Licensed under the terms of the GNU Lesser General Public License:
|
---|
| 6 | * http://www.opensource.org/licenses/lgpl-license.php
|
---|
| 7 | *
|
---|
| 8 | * For further information visit:
|
---|
| 9 | * http://www.fckeditor.net/
|
---|
| 10 | *
|
---|
| 11 | * "Support Open Source software. What about a donation today?"
|
---|
| 12 | *
|
---|
| 13 | * File Name: fckxhtml_gecko.js
|
---|
| 14 | * Defines the FCKXHtml object, responsible for the XHTML operations.
|
---|
| 15 | * Gecko specific.
|
---|
| 16 | *
|
---|
| 17 | * File Authors:
|
---|
| 18 | * Frederico Caldeira Knabben (fredck@fckeditor.net)
|
---|
| 19 | */
|
---|
| 20 |
|
---|
| 21 | FCKXHtml._GetMainXmlString = function()
|
---|
| 22 | {
|
---|
| 23 | // Create the XMLSerializer.
|
---|
| 24 | var oSerializer = new XMLSerializer() ;
|
---|
| 25 |
|
---|
| 26 | // Return the serialized XML as a string.
|
---|
| 27 | return oSerializer.serializeToString( this.MainNode ) ;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | FCKXHtml._AppendAttributes = function( xmlNode, htmlNode, node )
|
---|
| 31 | {
|
---|
| 32 | var aAttributes = htmlNode.attributes ;
|
---|
| 33 |
|
---|
| 34 | for ( var n = 0 ; n < aAttributes.length ; n++ )
|
---|
| 35 | {
|
---|
| 36 | var oAttribute = aAttributes[n] ;
|
---|
| 37 |
|
---|
| 38 | if ( oAttribute.specified )
|
---|
| 39 | {
|
---|
| 40 | var sAttName = oAttribute.nodeName.toLowerCase() ;
|
---|
| 41 | var sAttValue ;
|
---|
| 42 |
|
---|
| 43 | // Ignore any attribute starting with "_fck".
|
---|
| 44 | if ( sAttName.startsWith( '_fck' ) )
|
---|
| 45 | continue ;
|
---|
| 46 | // There is a bug in Mozilla that returns '_moz_xxx' attributes as specified.
|
---|
| 47 | else if ( sAttName.indexOf( '_moz' ) == 0 )
|
---|
| 48 | continue ;
|
---|
| 49 | // There are one cases (on Gecko) when the oAttribute.nodeValue must be used:
|
---|
| 50 | // - for the "class" attribute
|
---|
| 51 | else if ( sAttName == 'class' )
|
---|
| 52 | sAttValue = oAttribute.nodeValue ;
|
---|
| 53 | // XHTML doens't support attribute minimization like "CHECKED". It must be trasformed to cheched="checked".
|
---|
| 54 | else if ( oAttribute.nodeValue === true )
|
---|
| 55 | sAttValue = sAttName ;
|
---|
| 56 | else
|
---|
| 57 | sAttValue = htmlNode.getAttribute( sAttName, 2 ) ; // We must use getAttribute to get it exactly as it is defined.
|
---|
| 58 |
|
---|
| 59 | this._AppendAttribute( node, sAttName, sAttValue ) ;
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
| 62 | } |
---|