summaryrefslogtreecommitdiff
path: root/lib/dojo/_base/query-sizzle.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dojo/_base/query-sizzle.js')
-rw-r--r--lib/dojo/_base/query-sizzle.js32
1 files changed, 20 insertions, 12 deletions
diff --git a/lib/dojo/_base/query-sizzle.js b/lib/dojo/_base/query-sizzle.js
index 5d160ec55..aad4e824d 100644
--- a/lib/dojo/_base/query-sizzle.js
+++ b/lib/dojo/_base/query-sizzle.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -20,11 +20,7 @@ dojo._hasResource["dojo._base.query"] = true;
* Finally, dojo.provide/require added.
*/
-//This file gets copied to dojo/_base/query.js, so set the provide accordingly.
-if(typeof dojo != "undefined"){
- dojo.provide("dojo._base.query");
- dojo.require("dojo._base.NodeList");
-
+var startDojoMappings= function(dojo) {
//Start Dojo mappings.
dojo.query = function(/*String*/ query, /*String|DOMNode?*/ root, /*Function?*/listCtor){
listCtor = listCtor || dojo.NodeList;
@@ -45,16 +41,16 @@ if(typeof dojo != "undefined"){
}
return dojo.Sizzle(query, root, new listCtor());
- }
+ };
dojo._filterQueryResult = function(nodeList, simpleFilter){
return dojo.Sizzle.filter(simpleFilter, nodeList);
- }
-}
+ };
+};
//Main Sizzle code follows...
//ns argument, added for dojo, used at the end of the file.
-;(function(ns){
+var defineSizzle= function(ns){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
done = 0,
@@ -862,8 +858,20 @@ var contains = document.compareDocumentPosition ? function(a, b){
// EXPOSE
-(ns || window).Sizzle = Sizzle;
+ns.Sizzle = Sizzle;
-})(typeof dojo == "undefined" ? null : dojo);
+};
+
+if (this["dojo"]) {
+ var defined= 0;
+ if (!defined) {
+ // must be in a built version that stripped out the define above
+ dojo.provide("dojo._base.query");
+ dojo.require("dojo._base.NodeList");
+ defineSizzle(dojo);
+ } // else must be in a source version (or a build that likes define)
+} else {
+ defineSizzle(window);
+}
}