I want to compile jQuery 2.0.0
using the Google Closure Compiler. When I do it using the this extern which states Externs for jQuery 1.9 - 1.11 & 2.0 - 2.1
I get the following error: Uncaught TypeError: Cannot read property 'source' of undefined
. That flags up the following piece of compiled code:
d.each(d.i.match.ja.source.match(/\w+/g), function(a, b) {
var c = ra[b] || d.find.attr;
ra[b] = function(a, b, d) {
var h, k;
d || (k = ra[b],
ra[b] = h,
h = null != c(a, b, d) ? b.toLowerCase() : null,
ra[b] =
k);
return h
}
});
That code corresponds to here in the non-compiled code:
jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
var getter = jQuery.expr.attrHandle[name] || jQuery.find.attr;
jQuery.expr.attrHandle[name] = getSetInput && getSetAttribute || !ruseDefault.test(name) ?
function(elem, name, isXML) {
var fn = jQuery.expr.attrHandle[name],
ret = isXML ?
undefined :
/* jshint eqeqeq: false */
(jQuery.expr.attrHandle[name] = undefined) !=
getter(elem, name, isXML) ?
name.toLowerCase() :
null;
jQuery.expr.attrHandle[name] = fn;
return ret;
} :
function(elem, name, isXML) {
return isXML ?
undefined :
elem[jQuery.camelCase("default-" + name)] ?
name.toLowerCase() :
null;
};
});
Below is what I'm entering into the online closure compiler:
// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name default.js
// @code_url https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.js
// @externs_url https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/jquery-1.9.js
// ==/ClosureCompiler==
// ADD YOUR CODE HERE
$("#foo").html("Example Text");
I was wondering if anyone knew how to fix the extern so that it will work with later versions of jQuery or if there was an extern available anywhere for later versions?