Skip to content

Commit

Permalink
Use per element determination of children vs childNodes, fixes #12488…
Browse files Browse the repository at this point in the history
… !strict

git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@25510 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
kriszyp committed Jun 14, 2011
1 parent 19f0e28 commit fc262d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 2 additions & 7 deletions selector/acme.js
Expand Up @@ -62,11 +62,6 @@ define(["../_base/kernel", "../has", "../_base/sniff", "../_base/array", "../_ba
////////////////////////////////////////////////////////////////////////


// 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
Expand Down Expand Up @@ -512,7 +507,7 @@ define(["../_base/kernel", "../has", "../_base/sniff", "../_base/array", "../_ba
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);

Expand Down Expand Up @@ -791,7 +786,7 @@ define(["../_base/kernel", "../has", "../_base/sniff", "../_base/array", "../_ba
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) &&
Expand Down
5 changes: 3 additions & 2 deletions tests/_base/query.html
Expand Up @@ -318,8 +318,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;
Expand All @@ -328,6 +328,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");
Expand Down

1 comment on commit fc262d0

@ZachMoreno
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Dojo v1.6.1 these changes reside within dojo/dojo.js.uncompressed.js on lines :8609 & :8891. I applied this patch to that file, minified the patched file, then renamed the original dojo/dojo.js to dojo.unpatched.js & uploaded the new patched file as dojo.js & the issue was resolved.

Thank You Kindly!

Please sign in to comment.