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