/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/yui/build/get/get.js

  • Committer: Martin Albisetti
  • Date: 2008-12-30 19:20:39 UTC
  • Revision ID: argentina@gmail.com-20081230192039-kc2spvli08fo09sx
Upgrade YUI3 to PR2

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.net/yui/license.txt
5
 
version: 3.0.0pr1
 
5
version: 3.0.0pr2
6
6
*/
7
7
 
8
8
YUI.add("get", function(Y) {
119
119
            }, win);
120
120
    };
121
121
 
122
 
    /*
123
 
     * The request failed, execute fail handler with whatever
124
 
     * was accomplished.  There isn't a failure case at the
125
 
     * moment unless you count aborted transactions
126
 
     * @method _fail
127
 
     * @param id {string} the id of the request
128
 
     * @private
129
 
     */
130
 
    var _fail = function(id, msg) {
131
 
 
132
 
 
133
 
        var q = queues[id];
134
 
        if (q.timer) {
135
 
            q.timer.cancel();
136
 
        }
137
 
 
138
 
        // execute failure callback
139
 
        if (q.onFailure) {
140
 
            var sc=q.context || q;
141
 
            q.onFailure.call(sc, _returnData(q, msg));
142
 
        }
143
 
    };
144
 
 
145
 
    var _get = function(nId, tId) {
146
 
        var q = queues[tId],
147
 
            n = (L.isString(nId)) ? q.win.document.getElementById(nId) : nId;
148
 
        if (!n) {
149
 
            _fail(tId, "target node not found: " + nId);
150
 
        }
151
 
 
152
 
        return n;
153
 
    };
154
 
 
155
122
    /**
156
123
     * Removes the nodes for the specified queue
157
124
     * @method _purge
195
162
            };
196
163
    };
197
164
 
 
165
    /*
 
166
     * The request failed, execute fail handler with whatever
 
167
     * was accomplished.  There isn't a failure case at the
 
168
     * moment unless you count aborted transactions
 
169
     * @method _fail
 
170
     * @param id {string} the id of the request
 
171
     * @private
 
172
     */
 
173
    var _fail = function(id, msg) {
 
174
 
 
175
 
 
176
        var q = queues[id];
 
177
        if (q.timer) {
 
178
            q.timer.cancel();
 
179
        }
 
180
 
 
181
        // execute failure callback
 
182
        if (q.onFailure) {
 
183
            var sc=q.context || q;
 
184
            q.onFailure.call(sc, _returnData(q, msg));
 
185
        }
 
186
    };
 
187
 
 
188
    var _get = function(nId, tId) {
 
189
        var q = queues[tId],
 
190
            n = (L.isString(nId)) ? q.win.document.getElementById(nId) : nId;
 
191
        if (!n) {
 
192
            _fail(tId, "target node not found: " + nId);
 
193
        }
 
194
 
 
195
        return n;
 
196
    };
 
197
 
198
198
 
199
199
    /**
200
200
     * The request is complete, so executing the requester's callback
279
279
 
280
280
        var url = q.url[0];
281
281
 
 
282
        // if the url is undefined, this is probably a trailing comma problem in IE
 
283
        if (!url) {
 
284
            q.url.shift(); 
 
285
            return _next(id);
 
286
        }
 
287
 
 
288
 
282
289
        if (q.timeout) {
283
290
            q.timer = L.later(q.timeout, q, _timeout, id);
284
291
        }
400
407
 
401
408
        // IE supports the readystatechange event for script and css nodes
402
409
        // Opera only for script nodes.  Opera support onload for script
403
 
        // nodes, but this doesn't fire when their is a load failure.
 
410
        // nodes, but this doesn't fire when there is a load failure.
404
411
        // The onreadystatechange appears to be a better way to respond
405
412
        // to both success and failure.
406
413
        if (ua.ie) {
407
414
            n.onreadystatechange = function() {
408
415
                var rs = this.readyState;
409
416
                if ("loaded" === rs || "complete" === rs) {
 
417
                    n.onreadystatechange = null;
410
418
                    f(id, url);
411
419
                }
412
420
            };
642
650
    };
643
651
}();
644
652
 
645
 
}, "3.0.0pr1");
 
653
}, "3.0.0pr2");