import rt 3.8.7
[freeside.git] / rt / share / html / NoAuth / RichText / FCKeditor / editor / _source / internals / fckxhtml_gecko.js
diff --git a/rt/share/html/NoAuth/RichText/FCKeditor/editor/_source/internals/fckxhtml_gecko.js b/rt/share/html/NoAuth/RichText/FCKeditor/editor/_source/internals/fckxhtml_gecko.js
new file mode 100644 (file)
index 0000000..76c9938
--- /dev/null
@@ -0,0 +1,114 @@
+/*\r
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
+ * Copyright (C) 2003-2009 Frederico Caldeira Knabben\r
+ *\r
+ * == BEGIN LICENSE ==\r
+ *\r
+ * Licensed under the terms of any of the following licenses at your\r
+ * choice:\r
+ *\r
+ *  - GNU General Public License Version 2 or later (the "GPL")\r
+ *    http://www.gnu.org/licenses/gpl.html\r
+ *\r
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
+ *    http://www.gnu.org/licenses/lgpl.html\r
+ *\r
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
+ *    http://www.mozilla.org/MPL/MPL-1.1.html\r
+ *\r
+ * == END LICENSE ==\r
+ *\r
+ * Defines the FCKXHtml object, responsible for the XHTML operations.\r
+ * Gecko specific.\r
+ */\r
+\r
+FCKXHtml._GetMainXmlString = function()\r
+{\r
+       return ( new XMLSerializer() ).serializeToString( this.MainNode ) ;\r
+}\r
+\r
+FCKXHtml._AppendAttributes = function( xmlNode, htmlNode, node )\r
+{\r
+       var aAttributes = htmlNode.attributes ;\r
+\r
+       for ( var n = 0 ; n < aAttributes.length ; n++ )\r
+       {\r
+               var oAttribute = aAttributes[n] ;\r
+\r
+               if ( oAttribute.specified )\r
+               {\r
+                       var sAttName = oAttribute.nodeName.toLowerCase() ;\r
+                       var sAttValue ;\r
+\r
+                       // Ignore any attribute starting with "_fck".\r
+                       if ( sAttName.StartsWith( '_fck' ) )\r
+                               continue ;\r
+                       // There is a bug in Mozilla that returns '_moz_xxx' attributes as specified.\r
+                       else if ( sAttName.indexOf( '_moz' ) == 0 )\r
+                               continue ;\r
+                       // There are one cases (on Gecko) when the oAttribute.nodeValue must be used:\r
+                       //              - for the "class" attribute\r
+                       else if ( sAttName == 'class' )\r
+                       {\r
+                               sAttValue = oAttribute.nodeValue.replace( FCKRegexLib.FCK_Class, '' ) ;\r
+                               if ( sAttValue.length == 0 )\r
+                                       continue ;\r
+                       }\r
+                       // XHTML doens't support attribute minimization like "CHECKED". It must be transformed to checked="checked".\r
+                       else if ( oAttribute.nodeValue === true )\r
+                               sAttValue = sAttName ;\r
+                       else\r
+                               sAttValue = htmlNode.getAttribute( sAttName, 2 ) ;      // We must use getAttribute to get it exactly as it is defined.\r
+\r
+                       this._AppendAttribute( node, sAttName, sAttValue ) ;\r
+               }\r
+       }\r
+}\r
+\r
+if ( FCKBrowserInfo.IsOpera )\r
+{\r
+       // Opera moves the <FCK:meta> element outside head (#1166).\r
+\r
+       // Save a reference to the XML <head> node, so we can use it for\r
+       // orphan <meta>s.\r
+       FCKXHtml.TagProcessors['head'] = function( node, htmlNode )\r
+       {\r
+               FCKXHtml.XML._HeadElement = node ;\r
+\r
+               node = FCKXHtml._AppendChildNodes( node, htmlNode, true ) ;\r
+\r
+               return node ;\r
+       }\r
+\r
+       // Check whether a <meta> element is outside <head>, and move it to the\r
+       // proper place.\r
+       FCKXHtml.TagProcessors['meta'] = function( node, htmlNode, xmlNode )\r
+       {\r
+               if ( htmlNode.parentNode.nodeName.toLowerCase() != 'head' )\r
+               {\r
+                       var headElement = FCKXHtml.XML._HeadElement ;\r
+\r
+                       if ( headElement && xmlNode != headElement )\r
+                       {\r
+                               delete htmlNode._fckxhtmljob ;\r
+                               FCKXHtml._AppendNode( headElement, htmlNode ) ;\r
+                               return null ;\r
+                       }\r
+               }\r
+\r
+               return node ;\r
+       }\r
+}\r
+\r
+if ( FCKBrowserInfo.IsGecko )\r
+{\r
+       // #2162, some Firefox extensions might add references to internal links\r
+       FCKXHtml.TagProcessors['link'] = function( node, htmlNode )\r
+       {\r
+               if ( htmlNode.href.substr(0, 9).toLowerCase() == 'chrome://' )\r
+                       return false ;\r
+\r
+               return node ;\r
+       }\r
+\r
+}\r