[kupu-checkins] r34260 - kupu/branch/kupu-1.3/common
duncan at codespeak.net
duncan at codespeak.net
Mon Nov 6 11:14:32 CET 2006
Author: duncan
Date: Mon Nov 6 11:14:31 2006
New Revision: 34260
Modified:
kupu/branch/kupu-1.3/common/kupudrawers.js
kupu/branch/kupu-1.3/common/sarissa.js
Log:
Changes to sarissa.js to support IE7. Avoid security warnings on progids, make copyChildNodes work with IE7. Fix kupudrawers.js to not do importNodes when it doesn't have to.
Modified: kupu/branch/kupu-1.3/common/kupudrawers.js
==============================================================================
--- kupu/branch/kupu-1.3/common/kupudrawers.js (original)
+++ kupu/branch/kupu-1.3/common/kupudrawers.js Mon Nov 6 11:14:31 2006
@@ -472,7 +472,6 @@
var doc = this._transformXml();
var sourcenode = doc.selectSingleNode('//*[@id="'+id+'"]');
var targetnode = document.getElementById(id);
- sourcenode = document.importNode(sourcenode, true);
Sarissa.copyChildNodes(sourcenode, targetnode);
if (!this.focussed) {
this.focusElement();
@@ -788,7 +787,7 @@
if (this.editor.getBrowserName() == 'IE') {
resultlib = resultlib.cloneNode(true);
} else {
- this.shared.xmldata.importNode(resultlib, true);
+ resultlib = this.shared.xmldata.importNode(resultlib, true);
}
var libraries = this.shared.xmldata.selectSingleNode("/libraries");
libraries.appendChild(resultlib);
Modified: kupu/branch/kupu-1.3/common/sarissa.js
==============================================================================
--- kupu/branch/kupu-1.3/common/sarissa.js (original)
+++ kupu/branch/kupu-1.3/common/sarissa.js Mon Nov 6 11:14:31 2006
@@ -74,7 +74,7 @@
* @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object
* @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled
*/
- pickRecentProgID = function (idList, enabledList){
+ Sarissa.pickRecentProgID = function (idList, enabledList){
// found progID flag
var bFound = false;
for(var i=0; i < idList.length && !bFound; i++){
@@ -94,18 +94,14 @@
idList = null;
return o2Store;
};
- // pick best available MSXML progIDs
- _SARISSA_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]);
- _SARISSA_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]);
- _SARISSA_THREADEDDOM_PROGID = pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]);
- _SARISSA_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]);
- // we dont need this anymore
- pickRecentProgID = null;
//============================================
// Factory methods (IE)
//============================================
// see non-IE version
Sarissa.getDomDocument = function(sUri, sName){
+ if (!_SARISSA_DOM_PROGID) {
+ _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]);
+ };
var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
// if a root tag name was provided, we need to load it in the DOM
// object
@@ -150,6 +146,9 @@
* @constructor
*/
XSLTProcessor = function(){
+ if (!_SARISSA_XSLTEMPLATE_PROGID) {
+ _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]);
+ };
this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);
this.processor = null;
};
@@ -159,6 +158,9 @@
*/
XSLTProcessor.prototype.importStylesheet = function(xslDoc){
// convert stylesheet to free threaded
+ if (!_SARISSA_THREADEDDOM_PROGID) {
+ _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]);
+ }
var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);
converted.loadXML(xslDoc.xml);
this.template.stylesheet = converted;
@@ -368,17 +370,19 @@
};
-if(window.XMLHttpRequest){
- Sarissa.IS_ENABLED_XMLHTTP = true;
-}
-else if(_SARISSA_IS_IE){
+if (!window.XMLHttpRequest && window.ActiveXObject) {
/**
* Emulate XMLHttpRequest
* @constructor
*/
XMLHttpRequest = function() {
+ if(!_SARISSA_XMLHTTP_PROGID){
+ _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]);
+ };
return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);
};
+}
+if(window.XMLHttpRequest){
Sarissa.IS_ENABLED_XMLHTTP = true;
};
@@ -507,7 +511,7 @@
};
var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
var nodes = nodeFrom.childNodes;
- if(ownerDoc.importNode && (!_SARISSA_IS_IE)) {
+ if(ownerDoc.importNode) {
for(var i=0;i < nodes.length;i++) {
nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
};
More information about the kupu-checkins
mailing list