rem: } 
add: } 
context: Freja.QueryEngine.SimplePath.prototype._find = function(document, expression) {	if (!expression.match(/^[\d\w\/@\[\]=_\-']*$/)) {		throw new Error("Can't evaluate expression " + expression);	}	var parts = expression.split(/\//);	var node = document;	var regAttr = new RegExp("^@([\\d\\w]*)");	var regOffset = new RegExp("^([@\\d\\w]*)\\[([\\d]*)\\]$");	var regFilter = new RegExp("^([\\d\\w]+)\\[@([@\\d\\w]+)=['\"]{1}(.*)['\"]{1}\\]$");	var attr = null;	var offset = 0;	for (var i = 0; i < parts.length; ++i) {		var part = parts[i];		var filter = regFilter.exec(part);		if(filter) {			// filter[1] element name, filter[2] attribute name, filter[3] attribute value			if(i>0 && parts[i-1]=='') {				// expression was of type //element[...] 				var cn = node.getElementsByTagName(filter[1]);			} else {				var cn = node.childNodes;			}			for(var j=0, l=cn.length; j<l ; j++) {				if(cn[j].nodeType==1 && cn[j].tagName==filter[1] && cn[j].getAttribute(filter[2])== filter[3]) {					node = cn[j];					break;				}			}			if (j==l)				throw new Error("Can't evaluate expression " + part);		}		else {					offset = regOffset.exec(part);			if (offset) {				part = offset[1];				offset = offset[2] - 1;			} else {				offset = 0;			}			if (part != "") {				attr = regAttr.exec(part);				if (attr) {					node = node.getAttributeNode(attr[1]);				} else {					node = node.getElementsByTagName(part).item(offset);				}			}		}	}	if (node && node.firstChild && node.firstChild.nodeType == 3) {		return node.firstChild;	} 	if (node && node.firstChild && node.firstChild.nodeType == 4) {		return node.firstChild;	}	if (node && node.nodeType==1 && !node.firstChild) {		// empty element (<tag/>). Let's create and return a blank text node		return node.appendChild(document.createTextNode(''));			  	}		if (!node) {				throw new Error("Can't evaluate expression " + expression);	}	return node;};
meta: 8607	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8607/8b42fb2ed090da7f1e336726dcb69d2649658e7c/QueryEngine.js/clean/trunk/src/QueryEngine.js