Skip to content

Commit

Permalink
don't fail when requirejs parses the file at build time
Browse files Browse the repository at this point in the history
(cherry picked from commit 3542d23)
  • Loading branch information
jsr6720 authored and dylans committed May 13, 2016
1 parent 242f3b8 commit a993d5b
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions selector/_loader.js
Expand Up @@ -2,24 +2,36 @@ define(["../has", "require"],
function(has, require){

"use strict";
var testDiv = document.createElement("div");
has.add("dom-qsa2.1", !!testDiv.querySelectorAll);
has.add("dom-qsa3", function(){
// test to see if we have a reasonable native selector engine available
try{
testDiv.innerHTML = "<p class='TEST'></p>"; // test kind of from sizzle
// Safari can't handle uppercase or unicode characters when
// in quirks mode, IE8 can't handle pseudos like :empty
return testDiv.querySelectorAll(".TEST:empty").length == 1;
}catch(e){}
});
if (typeof document !== "undefined") {
var testDiv = document.createElement("div");
has.add("dom-qsa2.1", !!testDiv.querySelectorAll);
has.add("dom-qsa3", function(){
// test to see if we have a reasonable native selector engine available
try{
testDiv.innerHTML = "<p class='TEST'></p>"; // test kind of from sizzle
// Safari can't handle uppercase or unicode characters when
// in quirks mode, IE8 can't handle pseudos like :empty
return testDiv.querySelectorAll(".TEST:empty").length == 1;
}catch(e){}
});
}

var fullEngine;
var acme = "./acme", lite = "./lite";
return {
// summary:
// This module handles loading the appropriate selector engine for the given browser

load: function(id, parentRequire, loaded, config){
if (config.isBuild) {
//Indicate that the optimizer should not wait
//for this resource any more and complete optimization.
//This resource will be resolved dynamically during
//run time in the web browser.
loaded();
return;
}

var req = require;
// here we implement the default logic for choosing a selector engine
id = id == "default" ? has("config-selectorEngine") || "css3" : id;
Expand Down

0 comments on commit a993d5b

Please sign in to comment.