get-debug.js revision a76f066cb8261ad9f7c6c4d81d8c3bed2f1a788a
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * Provides a mechanism to fetch remote resources and
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * insert them into a document.
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @module yui
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @submodule get
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * Fetches and inserts one or more script or link nodes into the document
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free // FireFox does not support the onload event for link nodes, so
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free // there is no way to make the css requests synchronous. This means
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free // that the css rules in multiple files could be applied out of order
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free // in this browser if a later request returns before an earlier one.
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free // Safari too.
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * hash of queues to manage multiple requests
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @property queues
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * queue index used to generate transaction ids
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @property qidx
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * interal property used to prevent multiple simultaneous purge
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @property purging
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @type boolean
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * Clear timeout state
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @method _clearTimeout
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @param {Object} q Queue data
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free _clearTimeout = function(q) {
2b0e2e6c2dde5d6cb739785016e91189888ff483tavmjong-free * Generates an HTML element, this is not appended to a document
f368abf12db070b46ce2128d63a014798994ed5ftavmjong-free * @method _node
f368abf12db070b46ce2128d63a014798994ed5ftavmjong-free * @param {string} type the type of element.
f368abf12db070b46ce2128d63a014798994ed5ftavmjong-free * @param {Object} attr the fixed set of attribute for the type.
0b067090fd4358b8109240b17d1eb8e05a382058tavmjong-free * @param {Object} custAttrs optional Any custom attributes provided by the user.
98ddd0ef7554a9d613111dbc0a18f4a481682641tavmjong-free * @param {Window} win optional window to create the element in.
1bfbf2d5669e1ece890fb71f925246c2f123ae9btavmjong-free * @return {HTMLElement} the generated node.
234b8d479c1b071fbaa096392fb30da54c5f6825tavmjong-free _node = function(type, attr, custAttrs, win) {
234b8d479c1b071fbaa096392fb30da54c5f6825tavmjong-free * Generates a link node
234b8d479c1b071fbaa096392fb30da54c5f6825tavmjong-free * @method _linkNode
2b0e2e6c2dde5d6cb739785016e91189888ff483tavmjong-free * @param {string} url the url for the css file.
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @param {Window} win optional window to create the node in.
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @param {object} attributes optional attributes collection to apply to the
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @return {HTMLElement} the generated node.
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * Generates a script node
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @method _scriptNode
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @param {string} url the url for the script file.
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @param {Window} win optional window to create the node in.
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @param {object} attributes optional attributes collection to apply to the
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free * @return {HTMLElement} the generated node.
28bf548be956fa98bffa377e2caba5f28fb281adtavmjong-free _scriptNode = function(url, win, attributes) {
purge: function() {
q.finished = true;
if (onEnd) {
_clearTimeout(q);
if (onFailure) {
_clearTimeout(q);
if (q.aborted) {
if (onSuccess) {
* @param {String|HTMLElement} nId The node id to find. If an HTMLElement is passed in, it will be returned.
q.nodes = [];
if (onProgress) {
o = _returnData(q);
if (onTimeout) {
if (sync) {
_clearTimeout(q);
if (!q.finished) {
if (q.aborted) {
} else if (sync) {
n.onreadystatechange = function() {
n.onreadystatechange = null;
n.onload = function() {
n.onerror = function(e) {
if (insertBefore) {
if (sibling) {
node,
url;
}, timeout);
if (q.async) {
_autoPurge = function() {
if (purging) {
purging = true;
for (i in queues) {
q = queues[i];
delete queues[i];
purging = false;
_autoPurge();
q.finished = false;
q.nodes = [];
Y.Get = {
abort : function(o) {
q.aborted = true;
* <dd>callback to execute when each individual file is done loading (useful when passing in an array of css files). Receives the same
* payload as onSuccess, with the addition of a <code>url</code> property, which identifies the file which was loaded. Currently only useful for non Webkit/Gecko browsers,
* into the document in parallel, as oppposed to the default behavior, which is to chain load them (where possible).
* This flag is more useful for scripts currently, since for css Get only chains if not Webkit/Gecko.</dd>
* Y.Get.css("http://localhost/css/menu.css");
* ["http://localhost/css/menu.css",
* "http://localhost/css/logger.css"], {