1.1 --- a/examples/Common/Configurator/Resources/scripts/XSLForms.js Sun Sep 09 16:47:37 2007 +0000 1.2 +++ b/examples/Common/Configurator/Resources/scripts/XSLForms.js Sun Sep 09 16:47:54 2007 +0000 1.3 @@ -88,7 +88,7 @@ 1.4 1.5 // NOTE: Test Konqueror bug. 1.6 1.7 - //showMismatch(targetFieldNameArray); 1.8 + //showMismatch(targetFieldNames); 1.9 1.10 return false; 1.11 }
2.1 --- a/examples/Common/Configurator/Resources/scripts/sarissa.js Sun Sep 09 16:47:37 2007 +0000 2.2 +++ b/examples/Common/Configurator/Resources/scripts/sarissa.js Sun Sep 09 16:47:54 2007 +0000 2.3 @@ -6,7 +6,8 @@ 2.4 * The library supports Gecko based browsers like Mozilla and Firefox, 2.5 * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 2.6 * @version ${project.version} 2.7 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 2.8 + * @author: @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net 2.9 + * 2.10 * ==================================================================== 2.11 * Licence 2.12 * ==================================================================== 2.13 @@ -17,6 +18,7 @@ 2.14 * In case your copy of Sarissa does not include the license texts, you may find 2.15 * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 2.16 * <a href="http://www.apache.org">http://www.apache.org</a>. 2.17 + * 2.18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 2.19 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 2.20 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 2.21 @@ -43,12 +45,25 @@ 2.22 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 2.23 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 2.24 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 2.25 -var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 2.26 +var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari") != -1 || navigator.userAgent.toLowerCase().indexOf("konqueror") != -1; 2.27 +var _SARISSA_IS_SAFARI_OLD = _SARISSA_IS_SAFARI && parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1]) < 420; 2.28 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 2.29 +var _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera") != -1; 2.30 if(!window.Node || !Node.ELEMENT_NODE){ 2.31 Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 2.32 }; 2.33 2.34 +//This breaks for(x in o) loops in the old Safari 2.35 +if(_SARISSA_IS_SAFARI_OLD){ 2.36 + HTMLHtmlElement = document.createElement("html").constructor; 2.37 + Node = HTMLElement = {}; 2.38 + HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__; 2.39 + HTMLDocument = Document = document.constructor; 2.40 + var x = new DOMParser(); 2.41 + XMLDocument = x.constructor; 2.42 + Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor; 2.43 + x = null; 2.44 +} 2.45 if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 2.46 2.47 // IE initialization 2.48 @@ -68,18 +83,19 @@ 2.49 */ 2.50 Sarissa.pickRecentProgID = function (idList){ 2.51 // found progID flag 2.52 - var bFound = false; 2.53 + var bFound = false, e; 2.54 for(var i=0; i < idList.length && !bFound; i++){ 2.55 try{ 2.56 var oDoc = new ActiveXObject(idList[i]); 2.57 - o2Store = idList[i]; 2.58 + var o2Store = idList[i]; 2.59 bFound = true; 2.60 }catch (objException){ 2.61 // trap; try next progID 2.62 + e = objException; 2.63 }; 2.64 }; 2.65 if (!bFound) { 2.66 - throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 2.67 + throw "Could not retrieve a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 2.68 }; 2.69 idList = null; 2.70 return o2Store; 2.71 @@ -184,12 +200,15 @@ 2.72 // convert stylesheet to free threaded 2.73 var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 2.74 // make included/imported stylesheets work if exist and xsl was originally loaded from url 2.75 + try{ 2.76 + converted.resolveExternals = true; 2.77 + converted.setProperty("AllowDocumentFunction", true); 2.78 + } 2.79 + catch(e){ 2.80 + // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later. 2.81 + }; 2.82 if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 2.83 converted.async = false; 2.84 - if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 2.85 - converted.setProperty("AllowDocumentFunction", true); 2.86 - converted.resolveExternals = true; 2.87 - } 2.88 converted.load(xslDoc.url); 2.89 } else { 2.90 converted.loadXML(xslDoc.xml); 2.91 @@ -200,7 +219,7 @@ 2.92 this.template.stylesheet = converted; 2.93 this.processor = this.template.createProcessor(); 2.94 // for getParameter and clearParameters 2.95 - this.paramsSet = new Array(); 2.96 + this.paramsSet = []; 2.97 }; 2.98 2.99 /** 2.100 @@ -273,21 +292,22 @@ 2.101 * @argument name The parameter base name 2.102 * @argument value The new parameter value 2.103 */ 2.104 - XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 2.105 - // make value a zero length string if null to allow clearing 2.106 - value = value ? value : ""; 2.107 - // nsURI is optional but cannot be null 2.108 - if(nsURI){ 2.109 - this.processor.addParameter(name, value, nsURI); 2.110 - }else{ 2.111 - this.processor.addParameter(name, value); 2.112 - }; 2.113 - // update updated params for getParameter 2.114 - if(!this.paramsSet[""+nsURI]){ 2.115 - this.paramsSet[""+nsURI] = new Array(); 2.116 - }; 2.117 - this.paramsSet[""+nsURI][name] = value; 2.118 - }; 2.119 + XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 2.120 + // make value a zero length string if null to allow clearing 2.121 + value = value ? value : ""; 2.122 + // nsURI is optional but cannot be null 2.123 + if(nsURI){ 2.124 + this.processor.addParameter(name, value, nsURI); 2.125 + }else{ 2.126 + this.processor.addParameter(name, value); 2.127 + }; 2.128 + // update updated params for getParameter 2.129 + nsURI = "" + (nsURI || ""); 2.130 + if(!this.paramsSet[nsURI]){ 2.131 + this.paramsSet[nsURI] = new Array(); 2.132 + }; 2.133 + this.paramsSet[nsURI][name] = value; 2.134 + }; 2.135 /** 2.136 * Gets a parameter if previously set by setParameter. Returns null 2.137 * otherwise 2.138 @@ -296,7 +316,7 @@ 2.139 * @return The parameter value if reviously set by setParameter, null otherwise 2.140 */ 2.141 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 2.142 - nsURI = "" + nsURI; 2.143 + nsURI = "" + (nsURI || ""); 2.144 if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 2.145 return this.paramsSet[nsURI][name]; 2.146 }else{ 2.147 @@ -309,7 +329,7 @@ 2.148 XSLTProcessor.prototype.clearParameters = function(){ 2.149 for(var nsURI in this.paramsSet){ 2.150 for(var name in this.paramsSet[nsURI]){ 2.151 - if(nsURI){ 2.152 + if(nsURI!=""){ 2.153 this.processor.addParameter(name, "", nsURI); 2.154 }else{ 2.155 this.processor.addParameter(name, ""); 2.156 @@ -346,8 +366,9 @@ 2.157 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 2.158 oDoc.readyState = iReadyState; 2.159 oDoc.readystate = iReadyState; 2.160 - if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 2.161 + if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") { 2.162 oDoc.onreadystatechange(); 2.163 + } 2.164 }; 2.165 Sarissa.getDomDocument = function(sUri, sName){ 2.166 var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 2.167 @@ -421,7 +442,7 @@ 2.168 xmlhttp.send(null); 2.169 return xmlhttp.responseXML; 2.170 }; 2.171 - }else if(Sarissa.getDomDocument && Sarissa.getDomDocument()){ 2.172 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 2.173 DOMParser = function() { }; 2.174 DOMParser.prototype.parseFromString = function(sXml, contentType){ 2.175 var doc = Sarissa.getDomDocument(); 2.176 @@ -554,6 +575,10 @@ 2.177 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 2.178 */ 2.179 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 2.180 + if(_SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ?? 2.181 + nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node 2.182 + } 2.183 + 2.184 if((!nodeFrom) || (!nodeTo)){ 2.185 throw "Both source and destination nodes must be provided"; 2.186 }; 2.187 @@ -610,12 +635,12 @@ 2.188 }; 2.189 2.190 /** 2.191 - * <p>Serialize any object to an XML string. All properties are serialized using the property name 2.192 + * <p>Serialize any <strong>non</strong> DOM object to an XML string. All properties are serialized using the property name 2.193 * as the XML element name. Array elements are rendered as <code>array-item</code> elements, 2.194 * using their index/key as the value of the <code>key</code> attribute.</p> 2.195 * @argument anyObject the object to serialize 2.196 * @argument objectName a name for that object 2.197 - * @return the XML serializationj of the given object as a string 2.198 + * @return the XML serialization of the given object as a string 2.199 */ 2.200 Sarissa.xmlize = function(anyObject, objectName, indentSpace){ 2.201 indentSpace = indentSpace?indentSpace:''; 2.202 @@ -627,14 +652,13 @@ 2.203 isLeaf = true; 2.204 }else{ 2.205 s += "\n"; 2.206 - var itemKey = ''; 2.207 var isArrayItem = anyObject instanceof Array; 2.208 for(var name in anyObject){ 2.209 s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " "); 2.210 }; 2.211 s += indentSpace; 2.212 }; 2.213 - return s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n"); 2.214 + return (s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n")); 2.215 }; 2.216 2.217 /**
3.1 --- a/examples/Common/Dictionary/Resources/scripts/XSLForms.js Sun Sep 09 16:47:37 2007 +0000 3.2 +++ b/examples/Common/Dictionary/Resources/scripts/XSLForms.js Sun Sep 09 16:47:54 2007 +0000 3.3 @@ -88,7 +88,7 @@ 3.4 3.5 // NOTE: Test Konqueror bug. 3.6 3.7 - //showMismatch(targetFieldNameArray); 3.8 + //showMismatch(targetFieldNames); 3.9 3.10 return false; 3.11 }
4.1 --- a/examples/Common/Dictionary/Resources/scripts/sarissa.js Sun Sep 09 16:47:37 2007 +0000 4.2 +++ b/examples/Common/Dictionary/Resources/scripts/sarissa.js Sun Sep 09 16:47:54 2007 +0000 4.3 @@ -6,7 +6,8 @@ 4.4 * The library supports Gecko based browsers like Mozilla and Firefox, 4.5 * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 4.6 * @version ${project.version} 4.7 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 4.8 + * @author: @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net 4.9 + * 4.10 * ==================================================================== 4.11 * Licence 4.12 * ==================================================================== 4.13 @@ -17,6 +18,7 @@ 4.14 * In case your copy of Sarissa does not include the license texts, you may find 4.15 * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 4.16 * <a href="http://www.apache.org">http://www.apache.org</a>. 4.17 + * 4.18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 4.19 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 4.20 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 4.21 @@ -43,12 +45,25 @@ 4.22 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 4.23 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 4.24 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 4.25 -var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 4.26 +var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari") != -1 || navigator.userAgent.toLowerCase().indexOf("konqueror") != -1; 4.27 +var _SARISSA_IS_SAFARI_OLD = _SARISSA_IS_SAFARI && parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1]) < 420; 4.28 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 4.29 +var _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera") != -1; 4.30 if(!window.Node || !Node.ELEMENT_NODE){ 4.31 Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 4.32 }; 4.33 4.34 +//This breaks for(x in o) loops in the old Safari 4.35 +if(_SARISSA_IS_SAFARI_OLD){ 4.36 + HTMLHtmlElement = document.createElement("html").constructor; 4.37 + Node = HTMLElement = {}; 4.38 + HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__; 4.39 + HTMLDocument = Document = document.constructor; 4.40 + var x = new DOMParser(); 4.41 + XMLDocument = x.constructor; 4.42 + Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor; 4.43 + x = null; 4.44 +} 4.45 if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 4.46 4.47 // IE initialization 4.48 @@ -68,18 +83,19 @@ 4.49 */ 4.50 Sarissa.pickRecentProgID = function (idList){ 4.51 // found progID flag 4.52 - var bFound = false; 4.53 + var bFound = false, e; 4.54 for(var i=0; i < idList.length && !bFound; i++){ 4.55 try{ 4.56 var oDoc = new ActiveXObject(idList[i]); 4.57 - o2Store = idList[i]; 4.58 + var o2Store = idList[i]; 4.59 bFound = true; 4.60 }catch (objException){ 4.61 // trap; try next progID 4.62 + e = objException; 4.63 }; 4.64 }; 4.65 if (!bFound) { 4.66 - throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 4.67 + throw "Could not retrieve a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 4.68 }; 4.69 idList = null; 4.70 return o2Store; 4.71 @@ -184,12 +200,15 @@ 4.72 // convert stylesheet to free threaded 4.73 var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 4.74 // make included/imported stylesheets work if exist and xsl was originally loaded from url 4.75 + try{ 4.76 + converted.resolveExternals = true; 4.77 + converted.setProperty("AllowDocumentFunction", true); 4.78 + } 4.79 + catch(e){ 4.80 + // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later. 4.81 + }; 4.82 if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 4.83 converted.async = false; 4.84 - if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 4.85 - converted.setProperty("AllowDocumentFunction", true); 4.86 - converted.resolveExternals = true; 4.87 - } 4.88 converted.load(xslDoc.url); 4.89 } else { 4.90 converted.loadXML(xslDoc.xml); 4.91 @@ -200,7 +219,7 @@ 4.92 this.template.stylesheet = converted; 4.93 this.processor = this.template.createProcessor(); 4.94 // for getParameter and clearParameters 4.95 - this.paramsSet = new Array(); 4.96 + this.paramsSet = []; 4.97 }; 4.98 4.99 /** 4.100 @@ -273,21 +292,22 @@ 4.101 * @argument name The parameter base name 4.102 * @argument value The new parameter value 4.103 */ 4.104 - XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 4.105 - // make value a zero length string if null to allow clearing 4.106 - value = value ? value : ""; 4.107 - // nsURI is optional but cannot be null 4.108 - if(nsURI){ 4.109 - this.processor.addParameter(name, value, nsURI); 4.110 - }else{ 4.111 - this.processor.addParameter(name, value); 4.112 - }; 4.113 - // update updated params for getParameter 4.114 - if(!this.paramsSet[""+nsURI]){ 4.115 - this.paramsSet[""+nsURI] = new Array(); 4.116 - }; 4.117 - this.paramsSet[""+nsURI][name] = value; 4.118 - }; 4.119 + XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 4.120 + // make value a zero length string if null to allow clearing 4.121 + value = value ? value : ""; 4.122 + // nsURI is optional but cannot be null 4.123 + if(nsURI){ 4.124 + this.processor.addParameter(name, value, nsURI); 4.125 + }else{ 4.126 + this.processor.addParameter(name, value); 4.127 + }; 4.128 + // update updated params for getParameter 4.129 + nsURI = "" + (nsURI || ""); 4.130 + if(!this.paramsSet[nsURI]){ 4.131 + this.paramsSet[nsURI] = new Array(); 4.132 + }; 4.133 + this.paramsSet[nsURI][name] = value; 4.134 + }; 4.135 /** 4.136 * Gets a parameter if previously set by setParameter. Returns null 4.137 * otherwise 4.138 @@ -296,7 +316,7 @@ 4.139 * @return The parameter value if reviously set by setParameter, null otherwise 4.140 */ 4.141 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 4.142 - nsURI = "" + nsURI; 4.143 + nsURI = "" + (nsURI || ""); 4.144 if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 4.145 return this.paramsSet[nsURI][name]; 4.146 }else{ 4.147 @@ -309,7 +329,7 @@ 4.148 XSLTProcessor.prototype.clearParameters = function(){ 4.149 for(var nsURI in this.paramsSet){ 4.150 for(var name in this.paramsSet[nsURI]){ 4.151 - if(nsURI){ 4.152 + if(nsURI!=""){ 4.153 this.processor.addParameter(name, "", nsURI); 4.154 }else{ 4.155 this.processor.addParameter(name, ""); 4.156 @@ -346,8 +366,9 @@ 4.157 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 4.158 oDoc.readyState = iReadyState; 4.159 oDoc.readystate = iReadyState; 4.160 - if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 4.161 + if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") { 4.162 oDoc.onreadystatechange(); 4.163 + } 4.164 }; 4.165 Sarissa.getDomDocument = function(sUri, sName){ 4.166 var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 4.167 @@ -421,7 +442,7 @@ 4.168 xmlhttp.send(null); 4.169 return xmlhttp.responseXML; 4.170 }; 4.171 - }else if(Sarissa.getDomDocument && Sarissa.getDomDocument()){ 4.172 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 4.173 DOMParser = function() { }; 4.174 DOMParser.prototype.parseFromString = function(sXml, contentType){ 4.175 var doc = Sarissa.getDomDocument(); 4.176 @@ -554,6 +575,10 @@ 4.177 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 4.178 */ 4.179 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 4.180 + if(_SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ?? 4.181 + nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node 4.182 + } 4.183 + 4.184 if((!nodeFrom) || (!nodeTo)){ 4.185 throw "Both source and destination nodes must be provided"; 4.186 }; 4.187 @@ -610,12 +635,12 @@ 4.188 }; 4.189 4.190 /** 4.191 - * <p>Serialize any object to an XML string. All properties are serialized using the property name 4.192 + * <p>Serialize any <strong>non</strong> DOM object to an XML string. All properties are serialized using the property name 4.193 * as the XML element name. Array elements are rendered as <code>array-item</code> elements, 4.194 * using their index/key as the value of the <code>key</code> attribute.</p> 4.195 * @argument anyObject the object to serialize 4.196 * @argument objectName a name for that object 4.197 - * @return the XML serializationj of the given object as a string 4.198 + * @return the XML serialization of the given object as a string 4.199 */ 4.200 Sarissa.xmlize = function(anyObject, objectName, indentSpace){ 4.201 indentSpace = indentSpace?indentSpace:''; 4.202 @@ -627,14 +652,13 @@ 4.203 isLeaf = true; 4.204 }else{ 4.205 s += "\n"; 4.206 - var itemKey = ''; 4.207 var isArrayItem = anyObject instanceof Array; 4.208 for(var name in anyObject){ 4.209 s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " "); 4.210 }; 4.211 s += indentSpace; 4.212 }; 4.213 - return s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n"); 4.214 + return (s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n")); 4.215 }; 4.216 4.217 /**
5.1 --- a/examples/Common/PEP241/Resources/scripts/XSLForms.js Sun Sep 09 16:47:37 2007 +0000 5.2 +++ b/examples/Common/PEP241/Resources/scripts/XSLForms.js Sun Sep 09 16:47:54 2007 +0000 5.3 @@ -88,7 +88,7 @@ 5.4 5.5 // NOTE: Test Konqueror bug. 5.6 5.7 - //showMismatch(targetFieldNameArray); 5.8 + //showMismatch(targetFieldNames); 5.9 5.10 return false; 5.11 }
6.1 --- a/examples/Common/PEP241/Resources/scripts/sarissa.js Sun Sep 09 16:47:37 2007 +0000 6.2 +++ b/examples/Common/PEP241/Resources/scripts/sarissa.js Sun Sep 09 16:47:54 2007 +0000 6.3 @@ -6,7 +6,8 @@ 6.4 * The library supports Gecko based browsers like Mozilla and Firefox, 6.5 * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 6.6 * @version ${project.version} 6.7 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 6.8 + * @author: @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net 6.9 + * 6.10 * ==================================================================== 6.11 * Licence 6.12 * ==================================================================== 6.13 @@ -17,6 +18,7 @@ 6.14 * In case your copy of Sarissa does not include the license texts, you may find 6.15 * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 6.16 * <a href="http://www.apache.org">http://www.apache.org</a>. 6.17 + * 6.18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 6.19 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 6.20 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 6.21 @@ -43,12 +45,25 @@ 6.22 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 6.23 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 6.24 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 6.25 -var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 6.26 +var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari") != -1 || navigator.userAgent.toLowerCase().indexOf("konqueror") != -1; 6.27 +var _SARISSA_IS_SAFARI_OLD = _SARISSA_IS_SAFARI && parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1]) < 420; 6.28 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 6.29 +var _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera") != -1; 6.30 if(!window.Node || !Node.ELEMENT_NODE){ 6.31 Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 6.32 }; 6.33 6.34 +//This breaks for(x in o) loops in the old Safari 6.35 +if(_SARISSA_IS_SAFARI_OLD){ 6.36 + HTMLHtmlElement = document.createElement("html").constructor; 6.37 + Node = HTMLElement = {}; 6.38 + HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__; 6.39 + HTMLDocument = Document = document.constructor; 6.40 + var x = new DOMParser(); 6.41 + XMLDocument = x.constructor; 6.42 + Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor; 6.43 + x = null; 6.44 +} 6.45 if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 6.46 6.47 // IE initialization 6.48 @@ -68,18 +83,19 @@ 6.49 */ 6.50 Sarissa.pickRecentProgID = function (idList){ 6.51 // found progID flag 6.52 - var bFound = false; 6.53 + var bFound = false, e; 6.54 for(var i=0; i < idList.length && !bFound; i++){ 6.55 try{ 6.56 var oDoc = new ActiveXObject(idList[i]); 6.57 - o2Store = idList[i]; 6.58 + var o2Store = idList[i]; 6.59 bFound = true; 6.60 }catch (objException){ 6.61 // trap; try next progID 6.62 + e = objException; 6.63 }; 6.64 }; 6.65 if (!bFound) { 6.66 - throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 6.67 + throw "Could not retrieve a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 6.68 }; 6.69 idList = null; 6.70 return o2Store; 6.71 @@ -184,12 +200,15 @@ 6.72 // convert stylesheet to free threaded 6.73 var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 6.74 // make included/imported stylesheets work if exist and xsl was originally loaded from url 6.75 + try{ 6.76 + converted.resolveExternals = true; 6.77 + converted.setProperty("AllowDocumentFunction", true); 6.78 + } 6.79 + catch(e){ 6.80 + // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later. 6.81 + }; 6.82 if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 6.83 converted.async = false; 6.84 - if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 6.85 - converted.setProperty("AllowDocumentFunction", true); 6.86 - converted.resolveExternals = true; 6.87 - } 6.88 converted.load(xslDoc.url); 6.89 } else { 6.90 converted.loadXML(xslDoc.xml); 6.91 @@ -200,7 +219,7 @@ 6.92 this.template.stylesheet = converted; 6.93 this.processor = this.template.createProcessor(); 6.94 // for getParameter and clearParameters 6.95 - this.paramsSet = new Array(); 6.96 + this.paramsSet = []; 6.97 }; 6.98 6.99 /** 6.100 @@ -273,21 +292,22 @@ 6.101 * @argument name The parameter base name 6.102 * @argument value The new parameter value 6.103 */ 6.104 - XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 6.105 - // make value a zero length string if null to allow clearing 6.106 - value = value ? value : ""; 6.107 - // nsURI is optional but cannot be null 6.108 - if(nsURI){ 6.109 - this.processor.addParameter(name, value, nsURI); 6.110 - }else{ 6.111 - this.processor.addParameter(name, value); 6.112 - }; 6.113 - // update updated params for getParameter 6.114 - if(!this.paramsSet[""+nsURI]){ 6.115 - this.paramsSet[""+nsURI] = new Array(); 6.116 - }; 6.117 - this.paramsSet[""+nsURI][name] = value; 6.118 - }; 6.119 + XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 6.120 + // make value a zero length string if null to allow clearing 6.121 + value = value ? value : ""; 6.122 + // nsURI is optional but cannot be null 6.123 + if(nsURI){ 6.124 + this.processor.addParameter(name, value, nsURI); 6.125 + }else{ 6.126 + this.processor.addParameter(name, value); 6.127 + }; 6.128 + // update updated params for getParameter 6.129 + nsURI = "" + (nsURI || ""); 6.130 + if(!this.paramsSet[nsURI]){ 6.131 + this.paramsSet[nsURI] = new Array(); 6.132 + }; 6.133 + this.paramsSet[nsURI][name] = value; 6.134 + }; 6.135 /** 6.136 * Gets a parameter if previously set by setParameter. Returns null 6.137 * otherwise 6.138 @@ -296,7 +316,7 @@ 6.139 * @return The parameter value if reviously set by setParameter, null otherwise 6.140 */ 6.141 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 6.142 - nsURI = "" + nsURI; 6.143 + nsURI = "" + (nsURI || ""); 6.144 if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 6.145 return this.paramsSet[nsURI][name]; 6.146 }else{ 6.147 @@ -309,7 +329,7 @@ 6.148 XSLTProcessor.prototype.clearParameters = function(){ 6.149 for(var nsURI in this.paramsSet){ 6.150 for(var name in this.paramsSet[nsURI]){ 6.151 - if(nsURI){ 6.152 + if(nsURI!=""){ 6.153 this.processor.addParameter(name, "", nsURI); 6.154 }else{ 6.155 this.processor.addParameter(name, ""); 6.156 @@ -346,8 +366,9 @@ 6.157 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 6.158 oDoc.readyState = iReadyState; 6.159 oDoc.readystate = iReadyState; 6.160 - if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 6.161 + if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") { 6.162 oDoc.onreadystatechange(); 6.163 + } 6.164 }; 6.165 Sarissa.getDomDocument = function(sUri, sName){ 6.166 var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 6.167 @@ -421,7 +442,7 @@ 6.168 xmlhttp.send(null); 6.169 return xmlhttp.responseXML; 6.170 }; 6.171 - }else if(Sarissa.getDomDocument && Sarissa.getDomDocument()){ 6.172 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 6.173 DOMParser = function() { }; 6.174 DOMParser.prototype.parseFromString = function(sXml, contentType){ 6.175 var doc = Sarissa.getDomDocument(); 6.176 @@ -554,6 +575,10 @@ 6.177 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 6.178 */ 6.179 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 6.180 + if(_SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ?? 6.181 + nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node 6.182 + } 6.183 + 6.184 if((!nodeFrom) || (!nodeTo)){ 6.185 throw "Both source and destination nodes must be provided"; 6.186 }; 6.187 @@ -610,12 +635,12 @@ 6.188 }; 6.189 6.190 /** 6.191 - * <p>Serialize any object to an XML string. All properties are serialized using the property name 6.192 + * <p>Serialize any <strong>non</strong> DOM object to an XML string. All properties are serialized using the property name 6.193 * as the XML element name. Array elements are rendered as <code>array-item</code> elements, 6.194 * using their index/key as the value of the <code>key</code> attribute.</p> 6.195 * @argument anyObject the object to serialize 6.196 * @argument objectName a name for that object 6.197 - * @return the XML serializationj of the given object as a string 6.198 + * @return the XML serialization of the given object as a string 6.199 */ 6.200 Sarissa.xmlize = function(anyObject, objectName, indentSpace){ 6.201 indentSpace = indentSpace?indentSpace:''; 6.202 @@ -627,14 +652,13 @@ 6.203 isLeaf = true; 6.204 }else{ 6.205 s += "\n"; 6.206 - var itemKey = ''; 6.207 var isArrayItem = anyObject instanceof Array; 6.208 for(var name in anyObject){ 6.209 s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " "); 6.210 }; 6.211 s += indentSpace; 6.212 }; 6.213 - return s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n"); 6.214 + return (s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n")); 6.215 }; 6.216 6.217 /**
7.1 --- a/examples/Common/QtConfigurator/Resources/scripts/XSLForms.js Sun Sep 09 16:47:37 2007 +0000 7.2 +++ b/examples/Common/QtConfigurator/Resources/scripts/XSLForms.js Sun Sep 09 16:47:54 2007 +0000 7.3 @@ -88,7 +88,7 @@ 7.4 7.5 // NOTE: Test Konqueror bug. 7.6 7.7 - //showMismatch(targetFieldNameArray); 7.8 + //showMismatch(targetFieldNames); 7.9 7.10 return false; 7.11 }
8.1 --- a/examples/Common/QtConfigurator/Resources/scripts/sarissa.js Sun Sep 09 16:47:37 2007 +0000 8.2 +++ b/examples/Common/QtConfigurator/Resources/scripts/sarissa.js Sun Sep 09 16:47:54 2007 +0000 8.3 @@ -6,7 +6,8 @@ 8.4 * The library supports Gecko based browsers like Mozilla and Firefox, 8.5 * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 8.6 * @version ${project.version} 8.7 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 8.8 + * @author: @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net 8.9 + * 8.10 * ==================================================================== 8.11 * Licence 8.12 * ==================================================================== 8.13 @@ -17,6 +18,7 @@ 8.14 * In case your copy of Sarissa does not include the license texts, you may find 8.15 * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 8.16 * <a href="http://www.apache.org">http://www.apache.org</a>. 8.17 + * 8.18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 8.19 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 8.20 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 8.21 @@ -43,12 +45,25 @@ 8.22 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 8.23 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 8.24 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 8.25 -var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 8.26 +var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari") != -1 || navigator.userAgent.toLowerCase().indexOf("konqueror") != -1; 8.27 +var _SARISSA_IS_SAFARI_OLD = _SARISSA_IS_SAFARI && parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1]) < 420; 8.28 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 8.29 +var _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera") != -1; 8.30 if(!window.Node || !Node.ELEMENT_NODE){ 8.31 Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 8.32 }; 8.33 8.34 +//This breaks for(x in o) loops in the old Safari 8.35 +if(_SARISSA_IS_SAFARI_OLD){ 8.36 + HTMLHtmlElement = document.createElement("html").constructor; 8.37 + Node = HTMLElement = {}; 8.38 + HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__; 8.39 + HTMLDocument = Document = document.constructor; 8.40 + var x = new DOMParser(); 8.41 + XMLDocument = x.constructor; 8.42 + Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor; 8.43 + x = null; 8.44 +} 8.45 if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 8.46 8.47 // IE initialization 8.48 @@ -68,18 +83,19 @@ 8.49 */ 8.50 Sarissa.pickRecentProgID = function (idList){ 8.51 // found progID flag 8.52 - var bFound = false; 8.53 + var bFound = false, e; 8.54 for(var i=0; i < idList.length && !bFound; i++){ 8.55 try{ 8.56 var oDoc = new ActiveXObject(idList[i]); 8.57 - o2Store = idList[i]; 8.58 + var o2Store = idList[i]; 8.59 bFound = true; 8.60 }catch (objException){ 8.61 // trap; try next progID 8.62 + e = objException; 8.63 }; 8.64 }; 8.65 if (!bFound) { 8.66 - throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 8.67 + throw "Could not retrieve a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 8.68 }; 8.69 idList = null; 8.70 return o2Store; 8.71 @@ -184,12 +200,15 @@ 8.72 // convert stylesheet to free threaded 8.73 var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 8.74 // make included/imported stylesheets work if exist and xsl was originally loaded from url 8.75 + try{ 8.76 + converted.resolveExternals = true; 8.77 + converted.setProperty("AllowDocumentFunction", true); 8.78 + } 8.79 + catch(e){ 8.80 + // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later. 8.81 + }; 8.82 if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 8.83 converted.async = false; 8.84 - if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 8.85 - converted.setProperty("AllowDocumentFunction", true); 8.86 - converted.resolveExternals = true; 8.87 - } 8.88 converted.load(xslDoc.url); 8.89 } else { 8.90 converted.loadXML(xslDoc.xml); 8.91 @@ -200,7 +219,7 @@ 8.92 this.template.stylesheet = converted; 8.93 this.processor = this.template.createProcessor(); 8.94 // for getParameter and clearParameters 8.95 - this.paramsSet = new Array(); 8.96 + this.paramsSet = []; 8.97 }; 8.98 8.99 /** 8.100 @@ -273,21 +292,22 @@ 8.101 * @argument name The parameter base name 8.102 * @argument value The new parameter value 8.103 */ 8.104 - XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 8.105 - // make value a zero length string if null to allow clearing 8.106 - value = value ? value : ""; 8.107 - // nsURI is optional but cannot be null 8.108 - if(nsURI){ 8.109 - this.processor.addParameter(name, value, nsURI); 8.110 - }else{ 8.111 - this.processor.addParameter(name, value); 8.112 - }; 8.113 - // update updated params for getParameter 8.114 - if(!this.paramsSet[""+nsURI]){ 8.115 - this.paramsSet[""+nsURI] = new Array(); 8.116 - }; 8.117 - this.paramsSet[""+nsURI][name] = value; 8.118 - }; 8.119 + XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 8.120 + // make value a zero length string if null to allow clearing 8.121 + value = value ? value : ""; 8.122 + // nsURI is optional but cannot be null 8.123 + if(nsURI){ 8.124 + this.processor.addParameter(name, value, nsURI); 8.125 + }else{ 8.126 + this.processor.addParameter(name, value); 8.127 + }; 8.128 + // update updated params for getParameter 8.129 + nsURI = "" + (nsURI || ""); 8.130 + if(!this.paramsSet[nsURI]){ 8.131 + this.paramsSet[nsURI] = new Array(); 8.132 + }; 8.133 + this.paramsSet[nsURI][name] = value; 8.134 + }; 8.135 /** 8.136 * Gets a parameter if previously set by setParameter. Returns null 8.137 * otherwise 8.138 @@ -296,7 +316,7 @@ 8.139 * @return The parameter value if reviously set by setParameter, null otherwise 8.140 */ 8.141 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 8.142 - nsURI = "" + nsURI; 8.143 + nsURI = "" + (nsURI || ""); 8.144 if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 8.145 return this.paramsSet[nsURI][name]; 8.146 }else{ 8.147 @@ -309,7 +329,7 @@ 8.148 XSLTProcessor.prototype.clearParameters = function(){ 8.149 for(var nsURI in this.paramsSet){ 8.150 for(var name in this.paramsSet[nsURI]){ 8.151 - if(nsURI){ 8.152 + if(nsURI!=""){ 8.153 this.processor.addParameter(name, "", nsURI); 8.154 }else{ 8.155 this.processor.addParameter(name, ""); 8.156 @@ -346,8 +366,9 @@ 8.157 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 8.158 oDoc.readyState = iReadyState; 8.159 oDoc.readystate = iReadyState; 8.160 - if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 8.161 + if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") { 8.162 oDoc.onreadystatechange(); 8.163 + } 8.164 }; 8.165 Sarissa.getDomDocument = function(sUri, sName){ 8.166 var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 8.167 @@ -421,7 +442,7 @@ 8.168 xmlhttp.send(null); 8.169 return xmlhttp.responseXML; 8.170 }; 8.171 - }else if(Sarissa.getDomDocument && Sarissa.getDomDocument()){ 8.172 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 8.173 DOMParser = function() { }; 8.174 DOMParser.prototype.parseFromString = function(sXml, contentType){ 8.175 var doc = Sarissa.getDomDocument(); 8.176 @@ -554,6 +575,10 @@ 8.177 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 8.178 */ 8.179 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 8.180 + if(_SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ?? 8.181 + nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node 8.182 + } 8.183 + 8.184 if((!nodeFrom) || (!nodeTo)){ 8.185 throw "Both source and destination nodes must be provided"; 8.186 }; 8.187 @@ -610,12 +635,12 @@ 8.188 }; 8.189 8.190 /** 8.191 - * <p>Serialize any object to an XML string. All properties are serialized using the property name 8.192 + * <p>Serialize any <strong>non</strong> DOM object to an XML string. All properties are serialized using the property name 8.193 * as the XML element name. Array elements are rendered as <code>array-item</code> elements, 8.194 * using their index/key as the value of the <code>key</code> attribute.</p> 8.195 * @argument anyObject the object to serialize 8.196 * @argument objectName a name for that object 8.197 - * @return the XML serializationj of the given object as a string 8.198 + * @return the XML serialization of the given object as a string 8.199 */ 8.200 Sarissa.xmlize = function(anyObject, objectName, indentSpace){ 8.201 indentSpace = indentSpace?indentSpace:''; 8.202 @@ -627,14 +652,13 @@ 8.203 isLeaf = true; 8.204 }else{ 8.205 s += "\n"; 8.206 - var itemKey = ''; 8.207 var isArrayItem = anyObject instanceof Array; 8.208 for(var name in anyObject){ 8.209 s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " "); 8.210 }; 8.211 s += indentSpace; 8.212 }; 8.213 - return s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n"); 8.214 + return (s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n")); 8.215 }; 8.216 8.217 /**
9.1 --- a/examples/Common/VerySimple/Resources/scripts/XSLForms.js Sun Sep 09 16:47:37 2007 +0000 9.2 +++ b/examples/Common/VerySimple/Resources/scripts/XSLForms.js Sun Sep 09 16:47:54 2007 +0000 9.3 @@ -88,7 +88,7 @@ 9.4 9.5 // NOTE: Test Konqueror bug. 9.6 9.7 - //showMismatch(targetFieldNameArray); 9.8 + //showMismatch(targetFieldNames); 9.9 9.10 return false; 9.11 }
10.1 --- a/examples/Common/VerySimple/Resources/scripts/sarissa.js Sun Sep 09 16:47:37 2007 +0000 10.2 +++ b/examples/Common/VerySimple/Resources/scripts/sarissa.js Sun Sep 09 16:47:54 2007 +0000 10.3 @@ -6,7 +6,8 @@ 10.4 * The library supports Gecko based browsers like Mozilla and Firefox, 10.5 * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 10.6 * @version ${project.version} 10.7 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 10.8 + * @author: @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net 10.9 + * 10.10 * ==================================================================== 10.11 * Licence 10.12 * ==================================================================== 10.13 @@ -17,6 +18,7 @@ 10.14 * In case your copy of Sarissa does not include the license texts, you may find 10.15 * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 10.16 * <a href="http://www.apache.org">http://www.apache.org</a>. 10.17 + * 10.18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 10.19 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 10.20 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 10.21 @@ -43,12 +45,25 @@ 10.22 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 10.23 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 10.24 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 10.25 -var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 10.26 +var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari") != -1 || navigator.userAgent.toLowerCase().indexOf("konqueror") != -1; 10.27 +var _SARISSA_IS_SAFARI_OLD = _SARISSA_IS_SAFARI && parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1]) < 420; 10.28 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 10.29 +var _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera") != -1; 10.30 if(!window.Node || !Node.ELEMENT_NODE){ 10.31 Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 10.32 }; 10.33 10.34 +//This breaks for(x in o) loops in the old Safari 10.35 +if(_SARISSA_IS_SAFARI_OLD){ 10.36 + HTMLHtmlElement = document.createElement("html").constructor; 10.37 + Node = HTMLElement = {}; 10.38 + HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__; 10.39 + HTMLDocument = Document = document.constructor; 10.40 + var x = new DOMParser(); 10.41 + XMLDocument = x.constructor; 10.42 + Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor; 10.43 + x = null; 10.44 +} 10.45 if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 10.46 10.47 // IE initialization 10.48 @@ -68,18 +83,19 @@ 10.49 */ 10.50 Sarissa.pickRecentProgID = function (idList){ 10.51 // found progID flag 10.52 - var bFound = false; 10.53 + var bFound = false, e; 10.54 for(var i=0; i < idList.length && !bFound; i++){ 10.55 try{ 10.56 var oDoc = new ActiveXObject(idList[i]); 10.57 - o2Store = idList[i]; 10.58 + var o2Store = idList[i]; 10.59 bFound = true; 10.60 }catch (objException){ 10.61 // trap; try next progID 10.62 + e = objException; 10.63 }; 10.64 }; 10.65 if (!bFound) { 10.66 - throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 10.67 + throw "Could not retrieve a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 10.68 }; 10.69 idList = null; 10.70 return o2Store; 10.71 @@ -184,12 +200,15 @@ 10.72 // convert stylesheet to free threaded 10.73 var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 10.74 // make included/imported stylesheets work if exist and xsl was originally loaded from url 10.75 + try{ 10.76 + converted.resolveExternals = true; 10.77 + converted.setProperty("AllowDocumentFunction", true); 10.78 + } 10.79 + catch(e){ 10.80 + // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later. 10.81 + }; 10.82 if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 10.83 converted.async = false; 10.84 - if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 10.85 - converted.setProperty("AllowDocumentFunction", true); 10.86 - converted.resolveExternals = true; 10.87 - } 10.88 converted.load(xslDoc.url); 10.89 } else { 10.90 converted.loadXML(xslDoc.xml); 10.91 @@ -200,7 +219,7 @@ 10.92 this.template.stylesheet = converted; 10.93 this.processor = this.template.createProcessor(); 10.94 // for getParameter and clearParameters 10.95 - this.paramsSet = new Array(); 10.96 + this.paramsSet = []; 10.97 }; 10.98 10.99 /** 10.100 @@ -273,21 +292,22 @@ 10.101 * @argument name The parameter base name 10.102 * @argument value The new parameter value 10.103 */ 10.104 - XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 10.105 - // make value a zero length string if null to allow clearing 10.106 - value = value ? value : ""; 10.107 - // nsURI is optional but cannot be null 10.108 - if(nsURI){ 10.109 - this.processor.addParameter(name, value, nsURI); 10.110 - }else{ 10.111 - this.processor.addParameter(name, value); 10.112 - }; 10.113 - // update updated params for getParameter 10.114 - if(!this.paramsSet[""+nsURI]){ 10.115 - this.paramsSet[""+nsURI] = new Array(); 10.116 - }; 10.117 - this.paramsSet[""+nsURI][name] = value; 10.118 - }; 10.119 + XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 10.120 + // make value a zero length string if null to allow clearing 10.121 + value = value ? value : ""; 10.122 + // nsURI is optional but cannot be null 10.123 + if(nsURI){ 10.124 + this.processor.addParameter(name, value, nsURI); 10.125 + }else{ 10.126 + this.processor.addParameter(name, value); 10.127 + }; 10.128 + // update updated params for getParameter 10.129 + nsURI = "" + (nsURI || ""); 10.130 + if(!this.paramsSet[nsURI]){ 10.131 + this.paramsSet[nsURI] = new Array(); 10.132 + }; 10.133 + this.paramsSet[nsURI][name] = value; 10.134 + }; 10.135 /** 10.136 * Gets a parameter if previously set by setParameter. Returns null 10.137 * otherwise 10.138 @@ -296,7 +316,7 @@ 10.139 * @return The parameter value if reviously set by setParameter, null otherwise 10.140 */ 10.141 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 10.142 - nsURI = "" + nsURI; 10.143 + nsURI = "" + (nsURI || ""); 10.144 if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 10.145 return this.paramsSet[nsURI][name]; 10.146 }else{ 10.147 @@ -309,7 +329,7 @@ 10.148 XSLTProcessor.prototype.clearParameters = function(){ 10.149 for(var nsURI in this.paramsSet){ 10.150 for(var name in this.paramsSet[nsURI]){ 10.151 - if(nsURI){ 10.152 + if(nsURI!=""){ 10.153 this.processor.addParameter(name, "", nsURI); 10.154 }else{ 10.155 this.processor.addParameter(name, ""); 10.156 @@ -346,8 +366,9 @@ 10.157 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 10.158 oDoc.readyState = iReadyState; 10.159 oDoc.readystate = iReadyState; 10.160 - if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 10.161 + if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") { 10.162 oDoc.onreadystatechange(); 10.163 + } 10.164 }; 10.165 Sarissa.getDomDocument = function(sUri, sName){ 10.166 var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 10.167 @@ -421,7 +442,7 @@ 10.168 xmlhttp.send(null); 10.169 return xmlhttp.responseXML; 10.170 }; 10.171 - }else if(Sarissa.getDomDocument && Sarissa.getDomDocument()){ 10.172 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 10.173 DOMParser = function() { }; 10.174 DOMParser.prototype.parseFromString = function(sXml, contentType){ 10.175 var doc = Sarissa.getDomDocument(); 10.176 @@ -554,6 +575,10 @@ 10.177 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 10.178 */ 10.179 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 10.180 + if(_SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ?? 10.181 + nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node 10.182 + } 10.183 + 10.184 if((!nodeFrom) || (!nodeTo)){ 10.185 throw "Both source and destination nodes must be provided"; 10.186 }; 10.187 @@ -610,12 +635,12 @@ 10.188 }; 10.189 10.190 /** 10.191 - * <p>Serialize any object to an XML string. All properties are serialized using the property name 10.192 + * <p>Serialize any <strong>non</strong> DOM object to an XML string. All properties are serialized using the property name 10.193 * as the XML element name. Array elements are rendered as <code>array-item</code> elements, 10.194 * using their index/key as the value of the <code>key</code> attribute.</p> 10.195 * @argument anyObject the object to serialize 10.196 * @argument objectName a name for that object 10.197 - * @return the XML serializationj of the given object as a string 10.198 + * @return the XML serialization of the given object as a string 10.199 */ 10.200 Sarissa.xmlize = function(anyObject, objectName, indentSpace){ 10.201 indentSpace = indentSpace?indentSpace:''; 10.202 @@ -627,14 +652,13 @@ 10.203 isLeaf = true; 10.204 }else{ 10.205 s += "\n"; 10.206 - var itemKey = ''; 10.207 var isArrayItem = anyObject instanceof Array; 10.208 for(var name in anyObject){ 10.209 s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " "); 10.210 }; 10.211 s += indentSpace; 10.212 }; 10.213 - return s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n"); 10.214 + return (s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n")); 10.215 }; 10.216 10.217 /**
11.1 --- a/examples/Common/VerySimpleWithLogin/Resources/scripts/XSLForms.js Sun Sep 09 16:47:37 2007 +0000 11.2 +++ b/examples/Common/VerySimpleWithLogin/Resources/scripts/XSLForms.js Sun Sep 09 16:47:54 2007 +0000 11.3 @@ -88,7 +88,7 @@ 11.4 11.5 // NOTE: Test Konqueror bug. 11.6 11.7 - //showMismatch(targetFieldNameArray); 11.8 + //showMismatch(targetFieldNames); 11.9 11.10 return false; 11.11 }
12.1 --- a/examples/Common/VerySimpleWithLogin/Resources/scripts/sarissa.js Sun Sep 09 16:47:37 2007 +0000 12.2 +++ b/examples/Common/VerySimpleWithLogin/Resources/scripts/sarissa.js Sun Sep 09 16:47:54 2007 +0000 12.3 @@ -6,7 +6,8 @@ 12.4 * The library supports Gecko based browsers like Mozilla and Firefox, 12.5 * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 12.6 * @version ${project.version} 12.7 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 12.8 + * @author: @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net 12.9 + * 12.10 * ==================================================================== 12.11 * Licence 12.12 * ==================================================================== 12.13 @@ -17,6 +18,7 @@ 12.14 * In case your copy of Sarissa does not include the license texts, you may find 12.15 * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 12.16 * <a href="http://www.apache.org">http://www.apache.org</a>. 12.17 + * 12.18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 12.19 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 12.20 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 12.21 @@ -43,12 +45,25 @@ 12.22 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 12.23 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 12.24 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 12.25 -var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 12.26 +var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari") != -1 || navigator.userAgent.toLowerCase().indexOf("konqueror") != -1; 12.27 +var _SARISSA_IS_SAFARI_OLD = _SARISSA_IS_SAFARI && parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1]) < 420; 12.28 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 12.29 +var _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera") != -1; 12.30 if(!window.Node || !Node.ELEMENT_NODE){ 12.31 Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 12.32 }; 12.33 12.34 +//This breaks for(x in o) loops in the old Safari 12.35 +if(_SARISSA_IS_SAFARI_OLD){ 12.36 + HTMLHtmlElement = document.createElement("html").constructor; 12.37 + Node = HTMLElement = {}; 12.38 + HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__; 12.39 + HTMLDocument = Document = document.constructor; 12.40 + var x = new DOMParser(); 12.41 + XMLDocument = x.constructor; 12.42 + Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor; 12.43 + x = null; 12.44 +} 12.45 if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 12.46 12.47 // IE initialization 12.48 @@ -68,18 +83,19 @@ 12.49 */ 12.50 Sarissa.pickRecentProgID = function (idList){ 12.51 // found progID flag 12.52 - var bFound = false; 12.53 + var bFound = false, e; 12.54 for(var i=0; i < idList.length && !bFound; i++){ 12.55 try{ 12.56 var oDoc = new ActiveXObject(idList[i]); 12.57 - o2Store = idList[i]; 12.58 + var o2Store = idList[i]; 12.59 bFound = true; 12.60 }catch (objException){ 12.61 // trap; try next progID 12.62 + e = objException; 12.63 }; 12.64 }; 12.65 if (!bFound) { 12.66 - throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 12.67 + throw "Could not retrieve a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 12.68 }; 12.69 idList = null; 12.70 return o2Store; 12.71 @@ -184,12 +200,15 @@ 12.72 // convert stylesheet to free threaded 12.73 var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 12.74 // make included/imported stylesheets work if exist and xsl was originally loaded from url 12.75 + try{ 12.76 + converted.resolveExternals = true; 12.77 + converted.setProperty("AllowDocumentFunction", true); 12.78 + } 12.79 + catch(e){ 12.80 + // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later. 12.81 + }; 12.82 if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 12.83 converted.async = false; 12.84 - if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 12.85 - converted.setProperty("AllowDocumentFunction", true); 12.86 - converted.resolveExternals = true; 12.87 - } 12.88 converted.load(xslDoc.url); 12.89 } else { 12.90 converted.loadXML(xslDoc.xml); 12.91 @@ -200,7 +219,7 @@ 12.92 this.template.stylesheet = converted; 12.93 this.processor = this.template.createProcessor(); 12.94 // for getParameter and clearParameters 12.95 - this.paramsSet = new Array(); 12.96 + this.paramsSet = []; 12.97 }; 12.98 12.99 /** 12.100 @@ -273,21 +292,22 @@ 12.101 * @argument name The parameter base name 12.102 * @argument value The new parameter value 12.103 */ 12.104 - XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 12.105 - // make value a zero length string if null to allow clearing 12.106 - value = value ? value : ""; 12.107 - // nsURI is optional but cannot be null 12.108 - if(nsURI){ 12.109 - this.processor.addParameter(name, value, nsURI); 12.110 - }else{ 12.111 - this.processor.addParameter(name, value); 12.112 - }; 12.113 - // update updated params for getParameter 12.114 - if(!this.paramsSet[""+nsURI]){ 12.115 - this.paramsSet[""+nsURI] = new Array(); 12.116 - }; 12.117 - this.paramsSet[""+nsURI][name] = value; 12.118 - }; 12.119 + XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 12.120 + // make value a zero length string if null to allow clearing 12.121 + value = value ? value : ""; 12.122 + // nsURI is optional but cannot be null 12.123 + if(nsURI){ 12.124 + this.processor.addParameter(name, value, nsURI); 12.125 + }else{ 12.126 + this.processor.addParameter(name, value); 12.127 + }; 12.128 + // update updated params for getParameter 12.129 + nsURI = "" + (nsURI || ""); 12.130 + if(!this.paramsSet[nsURI]){ 12.131 + this.paramsSet[nsURI] = new Array(); 12.132 + }; 12.133 + this.paramsSet[nsURI][name] = value; 12.134 + }; 12.135 /** 12.136 * Gets a parameter if previously set by setParameter. Returns null 12.137 * otherwise 12.138 @@ -296,7 +316,7 @@ 12.139 * @return The parameter value if reviously set by setParameter, null otherwise 12.140 */ 12.141 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 12.142 - nsURI = "" + nsURI; 12.143 + nsURI = "" + (nsURI || ""); 12.144 if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 12.145 return this.paramsSet[nsURI][name]; 12.146 }else{ 12.147 @@ -309,7 +329,7 @@ 12.148 XSLTProcessor.prototype.clearParameters = function(){ 12.149 for(var nsURI in this.paramsSet){ 12.150 for(var name in this.paramsSet[nsURI]){ 12.151 - if(nsURI){ 12.152 + if(nsURI!=""){ 12.153 this.processor.addParameter(name, "", nsURI); 12.154 }else{ 12.155 this.processor.addParameter(name, ""); 12.156 @@ -346,8 +366,9 @@ 12.157 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 12.158 oDoc.readyState = iReadyState; 12.159 oDoc.readystate = iReadyState; 12.160 - if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 12.161 + if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") { 12.162 oDoc.onreadystatechange(); 12.163 + } 12.164 }; 12.165 Sarissa.getDomDocument = function(sUri, sName){ 12.166 var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 12.167 @@ -421,7 +442,7 @@ 12.168 xmlhttp.send(null); 12.169 return xmlhttp.responseXML; 12.170 }; 12.171 - }else if(Sarissa.getDomDocument && Sarissa.getDomDocument()){ 12.172 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 12.173 DOMParser = function() { }; 12.174 DOMParser.prototype.parseFromString = function(sXml, contentType){ 12.175 var doc = Sarissa.getDomDocument(); 12.176 @@ -554,6 +575,10 @@ 12.177 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 12.178 */ 12.179 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 12.180 + if(_SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ?? 12.181 + nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node 12.182 + } 12.183 + 12.184 if((!nodeFrom) || (!nodeTo)){ 12.185 throw "Both source and destination nodes must be provided"; 12.186 }; 12.187 @@ -610,12 +635,12 @@ 12.188 }; 12.189 12.190 /** 12.191 - * <p>Serialize any object to an XML string. All properties are serialized using the property name 12.192 + * <p>Serialize any <strong>non</strong> DOM object to an XML string. All properties are serialized using the property name 12.193 * as the XML element name. Array elements are rendered as <code>array-item</code> elements, 12.194 * using their index/key as the value of the <code>key</code> attribute.</p> 12.195 * @argument anyObject the object to serialize 12.196 * @argument objectName a name for that object 12.197 - * @return the XML serializationj of the given object as a string 12.198 + * @return the XML serialization of the given object as a string 12.199 */ 12.200 Sarissa.xmlize = function(anyObject, objectName, indentSpace){ 12.201 indentSpace = indentSpace?indentSpace:''; 12.202 @@ -627,14 +652,13 @@ 12.203 isLeaf = true; 12.204 }else{ 12.205 s += "\n"; 12.206 - var itemKey = ''; 12.207 var isArrayItem = anyObject instanceof Array; 12.208 for(var name in anyObject){ 12.209 s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " "); 12.210 }; 12.211 s += indentSpace; 12.212 }; 12.213 - return s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n"); 12.214 + return (s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n")); 12.215 }; 12.216 12.217 /**