[Pkg-mozext-commits] [firexpath] 21/51: Automatically lower case XPath expressions when it is evaluated on html files.
David Prévot
taffit at moszumanska.debian.org
Sun Mar 22 15:08:51 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firexpath.
commit 15bae31bd55a9ed173176fad2922b597f4c0afe8
Author: pierre.tholence at gmail.com <pierre.tholence at gmail.com@dfa30af4-1965-11df-8728-136f2c2ca76e>
Date: Sat Mar 12 17:26:24 2011 +0000
Automatically lower case XPath expressions when it is evaluated on html files.
git-svn-id: http://firepath.googlecode.com/svn/trunk@26 dfa30af4-1965-11df-8728-136f2c2ca76e
---
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