1 | /* |
---|
2 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net |
---|
3 | * Copyright (C) 2003-2007 Frederico Caldeira Knabben |
---|
4 | * |
---|
5 | * == BEGIN LICENSE == |
---|
6 | * |
---|
7 | * Licensed under the terms of any of the following licenses at your |
---|
8 | * choice: |
---|
9 | * |
---|
10 | * - GNU General Public License Version 2 or later (the "GPL") |
---|
11 | * http://www.gnu.org/licenses/gpl.html |
---|
12 | * |
---|
13 | * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
---|
14 | * http://www.gnu.org/licenses/lgpl.html |
---|
15 | * |
---|
16 | * - Mozilla Public License Version 1.1 or later (the "MPL") |
---|
17 | * http://www.mozilla.org/MPL/MPL-1.1.html |
---|
18 | * |
---|
19 | * == END LICENSE == |
---|
20 | * |
---|
21 | * Defines the FCKXHtml object, responsible for the XHTML operations. |
---|
22 | * Gecko specific. |
---|
23 | */ |
---|
24 | |
---|
25 | FCKXHtml._GetMainXmlString = function() |
---|
26 | { |
---|
27 | // Create the XMLSerializer. |
---|
28 | var oSerializer = new XMLSerializer() ; |
---|
29 | |
---|
30 | // Return the serialized XML as a string. |
---|
31 | return oSerializer.serializeToString( this.MainNode ) ; |
---|
32 | } |
---|
33 | |
---|
34 | FCKXHtml._AppendAttributes = function( xmlNode, htmlNode, node ) |
---|
35 | { |
---|
36 | var aAttributes = htmlNode.attributes ; |
---|
37 | |
---|
38 | for ( var n = 0 ; n < aAttributes.length ; n++ ) |
---|
39 | { |
---|
40 | var oAttribute = aAttributes[n] ; |
---|
41 | |
---|
42 | if ( oAttribute.specified ) |
---|
43 | { |
---|
44 | var sAttName = oAttribute.nodeName.toLowerCase() ; |
---|
45 | var sAttValue ; |
---|
46 | |
---|
47 | // Ignore any attribute starting with "_fck". |
---|
48 | if ( sAttName.StartsWith( '_fck' ) ) |
---|
49 | continue ; |
---|
50 | // There is a bug in Mozilla that returns '_moz_xxx' attributes as specified. |
---|
51 | else if ( sAttName.indexOf( '_moz' ) == 0 ) |
---|
52 | continue ; |
---|
53 | // There are one cases (on Gecko) when the oAttribute.nodeValue must be used: |
---|
54 | // - for the "class" attribute |
---|
55 | else if ( sAttName == 'class' ) |
---|
56 | sAttValue = oAttribute.nodeValue ; |
---|
57 | // XHTML doens't support attribute minimization like "CHECKED". It must be trasformed to cheched="checked". |
---|
58 | else if ( oAttribute.nodeValue === true ) |
---|
59 | sAttValue = sAttName ; |
---|
60 | else |
---|
61 | sAttValue = htmlNode.getAttribute( sAttName, 2 ) ; // We must use getAttribute to get it exactly as it is defined. |
---|
62 | |
---|
63 | this._AppendAttribute( node, sAttName, sAttValue ) ; |
---|
64 | } |
---|
65 | } |
---|
66 | } |
---|