Merge lp:~bjornt/lazr-js/prefetch-yui-3.5 into lp:~bjornt/lazr-js/trunk

Proposed by Björn Tillenius
Status: Superseded
Proposed branch: lp:~bjornt/lazr-js/prefetch-yui-3.5
Merge into: lp:~bjornt/lazr-js/trunk
Diff against target: 23 lines (+4/-2)
1 file modified
src-js/lazrjs/loader/prefetch.js (+4/-2)
To merge this branch: bzr merge lp:~bjornt/lazr-js/prefetch-yui-3.5
Reviewer Review Type Date Requested Status
Björn Tillenius Pending
Review via email: mp+102346@code.launchpad.net

Description of the change

Don't reference the script function directly, so that it can access the
YUI object as 'this'.

In YUI 3.5 the script function is changed, so that it calls
this._load(). If we assign the script function to a variable, this won't
get bound to the YUI object.

This change is backward-compatible, so this code works with older
versions of YUI as well.

To post a comment you must log in.

Unmerged revisions

215. By Björn Tillenius

Don't reference the script function directly, so that it can access the YUI object as 'this'.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src-js/lazrjs/loader/prefetch.js'
2--- src-js/lazrjs/loader/prefetch.js 2010-09-27 14:09:13 +0000
3+++ src-js/lazrjs/loader/prefetch.js 2012-04-17 16:24:19 +0000
4@@ -14,7 +14,9 @@
5 pending = arguments.length;
6
7 var YArray_each = Y.Array.each,
8- YGet_script = Y.Get.script;
9+ // Don't reference the script function directly, so that it can access
10+ // the YUI object as 'this'.
11+ YGet = Y.Get;
12
13 /**
14 * Wrap the native 'use' function to add some smarts around
15@@ -57,7 +59,7 @@
16 * deferred calls to use with the native 'use' function.
17 */
18 YArray_each(preload, function(value) {
19- YGet_script(value, {onEnd: function() {
20+ YGet.script(value, {onEnd: function() {
21 /**
22 * Once an item has finished preloading, we decrement
23 * the pending variable. Once it reaches zero, we

Subscribers

People subscribed via source and target branches

to all changes: