Question on reusing code of the forum
Hello Alex!
Some time ago there was a forum posting where the code for the selectNodes and selectSingleNode emulation was posted by you.
Is this snippet copyrighted or where is it derived from?
The Forum message was:
http://www.activewidgets.com/javascript.forum.4524.20/new-bug-with-firefox-1.html
Can I use the code for something else (project which is published under the LGPL)?
Pleas give me a short feedback.
Thank you.
Best Regards...
Some time ago there was a forum posting where the code for the selectNodes and selectSingleNode emulation was posted by you.
Is this snippet copyrighted or where is it derived from?
The Forum message was:
http://www.activewidgets.com/javascript.forum.4524.20/new-bug-with-firefox-1.html
if (window.XPathEvaluator) {
var xpath = new XPathEvaluator();
var element = Element.prototype;
var attr = Attr.prototype;
var doc = Document.prototype;
delete element.text;
delete attr.text;
element.selectNodes = function (path) {
var result = xpath.evaluate(path, this, this.ownerDocument._ns, 7, null);
var i, nodes = [];
for (i=0; i<result.snapshotLength; i++) {
nodes[i] = result.snapshotItem(i);
nodes[i].text = nodes[i].firstChild ? nodes[i].firstChild.nodeValue : "";
}
return nodes;
};
element.selectSingleNode = function (path) {
var node = xpath.evaluate(path, this, this.ownerDocument._ns, 9, null).singleNodeValue;
dump('element.selectSingleNode(path): ' + path + '\n');
if ( node != null ) node.text = node.firstChild ? node.firstChild.nodeValue : "";
return node;
};
doc.selectSingleNode = function (path) {
dump('doc.selectSingleNode(path): ' + path + '\n');
var node = xpath.evaluate(path, this, this._ns, 9, null).singleNodeValue;
if ( node != null ) node.text = node.firstChild ? node.firstChild.nodeValue : "";
return node;
};
doc.selectNodes = function (path) {
var result = xpath.evaluate(path, this, this._ns, 7, null);
var i, nodes = [];
for (i=0; i<result.snapshotLength; i++) {
nodes[i] = result.snapshotItem(i);
nodes[i].text = nodes[i].firstChild ? nodes[i].firstChild.nodeValue : "";
}
return nodes;
};
}
Can I use the code for something else (project which is published under the LGPL)?
Pleas give me a short feedback.
Thank you.
Best Regards...
Dietrich
November 30,