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

Proposed by Björn Tillenius
Status: Merged
Merged at revision: 215
Proposed branch: lp:~bjornt/lazr-js/prefetch-yui-3.5
Merge into: lp:lazr-js
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
Sidnei da Silva (community) Approve
Björn Tillenius (community) Abstain
LAZR Developers Pending
Review via email: mp+102350@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.
Revision history for this message
Björn Tillenius (bjornt) :
review: Abstain
Revision history for this message
Sidnei da Silva (sidnei) :
review: Approve

Preview Diff

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

Subscribers

People subscribed via source and target branches