[Pkg-mozext-commits] [firexpath] 04/12: Automatically lower case XPath expressions when it is evaluated on html files.

David Prévot taffit at moszumanska.debian.org
Sat Mar 26 19:35:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag FirePath-0.9.6
in repository firexpath.

commit 6699f7afa6f8812c75f555bcb465e7ff33bdda54
Author: pierre.tholence <pierre.tholence at gmail.com>
Date:   Sat Mar 12 17:26:24 2011 +0000

    Automatically lower case XPath expressions when it is evaluated on html files.
---
 content/FirePathPanel.js | 13 ++++++++-----
 content/bindings.xml     |  5 ++++-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/content/FirePathPanel.js b/content/FirePathPanel.js
index 96fd3c0..0f85581 100644
--- a/content/FirePathPanel.js
+++ b/content/FirePathPanel.js
@@ -980,6 +980,10 @@ FBL.isArray = function (object) {
 		return FirebugReps.Arr.isArray(object);
 }
 
+FBL.isHtmlDocument = function(doc) {
+	return doc.contentType === 'text/html';
+}
+
 FBL.getTagName = function(node) {
 	var ns = node.namespaceURI;
 	var prefix = node.lookupPrefix(ns);
@@ -990,13 +994,12 @@ FBL.getTagName = function(node) {
 	}
 	
 	var name = node.localName;
-	if (node.ownerDocument instanceof HTMLDocument) {
+	if (isHtmlDocument(node.ownerDocument)) {
 		//lower case only for HTML document
-		name = name.toLowerCase();
+		return name.toLowerCase();
+	} else {
+		return prefix + ":" + name;
 	}
-	
-	// In firefox 3.6 the ns for html and xhtml nodes is http://www.w3.org/1999/xhtml we don't need to add a prefix for them
-	return (prefix && prefix != 'xhtml'? prefix + ":":"") + name;	
 }
 
 FBL.getPrefixFromNS = function(ns) {
diff --git a/content/bindings.xml b/content/bindings.xml
index 3ce5db5..bdbd71b 100644
--- a/content/bindings.xml
+++ b/content/bindings.xml
@@ -339,6 +339,9 @@
 				<parameter name="xPath"/>
 				<body><![CDATA[
 					try {
+						if (xPath && FBL.isHtmlDocument(this.FirePathPanel.location.document)) {
+							xPath = xPath.toLowerCase();
+						}
 						return this.xPathEvaluator.createExpression(xPath, this.NSResolver);
 					} catch (e) {
 						return null;
@@ -789,4 +792,4 @@
 
 		</implementation>
 	</binding>
-</bindings>
\ No newline at end of file
+</bindings>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firexpath.git



More information about the Pkg-mozext-commits mailing list