Its derived from
http://km0ti0n.blunted.co.uk/mozxpath/mozxpath.js
which is distributed under the following license:
http://creativecommons.org/licenses/by-sa/2.5/
The idea of implementing a getter for attributes, elements and textnodes
is from:
http://www.webfx.nu/dhtml/mozInnerHTML/mozInnerHtml.html
Yes, maybe here are some copyright glitches? :-( Maybe I have to ask the
authors. Please wait with applying the patch.
Sorry for the inconveniance.
Regards
Sebastian Werner schrieb:
Dietrich Streifert schrieb:
Here is a better patch which does not acces the text
property/attribute of nodes but implements getter methods for the
text property:
This is a diff against QxXmlExtras.js in cvs renderer branch.
Is this patch usable to get committed to the qooxdoo cvs? What is the
copyright stuff of this lines?
Sebastian
Dietrich Streifert schrieb:
Hello List!
if someone needs this: Gecko/Mozilla has no implementation of the
simple to handle xpath node selection methods selectNodes and
selectSingleNode (which are InternetExplorerer proprietary) for
Element and Document object. Here is the Implementation built as
patch for QxXmlExtras.
A little tutorial for the usage is:
selectNodes: http://www.webreference.com/js/tips/020309.html
selectSingleNode: http://www.webreference.com/js/tips/020310.html
------------------------------------------------------------------------
--- source/script/binding/QxXmlExtras.js.orig 2005-11-29
09:12:47.100690000 +0100
+++ source/script/binding/QxXmlExtras.js 2005-11-29
18:44:50.191349000 +0100
@@ -105,3 +105,60 @@
throw new Error("This browser does not support xml dom creation.");
};
+
+// Implementation of selectNodes() and selectSingleNode()
+// for Gecko/Mozilla browsers
+if (window.XPathEvaluator) {
+
+ var xpath = new XPathEvaluator();
+
+ // if (!Element.prototype.selectSingleNode) {
+ Element.prototype.selectSingleNode = function (path) {
+ return xpath.evaluate(path, this, this.ownerDocument._ns,
XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
+ };
+ //}
+ + // if (!Element.prototype.selectNodes) {
+ Element.prototype.selectNodes = function (path) {
+ var result = xpath.evaluate(path, this,
this.ownerDocument._ns, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+ var i, nodes = [];
+ + for (i=0; i<result.snapshotLength; i++) {
+ nodes[i] = result.snapshotItem(i);
+ };
+ + return nodes;
+ };
+ // }
+ + // if (!Document.prototype.selectSingleNode) {
+ Document.prototype.selectSingleNode = function (path) {
+ return xpath.evaluate(path, this, this._ns,
XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
+ };
+ // }
+ + // if (!Document.prototype.selectNodes) {
+ Document.prototype.selectNodes = function (path) {
+ var result = xpath.evaluate(path, this, this._ns,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+ var i, nodes = [];
+
+ for (i=0; i<result.snapshotLength; i++) {
+ nodes[i] = result.snapshotItem(i);
+ };
+ + return nodes;
+ };
+ // }
+
+ Element.prototype.text getter = function(){
+ var i, a=[], nodes = this.childNodes, length = nodes.length;
+ for (i=0; i<length; i++) {
+ a[i] = nodes[i].text
+ };
+ return a.join("");
+ };
+
+ Attr.prototype.text getter = function(){return this.nodeValue};
+ Text.prototype.text getter = function(){return this.nodeValue};
+}
+
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
--
Mit freundlichen Grüßen
Dietrich Streifert
Visionet GmbH
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel