[Pkg-javascript-commits] [dojo] 05/08: Merge Alex's changes from [15412] on to 1.2 branch. Fixes #7796 !strict
David Prévot
taffit at moszumanska.debian.org
Mon May 11 20:12:08 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.2.1
in repository dojo.
commit 6eee8688b949d54f4e4bae35ef4c03e3795af631
Author: Adam Peller <github at peller.org>
Date: Fri Oct 24 03:40:10 2008 +0000
Merge Alex's changes from [15412] on to 1.2 branch. Fixes #7796 !strict
git-svn-id: http://svn.dojotoolkit.org/src/branches/1.2/dojo@15515 560b804f-0ae3-0310-86f3-f6aa0a117693
---
_base/query.js | 4 ++--
tests/_base/query.html | 52 ++++++++++++++++++++++++++++++--------------------
2 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/_base/query.js b/_base/query.js
index 51914c2..ceb7f75 100644
--- a/_base/query.js
+++ b/_base/query.js
@@ -593,7 +593,7 @@ dojo.require("dojo._base.NodeList");
if(attr == "style"){
return elem.style.cssText || blank;
}
- return elem.getAttribute(attr, 2) || blank;
+ return (caseSensitive ? elem.getAttribute(attr) : elem.getAttribute(attr, 2)) || blank;
}
var attrs = {
@@ -767,7 +767,7 @@ dojo.require("dojo._base.NodeList");
var defaultGetter = (d.isIE) ? function(cond){
var clc = cond.toLowerCase();
return function(elem){
- return elem[cond]||elem[clc];
+ return (caseSensitive ? elem.getAttribute(cond) : elem[cond]||elem[clc]);
}
} : function(cond){
return function(elem){
diff --git a/tests/_base/query.html b/tests/_base/query.html
index 5e1c940..814ae40 100644
--- a/tests/_base/query.html
+++ b/tests/_base/query.html
@@ -157,28 +157,38 @@
doh.is(foo, dojo.query(foo));
},
function xml(){
- try{
- var doc = dojox.data.dom.createDocument([
- "<ResultSet>",
- "<Result>One</Result>",
- "<RESULT>Two</RESULT>",
- "<result>Three</result>",
- "<result>Four</result>",
- "</ResultSet>"
- ].join("")
- );
- var de = doc.documentElement;
- console.debug(dojox.data.dom.innerXML(de));
+ var doc = dojox.data.dom.createDocument([
+ "<ResultSet>",
+ "<Result>One</Result>",
+ "<RESULT>Two</RESULT>",
+ "<result>Three</result>",
+ "<result>Four</result>",
+ "</ResultSet>"
+ ].join("")
+ );
+ var de = doc.documentElement;
+ console.debug(dojox.data.dom.innerXML(de));
- doh.is(2, dojo.query("result", de).length);
- doh.is(1, dojo.query("Result", de).length);
- doh.is(1, dojo.query("RESULT", de).length);
- doh.is(0, dojo.query("resulT", de).length);
- doh.is(0, dojo.query("rEsulT", de).length);
- }catch(e){
- console.debug(e);
- // debugger;
- }
+ doh.is(2, dojo.query("result", de).length, "all lower");
+ doh.is(1, dojo.query("Result", de).length, "mixed case");
+ doh.is(1, dojo.query("RESULT", de).length, "all upper");
+ doh.is(0, dojo.query("resulT", de).length, "no match");
+ doh.is(0, dojo.query("rEsulT", de).length, "no match");
+ },
+ function xml_attrs(){
+ var doc = dojox.data.dom.createDocument([
+ "<ResultSet>",
+ "<RESULT thinger='blah'>Two</RESULT>",
+ "<RESULT thinger='gadzooks'>Two</RESULT>",
+ "</ResultSet>"
+ ].join(""));
+ var de = doc.documentElement;
+ console.debug(dojox.data.dom.innerXML(de));
+
+ doh.is(2, dojo.query("RESULT", de).length, "result elements");
+ doh.is(0, dojo.query("RESULT[THINGER]", de).length, "result elements with attrs (wrong)");
+ doh.is(2, dojo.query("RESULT[thinger]", de).length, "result elements with attrs");
+ doh.is(1, dojo.query("RESULT[thinger=blah]", de).length, "result elements with attr value");
}
]
);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list