]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/selector/_loader.js.uncompressed.js
1 define("dojo/selector/_loader", ["../has", "require"],
2 function(has
, require
){
4 // This module handles loading the appropriate selector engine for the given browser
6 var testDiv
= document
.createElement("div");
7 has
.add("dom-qsa2.1", !!testDiv
.querySelectorAll
);
8 has
.add("dom-qsa3", function(){
9 // test to see if we have a reasonable native selector engine available
11 testDiv
.innerHTML
= "<p class='TEST'></p>"; // test kind of from sizzle
12 // Safari can't handle uppercase or unicode characters when
13 // in quirks mode, IE8 can't handle pseudos like :empty
14 return testDiv
.querySelectorAll(".TEST:empty").length
== 1;
18 var acme
= "./acme", lite
= "./lite";
20 load: function(id
, parentRequire
, loaded
, config
){
22 // here we implement the default logic for choosing a selector engine
23 id
= id
== "default" ? has("config-selectorEngine") || "css3" : id
;
24 id
= id
== "css2" || id
== "lite" ? lite
:
25 id
== "css2.1" ? has("dom-qsa2.1") ? lite
: acme
:
26 id
== "css3" ? has("dom-qsa3") ? lite
: acme
:
27 id
== "acme" ? acme
: (req
= parentRequire
) && id
;
28 if(id
.charAt(id
.length
-1) == '?'){
29 id
= id
.substring(0,id
.length
- 1);
30 var optionalLoad
= true;
32 // the query engine is optional, only load it if a native one is not available or existing one has not been loaded
33 if(optionalLoad
&& (has("dom-compliant-qsa") || fullEngine
)){
34 return loaded(fullEngine
);
36 // load the referenced selector engine
37 req([id
], function(engine
){