import rt 3.8.7
[freeside.git] / rt / share / html / NoAuth / RichText / FCKeditor / editor / _source / internals / fckxhtml_gecko.js
1 /*\r
2  * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
3  * Copyright (C) 2003-2009 Frederico Caldeira Knabben\r
4  *\r
5  * == BEGIN LICENSE ==\r
6  *\r
7  * Licensed under the terms of any of the following licenses at your\r
8  * choice:\r
9  *\r
10  *  - GNU General Public License Version 2 or later (the "GPL")\r
11  *    http://www.gnu.org/licenses/gpl.html\r
12  *\r
13  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
14  *    http://www.gnu.org/licenses/lgpl.html\r
15  *\r
16  *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
17  *    http://www.mozilla.org/MPL/MPL-1.1.html\r
18  *\r
19  * == END LICENSE ==\r
20  *\r
21  * Defines the FCKXHtml object, responsible for the XHTML operations.\r
22  * Gecko specific.\r
23  */\r
24 \r
25 FCKXHtml._GetMainXmlString = function()\r
26 {\r
27         return ( new XMLSerializer() ).serializeToString( this.MainNode ) ;\r
28 }\r
29 \r
30 FCKXHtml._AppendAttributes = function( xmlNode, htmlNode, node )\r
31 {\r
32         var aAttributes = htmlNode.attributes ;\r
33 \r
34         for ( var n = 0 ; n < aAttributes.length ; n++ )\r
35         {\r
36                 var oAttribute = aAttributes[n] ;\r
37 \r
38                 if ( oAttribute.specified )\r
39                 {\r
40                         var sAttName = oAttribute.nodeName.toLowerCase() ;\r
41                         var sAttValue ;\r
42 \r
43                         // Ignore any attribute starting with "_fck".\r
44                         if ( sAttName.StartsWith( '_fck' ) )\r
45                                 continue ;\r
46                         // There is a bug in Mozilla that returns '_moz_xxx' attributes as specified.\r
47                         else if ( sAttName.indexOf( '_moz' ) == 0 )\r
48                                 continue ;\r
49                         // There are one cases (on Gecko) when the oAttribute.nodeValue must be used:\r
50                         //              - for the "class" attribute\r
51                         else if ( sAttName == 'class' )\r
52                         {\r
53                                 sAttValue = oAttribute.nodeValue.replace( FCKRegexLib.FCK_Class, '' ) ;\r
54                                 if ( sAttValue.length == 0 )\r
55                                         continue ;\r
56                         }\r
57                         // XHTML doens't support attribute minimization like "CHECKED". It must be transformed to checked="checked".\r
58                         else if ( oAttribute.nodeValue === true )\r
59                                 sAttValue = sAttName ;\r
60                         else\r
61                                 sAttValue = htmlNode.getAttribute( sAttName, 2 ) ;      // We must use getAttribute to get it exactly as it is defined.\r
62 \r
63                         this._AppendAttribute( node, sAttName, sAttValue ) ;\r
64                 }\r
65         }\r
66 }\r
67 \r
68 if ( FCKBrowserInfo.IsOpera )\r
69 {\r
70         // Opera moves the <FCK:meta> element outside head (#1166).\r
71 \r
72         // Save a reference to the XML <head> node, so we can use it for\r
73         // orphan <meta>s.\r
74         FCKXHtml.TagProcessors['head'] = function( node, htmlNode )\r
75         {\r
76                 FCKXHtml.XML._HeadElement = node ;\r
77 \r
78                 node = FCKXHtml._AppendChildNodes( node, htmlNode, true ) ;\r
79 \r
80                 return node ;\r
81         }\r
82 \r
83         // Check whether a <meta> element is outside <head>, and move it to the\r
84         // proper place.\r
85         FCKXHtml.TagProcessors['meta'] = function( node, htmlNode, xmlNode )\r
86         {\r
87                 if ( htmlNode.parentNode.nodeName.toLowerCase() != 'head' )\r
88                 {\r
89                         var headElement = FCKXHtml.XML._HeadElement ;\r
90 \r
91                         if ( headElement && xmlNode != headElement )\r
92                         {\r
93                                 delete htmlNode._fckxhtmljob ;\r
94                                 FCKXHtml._AppendNode( headElement, htmlNode ) ;\r
95                                 return null ;\r
96                         }\r
97                 }\r
98 \r
99                 return node ;\r
100         }\r
101 }\r
102 \r
103 if ( FCKBrowserInfo.IsGecko )\r
104 {\r
105         // #2162, some Firefox extensions might add references to internal links\r
106         FCKXHtml.TagProcessors['link'] = function( node, htmlNode )\r
107         {\r
108                 if ( htmlNode.href.substr(0, 9).toLowerCase() == 'chrome://' )\r
109                         return false ;\r
110 \r
111                 return node ;\r
112         }\r
113 \r
114 }\r