[Pkg-javascript-commits] [dojo] 15/16: Use per element determination of children vs childNodes, fixes #12488 !strict
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 17:39:05 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.5.3
in repository dojo.
commit 4b50371538c09375caf6072b7956c7a5dfd06f6b
Author: Colin Snover <github.com at zetafleet.com>
Date: Thu Aug 22 00:11:11 2013 +0000
Use per element determination of children vs childNodes, fixes #12488 !strict
git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@25510 560b804f-0ae3-0310-86f3-f6aa0a117693
(cherry picked from commit fc262d0d589c490cdd671791f1546a4665ed69c6)
(cherry picked from commit c67ea3e7a6463c8d5479b0c88007cd2c0c86443c)
---
_base/query.js | 9 ++-------
tests/_base/query.html | 5 +++--
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/_base/query.js b/_base/query.js
index ca12c21..4aab470 100644
--- a/_base/query.js
+++ b/_base/query.js
@@ -142,11 +142,6 @@ if(typeof dojo != "undefined"){
////////////////////////////////////////////////////////////////////////
- // on browsers that support the "children" collection we can avoid a lot of
- // iteration on chaff (non-element) nodes.
- // why.
- var childNodesName = !!getDoc().firstChild["children"] ? "children" : "childNodes";
-
var specials = ">~+";
// global thunk to determine whether we should treat the current query as
@@ -591,7 +586,7 @@ if(typeof dojo != "undefined"){
var getNodeIndex = function(node){
var root = node.parentNode;
var i = 0,
- tret = root[childNodesName],
+ tret = root.children || root.childNodes,
ci = (node["_i"]||-1),
cl = (root["_l"]||-1);
@@ -872,7 +867,7 @@ if(typeof dojo != "undefined"){
filterFunc = filterFunc||yesman;
return function(root, ret, bag){
// get an array of child elements, skipping text and comment nodes
- var te, x = 0, tret = root[childNodesName];
+ var te, x = 0, tret = root.children || root.childNodes;
while(te = tret[x++]){
if(
_simpleNodeTest(te) &&
diff --git a/tests/_base/query.html b/tests/_base/query.html
index 55c3f3c..d0760ba 100644
--- a/tests/_base/query.html
+++ b/tests/_base/query.html
@@ -249,8 +249,8 @@
function xml_attrs(){
var doc = createDocument([
"<ResultSet>",
- "<RESULT thinger='blah'>Two</RESULT>",
- "<RESULT thinger='gadzooks'>Two</RESULT>",
+ "<RESULT thinger='blah'>ONE</RESULT>",
+ "<RESULT thinger='gadzooks'><CHILD>Two</CHILD></RESULT>",
"</ResultSet>"
].join(""));
var de = doc.documentElement;
@@ -259,6 +259,7 @@
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");
+ doh.is(1, dojo.query("RESULT > CHILD", de).length, "Using child operator");
},
function sort(){
var i = dojo.query("div");
--
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