r8877@llin: dpavlin | 2005-11-14 18:40:33 +0100
[webpac2] / web / iwf / iwfxml.js
index 6ac7746..48ad027 100644 (file)
@@ -1,40 +1,55 @@
-// -----------------------------------------------------------------------------\r
-// IWF - Interactive Website Framework.  Javascript library for creating\r
-// responsive thin client interfaces.\r
-//\r
-// Copyright (C) 2005 Brock Weaver brockweaver@gmail.com\r
-//\r
-//     This library is free software; you can redistribute it and/or modify\r
-// it under the terms of the GNU Lesser General Public License as published\r
-// by the Free Software Foundation; either version 2.1 of the License, or\r
-// (at your option) any later version.\r
-//\r
-//     This library is distributed in the hope that it will be useful, but\r
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
-// License for more details.\r
+// --------------------------------------------------------------------------\r
+/// IWF - Interactive Website Framework.  Javascript library for creating\r
+/// responsive thin client interfaces.\r
+///\r
+/// Copyright (C) 2005 Brock Weaver brockweaver@users.sourceforge.net\r
+///\r
+///     This library is free software; you can redistribute it and/or modify\r
+/// it under the terms of the GNU Lesser General Public License as published\r
+/// by the Free Software Foundation; either version 2.1 of the License, or\r
+/// (at your option) any later version.\r
+///\r
+///     This library is distributed in the hope that it will be useful, but\r
+/// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+/// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+/// License for more details.\r
+///\r
+///    You should have received a copy of the GNU Lesser General Public License\r
+/// along with this library; if not, write to the Free Software Foundation,\r
+/// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+///\r
+/// Brock Weaver\r
+/// brockweaver@users.sourceforge.net\r
+/// 1605 NW Maple Pl\r
+/// Ankeny, IA 50021\r
+///\r
+//! http://iwf.sourceforge.net/\r
+// --------------------------------------------------------------------------\r
+//! NOTE: To minimize file size, strip all fluffy comments (except the LGPL, of course!)\r
+//! using the following regex (global flag and multiline on):\r
+//!            ^\t*//([^/!].*|$)\r
 //\r
-//    You should have received a copy of the GNU Lesser General Public License\r
-// along with this library; if not, write to the Free Software Foundation,\r
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+// This reduces file size by about 30%, give or take.\r
 //\r
-// Brock Weaver\r
-// brockweaver@gmail.com\r
-// 1605 NW Maple Pl\r
-// Ankeny, IA 50021\r
-// -----------------------------------------------------------------------------\r
+//!  To rip out only logging statements (commented or uncommented):\r
+//!            ^/{0,2}iwfLog.*\r
+// --------------------------------------------------------------------------\r
 \r
 // --------------------------------------------------------------------------\r
-// iwfxml.js\r
+//! iwfxml.js\r
 //\r
 // Javascript-based xml parser\r
 //\r
-// Dependencies:\r
-// iwfcore.js\r
+//! Dependencies:\r
+//! iwfcore.js\r
 //\r
-// Brock Weaver - brockweaver@sourceforge.net - iwf.sourceforge.net\r
-// v 0.1 - 2005-06-05\r
-// Initial release.\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.2 - 2005-11-14\r
+//! core bug patch\r
+// --------------------------------------------------------------------------\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.1 - 2005-06-05\r
+//! Initial release.\r
 // --------------------------------------------------------------------------\r
 // This class is meant to ease the burden of parsing xml.\r
 // Xml is parsed into sets of arrays, in a hierarchical format.\r
@@ -99,11 +114,11 @@ iwfXmlDoc.prototype.outerXml = function(pretty){
 \r
 \r
 // --------------------------------------------------------------------------\r
-// iwfXmlNode\r
+//! iwfXmlNode\r
 //\r
-// Brock Weaver - brockweaver@gmail.com\r
-// v 0.1 - 2005-06-05\r
-// Initial release.\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.1 - 2005-06-05\r
+//! Initial release.\r
 // --------------------------------------------------------------------------\r
 // This class is used to represent a single xml node.\r
 // All xml is kept except processing instructions.\r
@@ -618,12 +633,12 @@ iwfXmlNode.prototype.rtrim = function(s){
 \r
 \r
 // --------------------------------------------------------------------------\r
-// iwfWriter\r
+//! iwfWriter\r
 //\r
-// Brock Weaver - brockweaver@gmail.com\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
 //\r
-// v 0.1 - 2005-06-05\r
-// Initial release.\r
+//! v 0.1 - 2005-06-05\r
+//! Initial release.\r
 // --------------------------------------------------------------------------\r
 // This class is meant to ease the creation of xml strings.\r
 // Note it is not a fully-compliant xml generator.\r
@@ -724,7 +739,6 @@ iwfWriter.prototype.writeAttribute = function(name, val, quotes){
                        } else {\r
                                // we're using quotes to delimit html\r
                                attval = attval.replace(/'/gi, "\\'").replace(/"/gi, '"').replace(/>/gi, '>');\r
-//                             attval = attval.replace(/&/gi, '&amp;').replace(/"/gi, '&quot;').replace(/</gi, '&lt;').replace(/>/gi, '&gt;');\r
                        }\r
                } else {\r
                        attval = iwfXmlEncode(attval);\r
@@ -789,9 +803,10 @@ iwfWriter.prototype.writeNodeClose = function(){
                                break;\r
                        default:\r
                                if (this._nodeOpened){\r
-                                       // hack for <script /> needing to be <script></script>\r
+                                       //! hack for <script /> and <div /> needing to be <script></script> or <div></div>\r
                                        switch(name){\r
                                                case 'script':\r
+                                               case 'div':\r
                                                        this.writeRaw("></" + name + ">");\r
                                                        break;\r
                                                default:\r