Ensure reThis isn't used in Windows 8 apps.

This commit is contained in:
John-David Dalton
2013-09-19 08:53:19 -07:00
parent c2da0070f5
commit 7c6865f948
7 changed files with 131 additions and 93 deletions

21
dist/lodash.js vendored
View File

@@ -67,7 +67,7 @@
var reNoMatch = /($^)/;
/** Used to detect functions containing a `this` reference */
var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis;
var reThis = /\bthis\b/;
/** Used to match unescaped characters in compiled string literals */
var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
@@ -614,6 +614,15 @@
*/
support.fastBind = nativeBind && !isV8;
/**
* Detect if functions can be decompiled by `Function#toString`
* (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps).
*
* @memberOf _.support
* @type boolean
*/
support.funcDecomp = !reNative.test(context.WinRTError) && reThis.test(runInContext);
/**
* Detect if `Function#name` is supported (all but IE).
*
@@ -801,7 +810,7 @@
}
if (support.funcNames || !bindData) {
// checks if `func` references the `this` keyword and stores the result
bindData = !reThis || reThis.test(source);
bindData = !support.funcDecomp || reThis.test(source);
setBindData(func, bindData);
}
}
@@ -5709,8 +5718,8 @@
* // => 'hello mustache!'
*
* // using the `imports` option to import jQuery
* var list = '<% $.each(people, function(name) { %><li><%= name %></li><% }); %>';
* _.template(list, { 'people': ['moe', 'larry'] }, { 'imports': { '$': jQuery });
* var list = '<% $.each(people, function(name) { %><li><%- name %></li><% }); %>';
* _.template(list, { 'people': ['moe', 'larry'] }, { 'imports': { '$': jQuery } });
* // => '<li>moe</li><li>larry</li>'
*
* // using the `sourceURL` option to specify a custom sourceURL for the template
@@ -5828,7 +5837,7 @@
if (data) {
return result(data);
}
// provide the compiled function's source via its `toString` method, in
// provide the compiled function's source by its `toString` method, in
// supported environments, or the `source` property as a convenience for
// inlining compiled templates during the build process
result.source = source;
@@ -6265,7 +6274,7 @@
// Expose Lo-Dash to the global object even when an AMD loader is present in
// case Lo-Dash was injected by a third-party script and not intended to be
// loaded as a module. The global assignment can be reverted in the Lo-Dash
// module via its `noConflict()` method.
// module by its `noConflict()` method.
root._ = _;
// define as an anonymous module so, through path mapping, it can be