~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/imageloader/imageloader.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('imageloader', function(Y) {
8
 
 
9
 
/**
10
 
 * The ImageLoader Utility is a framework to dynamically load images according to certain triggers,
11
 
 * enabling faster load times and a more responsive UI.
12
 
 *
13
 
 * @module imageloader
14
 
 */
15
 
 
16
 
 
17
 
        /**
18
 
         * A group for images. A group can have one time limit and a series of triggers. Thus the images belonging to this group must share these constraints.
19
 
         * @class ImgLoadGroup
20
 
         * @extends Base
21
 
         * @constructor
22
 
         */
23
 
        Y.ImgLoadGroup = function() {
24
 
                // call init first, because it sets up local vars for storing attribute-related info
25
 
                this._init();
26
 
                Y.ImgLoadGroup.superclass.constructor.apply(this, arguments);
27
 
        };
28
 
 
29
 
        Y.ImgLoadGroup.NAME = 'imgLoadGroup';
30
 
 
31
 
        Y.ImgLoadGroup.ATTRS = {
32
 
                
33
 
                /**
34
 
                 * Name for the group. Only used to identify the group in logging statements.
35
 
                 * @attribute name
36
 
                 * @type String
37
 
                 */
38
 
                name: {
39
 
                        value: ''
40
 
                },
41
 
 
42
 
                /**
43
 
                 * Time limit, in seconds, after which images are fetched regardless of trigger events.
44
 
                 * @attribute timeLimit
45
 
                 * @type Number
46
 
                 */
47
 
                timeLimit: {
48
 
                        value: null
49
 
                },
50
 
 
51
 
                /**
52
 
                 * Distance below the fold for which images are loaded. Images are not loaded until they are at most this distance away from (or above) the fold.
53
 
                 * This check is performed at page load (domready) and after any window scroll or window resize event (until all images are loaded).
54
 
                 * @attribute foldDistance
55
 
                 * @type Number
56
 
                 */
57
 
                foldDistance: {
58
 
                        validator: Y.Lang.isNumber,
59
 
                        setter: function(val) { this._setFoldTriggers(); return val; },
60
 
                        lazyAdd: false
61
 
                },
62
 
 
63
 
                /**
64
 
                 * Class name that will identify images belonging to the group. This class name will be removed from each element in order to fetch images.
65
 
                 * This class should have, in its CSS style definition, "<code>background:none !important;</code>".
66
 
                 * @attribute className
67
 
                 * @type String
68
 
                 */
69
 
                className: {
70
 
                        value: null,
71
 
                        setter: function(name) { this._className = name; return name; },
72
 
                        lazyAdd: false
73
 
                }, 
74
 
        
75
 
        /**
76
 
         * Determines how to act when className is used as the way to delay load images. The "default" action is to just
77
 
         * remove the class name. The "enhanced" action is to remove the class name and also set the src attribute if
78
 
         * the element is an img.
79
 
         * @attribute classNameAction
80
 
         * @type String
81
 
         */
82
 
        classNameAction: {
83
 
            value: "default"
84
 
        }
85
 
 
86
 
        };
87
 
 
88
 
        var groupProto = {
89
 
 
90
 
                /**
91
 
                 * Initialize all private members needed for the group.
92
 
                 * @method _init
93
 
                 * @private
94
 
                 */
95
 
                _init: function() {
96
 
 
97
 
                        /**
98
 
                         * Collection of triggers for this group.
99
 
                         * Keeps track of each trigger's event handle, as returned from <code>Y.on</code>.
100
 
                         * @property _triggers
101
 
                         * @private
102
 
                         * @type Array
103
 
                         */
104
 
                        this._triggers = [];
105
 
 
106
 
                        /**
107
 
                         * Collection of images (<code>Y.ImgLoadImgObj</code> objects) registered with this group, keyed by DOM id.
108
 
                         * @property _imgObjs
109
 
                         * @private
110
 
                         * @type Object
111
 
                         */
112
 
                        this._imgObjs = {};
113
 
 
114
 
                        /**
115
 
                         * Timeout object to keep a handle on the time limit.
116
 
                         * @property _timeout
117
 
                         * @private
118
 
                         * @type Object
119
 
                         */
120
 
                        this._timeout = null;
121
 
 
122
 
                        /**
123
 
                         * DOM elements having the class name that is associated with this group.
124
 
                         * Elements are stored during the <code>_foldCheck</code> function and reused later during any subsequent <code>_foldCheck</code> calls - gives a slight performance improvement when the page fold is repeatedly checked.
125
 
                         * @property _classImageEls
126
 
                         * @private
127
 
                         * @type Array
128
 
                         */
129
 
                        this._classImageEls = null;
130
 
 
131
 
                        /**
132
 
                         * Keep the CSS class name in a member variable for ease and speed.
133
 
                         * @property _className
134
 
                         * @private
135
 
                         * @type String
136
 
                         */
137
 
                        this._className = null;
138
 
 
139
 
                        /**
140
 
                         * Boolean tracking whether the window scroll and window resize triggers have been set if this is a fold group.
141
 
                         * @property _areFoldTriggersSet
142
 
                         * @private
143
 
                         * @type Boolean
144
 
                         */
145
 
                        this._areFoldTriggersSet = false;
146
 
 
147
 
                        /**
148
 
                         * The maximum pixel height of the document that has been made visible.
149
 
                         * During fold checks, if the user scrolls up then there's no need to check for newly exposed images.
150
 
                         * @property _maxKnownHLimit
151
 
                         * @private
152
 
                         * @type Int
153
 
                         */
154
 
                        this._maxKnownHLimit = 0;
155
 
 
156
 
                        // add a listener to domready that will start the time limit
157
 
                        Y.on('domready', this._onloadTasks, this);
158
 
                },
159
 
 
160
 
                /**
161
 
                 * Adds a trigger to the group. Arguments are passed to <code>Y.on</code>.
162
 
                 * @method addTrigger
163
 
                 * @chainable
164
 
                 * @param {Object} obj  The DOM object to attach the trigger event to
165
 
                 * @param {String} type  The event type
166
 
                 */
167
 
                addTrigger: function(obj, type) {
168
 
                        if (! obj || ! type) {
169
 
                                return this;
170
 
                        }
171
 
 
172
 
 
173
 
                        /* Need to wrap the fetch function. Event Util can't distinguish prototyped functions of different instantiations.
174
 
                         *   Leads to this scenario: groupA and groupZ both have window-scroll triggers. groupZ also has a 2-sec timeout (groupA has no timeout).
175
 
                         *   groupZ's timeout fires; we remove the triggers. The detach call finds the first window-scroll event with Y.ILG.p.fetch, which is groupA's. 
176
 
                         *   groupA's trigger is removed and never fires, leaving images unfetched.
177
 
                         */
178
 
                        var wrappedFetch = function() {
179
 
                                this.fetch();
180
 
                        };
181
 
                        this._triggers.push( Y.on(type, wrappedFetch, obj, this) );
182
 
 
183
 
                        return this;
184
 
                },
185
 
 
186
 
                /**
187
 
                 * Adds a custom event trigger to the group.
188
 
                 * @method addCustomTrigger
189
 
                 * @chainable
190
 
                 * @param {String} name  The name of the event
191
 
                 * @param {Object} obj  The object on which to attach the event. <code>obj</code> is optional - by default the event is attached to the <code>Y</code> instance
192
 
                 */
193
 
                addCustomTrigger: function(name, obj) {
194
 
                        if (! name) {
195
 
                                return this;
196
 
                        }
197
 
 
198
 
 
199
 
                        // see comment in addTrigger()
200
 
                        var wrappedFetch = function() {
201
 
                                this.fetch();
202
 
                        };
203
 
                        if (Y.Lang.isUndefined(obj)) {
204
 
                                this._triggers.push( Y.on(name, wrappedFetch, this) );
205
 
                        }
206
 
                        else {
207
 
                                this._triggers.push( obj.on(name, wrappedFetch, this) );
208
 
                        }
209
 
 
210
 
                        return this;
211
 
                },
212
 
 
213
 
                /**
214
 
                 * Sets the window scroll and window resize triggers for any group that is fold-conditional (i.e., has a fold distance set).
215
 
                 * @method _setFoldTriggers
216
 
                 * @private
217
 
                 */
218
 
                _setFoldTriggers: function() {
219
 
                        if (this._areFoldTriggersSet) {
220
 
                                return;
221
 
                        }
222
 
 
223
 
 
224
 
                        var wrappedFoldCheck = function() {
225
 
                                this._foldCheck();
226
 
                        };
227
 
                        this._triggers.push( Y.on('scroll', wrappedFoldCheck, window, this) );
228
 
                        this._triggers.push( Y.on('resize', wrappedFoldCheck, window, this) );
229
 
                        this._areFoldTriggersSet = true;
230
 
                },
231
 
 
232
 
                /**
233
 
                 * Performs necessary setup at domready time.
234
 
                 * Initiates time limit for group; executes the fold check for the images.
235
 
                 * @method _onloadTasks
236
 
                 * @private
237
 
                 */
238
 
                _onloadTasks: function() {
239
 
                        var timeLim = this.get('timeLimit');
240
 
                        if (timeLim && timeLim > 0) {
241
 
                                this._timeout = setTimeout(this._getFetchTimeout(), timeLim * 1000);
242
 
                        }
243
 
 
244
 
                        if (! Y.Lang.isUndefined(this.get('foldDistance'))) {
245
 
                                this._foldCheck();
246
 
                        }
247
 
                },
248
 
 
249
 
                /**
250
 
                 * Returns the group's <code>fetch</code> method, with the proper closure, for use with <code>setTimeout</code>.
251
 
                 * @method _getFetchTimeout
252
 
                 * @return {Function}  group's <code>fetch</code> method
253
 
                 * @private
254
 
                 */
255
 
                _getFetchTimeout: function() {
256
 
                        var self = this;
257
 
                        return function() { self.fetch(); };
258
 
                },
259
 
 
260
 
                /**
261
 
                 * Registers an image with the group.
262
 
                 * Arguments are passed through to a <code>Y.ImgLoadImgObj</code> constructor; see that class' attribute documentation for detailed information. "<code>domId</code>" is a required attribute.
263
 
                 * @method registerImage
264
 
                 * @param {Object} *  A configuration object literal with attribute name/value pairs  (passed through to a <code>Y.ImgLoadImgObj</code> constructor)
265
 
                 * @return {Object}  <code>Y.ImgLoadImgObj</code> that was registered
266
 
                 */
267
 
                registerImage: function() {
268
 
                        var domId = arguments[0].domId;
269
 
                        if (! domId) {
270
 
                                return null;
271
 
                        }
272
 
 
273
 
 
274
 
                        this._imgObjs[domId] = new Y.ImgLoadImgObj(arguments[0]);
275
 
                        return this._imgObjs[domId];
276
 
                },
277
 
 
278
 
                /**
279
 
                 * Displays the images in the group.
280
 
                 * This method is called when a trigger fires or the time limit expires; it shouldn't be called externally, but is not private in the rare event that it needs to be called immediately.
281
 
                 * @method fetch
282
 
                 */
283
 
                fetch: function() {
284
 
 
285
 
                        // done with the triggers
286
 
                        this._clearTriggers();
287
 
 
288
 
                        // fetch whatever we need to by className
289
 
                        this._fetchByClass();
290
 
 
291
 
                        // fetch registered images
292
 
                        for (var id in this._imgObjs) {
293
 
                                if (this._imgObjs.hasOwnProperty(id)) {
294
 
                                        this._imgObjs[id].fetch();
295
 
                                }
296
 
                        }
297
 
                },
298
 
 
299
 
                /**
300
 
                 * Clears the timeout and all triggers associated with the group.
301
 
                 * @method _clearTriggers
302
 
                 * @private
303
 
                 */
304
 
                _clearTriggers: function() {
305
 
                        clearTimeout(this._timeout);
306
 
                        // detach all listeners
307
 
                        for (var i=0, len = this._triggers.length; i < len; i++) {
308
 
                                this._triggers[i].detach();
309
 
                        }
310
 
                },
311
 
 
312
 
                /**
313
 
                 * Checks the position of each image in the group. If any part of the image is within the specified distance (<code>foldDistance</code>) of the client viewport, the image is fetched immediately.
314
 
                 * @method _foldCheck
315
 
                 * @private
316
 
                 */
317
 
                _foldCheck: function() {
318
 
 
319
 
                        var allFetched = true,
320
 
                            viewReg = Y.DOM.viewportRegion(),
321
 
                            hLimit = viewReg.bottom + this.get('foldDistance'),
322
 
                                        id, imgFetched, els, i, len;
323
 
 
324
 
                        // unless we've uncovered new frontiers, there's no need to continue
325
 
                        if (hLimit <= this._maxKnownHLimit) {
326
 
                                return;
327
 
                        }
328
 
                        this._maxKnownHLimit = hLimit;
329
 
 
330
 
                        for (id in this._imgObjs) {
331
 
                                if (this._imgObjs.hasOwnProperty(id)) {
332
 
                                        imgFetched = this._imgObjs[id].fetch(hLimit);
333
 
                                        allFetched = allFetched && imgFetched;
334
 
                                }
335
 
                        }
336
 
 
337
 
                        // and by class
338
 
                        if (this._className) {
339
 
                                if (this._classImageEls === null) {
340
 
                                        // get all the relevant elements and store them
341
 
                                        this._classImageEls = [];
342
 
                                        els = Y.all('.' + this._className);
343
 
                                        els.each( function(node) { this._classImageEls.push( { el: node, y: node.getY(), fetched: false } ); }, this);
344
 
                                }
345
 
                                els = this._classImageEls;
346
 
                                for (i=0, len = els.length; i < len; i++) {
347
 
                                        if (els[i].fetched) {
348
 
                                                continue;
349
 
                                        }
350
 
                                        if (els[i].y && els[i].y <= hLimit) {
351
 
                                                //els[i].el.removeClass(this._className);
352
 
                                                this._updateNodeClassName(els[i].el);
353
 
                        els[i].fetched = true;
354
 
                                        }
355
 
                                        else {
356
 
                                                allFetched = false;
357
 
                                        }
358
 
                                }
359
 
                        }
360
 
                        
361
 
                        // if allFetched, remove listeners
362
 
                        if (allFetched) {
363
 
                                this._clearTriggers();
364
 
                        }
365
 
                },
366
 
        
367
 
        /**
368
 
         * Updates a given node, removing the ImageLoader class name. If the
369
 
         * node is an img and the classNameAction is "enhanced", then node
370
 
         * class name is removed and also the src attribute is set to the 
371
 
         * image URL as well as clearing the style background image.
372
 
         * @method _updateNodeClassName
373
 
         * @param node {Node} The node to act on.
374
 
         * @private
375
 
         */
376
 
        _updateNodeClassName: function(node){
377
 
            var url;
378
 
            
379
 
            if (this.get("classNameAction") == "enhanced"){
380
 
                
381
 
                if (node.get("tagName").toLowerCase() == "img"){
382
 
                    url = node.getStyle("backgroundImage");
383
 
                    /url\(["']?(.*?)["']?\)/.test(url);
384
 
                    url = RegExp.$1;
385
 
                    node.set("src", url);
386
 
                    node.setStyle("backgroundImage", "");
387
 
                }
388
 
            }
389
 
            
390
 
            node.removeClass(this._className);        
391
 
        },
392
 
 
393
 
                /**
394
 
                 * Finds all elements in the DOM with the class name specified in the group. Removes the class from the element in order to let the style definitions trigger the image fetching.
395
 
                 * @method _fetchByClass
396
 
                 * @private
397
 
                 */
398
 
                _fetchByClass: function() {
399
 
                        if (! this._className) {
400
 
                                return;
401
 
                        }
402
 
 
403
 
 
404
 
                        Y.all('.' + this._className).each(Y.bind(this._updateNodeClassName, this));
405
 
                }
406
 
 
407
 
        };
408
 
 
409
 
 
410
 
        Y.extend(Y.ImgLoadGroup, Y.Base, groupProto);
411
 
 
412
 
 
413
 
        //------------------------------------------------
414
 
 
415
 
 
416
 
        /**
417
 
         * Image objects to be registered with the groups
418
 
         * @class ImgLoadImgObj
419
 
         * @extends Base
420
 
         * @constructor
421
 
         */
422
 
        Y.ImgLoadImgObj = function() {
423
 
                Y.ImgLoadImgObj.superclass.constructor.apply(this, arguments);
424
 
                this._init();
425
 
        };
426
 
                
427
 
        Y.ImgLoadImgObj.NAME = 'imgLoadImgObj';
428
 
 
429
 
        Y.ImgLoadImgObj.ATTRS = {
430
 
                /**
431
 
                 * HTML DOM id of the image element.
432
 
                 * @attribute domId
433
 
                 * @type String
434
 
                 */
435
 
                domId: {
436
 
                        value: null,
437
 
                        writeOnce: true
438
 
                },
439
 
 
440
 
                /**
441
 
                 * Background URL for the image.
442
 
                 * For an image whose URL is specified by "<code>background-image</code>" in the element's style.
443
 
                 * @attribute bgUrl
444
 
                 * @type String
445
 
                 */
446
 
                bgUrl: {
447
 
                        value: null
448
 
                },
449
 
 
450
 
                /**
451
 
                 * Source URL for the image.
452
 
                 * For an image whose URL is specified by a "<code>src</code>" attribute in the DOM element.
453
 
                 * @attribute srcUrl
454
 
                 * @type String
455
 
                 */
456
 
                srcUrl: {
457
 
                        value: null
458
 
                },
459
 
 
460
 
                /**
461
 
                 * Pixel width of the image. Will be set as a <code>width</code> attribute on the DOM element after the image is fetched.
462
 
                 * Defaults to the natural width of the image (no <code>width</code> attribute will be set).
463
 
                 * Usually only used with src images.
464
 
                 * @attribute width
465
 
                 * @type Int
466
 
                 */
467
 
                width: {
468
 
                        value: null
469
 
                },
470
 
 
471
 
                /**
472
 
                 * Pixel height of the image. Will be set as a <code>height</code> attribute on the DOM element after the image is fetched.
473
 
                 * Defaults to the natural height of the image (no <code>height</code> attribute will be set).
474
 
                 * Usually only used with src images.
475
 
                 * @attribute height
476
 
                 * @type Int
477
 
                 */
478
 
                height: {
479
 
                        value: null
480
 
                },
481
 
 
482
 
                /**
483
 
                 * Whether the image's <code>style.visibility</code> should be set to <code>visible</code> after the image is fetched.
484
 
                 * Used when setting images as <code>visibility:hidden</code> prior to image fetching.
485
 
                 * @attribute setVisible
486
 
                 * @type Boolean
487
 
                 */
488
 
                setVisible: {
489
 
                        value: false
490
 
                },
491
 
 
492
 
                /**
493
 
                 * Whether the image is a PNG.
494
 
                 * PNG images get special treatment in that the URL is specified through AlphaImageLoader for IE, versions 6 and earlier.
495
 
                 * Only used with background images.
496
 
                 * @attribute isPng
497
 
                 * @type Boolean
498
 
                 */
499
 
                isPng: {
500
 
                        value: false
501
 
                },
502
 
 
503
 
                /**
504
 
                 * AlphaImageLoader <code>sizingMethod</code> property to be set for the image.
505
 
                 * Only set if <code>isPng</code> value for this image is set to <code>true</code>.
506
 
                 * Defaults to <code>scale</code>.
507
 
                 * @attribute sizingMethod
508
 
                 * @type String
509
 
                 */
510
 
                sizingMethod: {
511
 
                        value: 'scale'
512
 
                },
513
 
 
514
 
                /**
515
 
                 * AlphaImageLoader <code>enabled</code> property to be set for the image.
516
 
                 * Only set if <code>isPng</code> value for this image is set to <code>true</code>.
517
 
                 * Defaults to <code>true</code>.
518
 
                 * @attribute enabled
519
 
                 * @type String
520
 
                 */
521
 
                enabled: {
522
 
                        value: 'true'
523
 
                }
524
 
 
525
 
        };
526
 
 
527
 
        var imgProto = {
528
 
 
529
 
                /**
530
 
                 * Initialize all private members needed for the group.
531
 
                 * @method _init
532
 
                 * @private
533
 
                 */
534
 
                _init: function() {
535
 
 
536
 
                        /**
537
 
                         * Whether this image has already been fetched.
538
 
                         * In the case of fold-conditional groups, images won't be fetched twice.
539
 
                         * @property _fetched
540
 
                         * @private
541
 
                         * @type Boolean
542
 
                         */
543
 
                        this._fetched = false;
544
 
 
545
 
                        /**
546
 
                         * The Node object returned from <code>Y.one</code>, to avoid repeat calls to access the DOM.
547
 
                         * @property _imgEl
548
 
                         * @private
549
 
                         * @type Object
550
 
                         */
551
 
                        this._imgEl = null;
552
 
 
553
 
                        /**
554
 
                         * The vertical position returned from <code>getY</code>, to avoid repeat calls to access the DOM.
555
 
                         * The Y position is checked only for images registered with fold-conditional groups. The position is checked first at page load (domready)
556
 
                         *   and this caching enhancement assumes that the image's vertical position won't change after that first check.
557
 
                         * @property _yPos
558
 
                         * @private
559
 
                         * @type Int
560
 
                         */
561
 
                        this._yPos = null;
562
 
                },
563
 
 
564
 
                /**
565
 
                 * Displays the image; puts the URL into the DOM.
566
 
                 * This method shouldn't be called externally, but is not private in the rare event that it needs to be called immediately.
567
 
                 * @method fetch
568
 
                 * @param {Int} withinY  The pixel distance from the top of the page, for which if the image lies within, it will be fetched. Undefined indicates that no check should be made, and the image should always be fetched
569
 
                 * @return {Boolean}  Whether the image has been fetched (either during this execution or previously)
570
 
                 */
571
 
                fetch: function(withinY) {
572
 
                        if (this._fetched) {
573
 
                                return true;
574
 
                        }
575
 
 
576
 
                        var el = this._getImgEl(),
577
 
                            yPos;
578
 
                        if (! el) {
579
 
                                return false;
580
 
                        }
581
 
 
582
 
                        if (withinY) {
583
 
                                // need a distance check
584
 
                                yPos = this._getYPos();
585
 
                                if (! yPos || yPos > withinY) {
586
 
                                        return false;
587
 
                                }
588
 
                        }
589
 
 
590
 
 
591
 
                        // apply url
592
 
                        if (this.get('bgUrl') !== null) {
593
 
                                // bg url
594
 
                                if (this.get('isPng') && Y.UA.ie && Y.UA.ie <= 6) {
595
 
                                        // png for which to apply AlphaImageLoader
596
 
                                        el.setStyle('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.get('bgUrl') + '", sizingMethod="' + this.get('sizingMethod') + '", enabled="' + this.get('enabled') + '")');
597
 
                                }
598
 
                                else {
599
 
                                        // regular bg image
600
 
                                        el.setStyle('backgroundImage', "url('" + this.get('bgUrl') + "')");
601
 
                                }
602
 
                        }
603
 
                        else if (this.get('srcUrl') !== null) {
604
 
                                // regular src image
605
 
                                el.setAttribute('src', this.get('srcUrl'));
606
 
                        }
607
 
 
608
 
                        // apply attributes
609
 
                        if (this.get('setVisible')) {
610
 
                                el.setStyle('visibility', 'visible');
611
 
                        }
612
 
                        if (this.get('width')) {
613
 
                                el.setAttribute('width', this.get('width'));
614
 
                        }
615
 
                        if (this.get('height')) {
616
 
                                el.setAttribute('height', this.get('height'));
617
 
                        }
618
 
 
619
 
                        this._fetched = true;
620
 
 
621
 
                        return true;
622
 
                },
623
 
 
624
 
                /**
625
 
                 * Gets the object (as a <code>Y.Node</code>) of the DOM element indicated by "<code>domId</code>".
626
 
                 * @method _getImgEl
627
 
                 * @returns {Object} DOM element of the image as a <code>Y.Node</code> object
628
 
                 * @private
629
 
                 */
630
 
                _getImgEl: function() {
631
 
                        if (this._imgEl === null) {
632
 
                                this._imgEl = Y.one('#' + this.get('domId'));
633
 
                        }
634
 
                        return this._imgEl;
635
 
                },
636
 
 
637
 
                /**
638
 
                 * Gets the Y position of the node in page coordinates.
639
 
                 * Expects that the page-coordinate position of the image won't change.
640
 
                 * @method _getYPos
641
 
                 * @returns {Object} The Y position of the image
642
 
                 * @private
643
 
                 */
644
 
                _getYPos: function() {
645
 
                        if (this._yPos === null) {
646
 
                                this._yPos = this._getImgEl().getY();
647
 
                        }
648
 
                        return this._yPos;
649
 
                }
650
 
 
651
 
        };
652
 
 
653
 
 
654
 
        Y.extend(Y.ImgLoadImgObj, Y.Base, imgProto);
655
 
 
656
 
 
657
 
 
658
 
 
659
 
}, '3.4.1' ,{requires:['base-base', 'node-style', 'node-screen']});