/usr/share/javascript/yui3/node-load/node-load.js is in libjs-yui3-full 3.5.1-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | /*
YUI 3.5.1 (build 22)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('node-load', function(Y) {
/**
* Extended Node interface with a basic IO API.
* @module node
* @submodule node-load
*/
/**
* The default IO complete handler.
* @method _ioComplete
* @protected
* @for Node
* @param {String} code The response code.
* @param {Object} response The response object.
* @param {Array} args An array containing the callback and selector
*/
Y.Node.prototype._ioComplete = function(code, response, args) {
var selector = args[0],
callback = args[1],
tmp,
content;
if (response && response.responseText) {
content = response.responseText;
if (selector) {
tmp = Y.DOM.create(content);
content = Y.Selector.query(selector, tmp);
}
this.setContent(content);
}
if (callback) {
callback.call(this, code, response);
}
};
/**
* Loads content from the given url and replaces the Node's
* existing content with the remote content.
* @method load
* @param {String} url The URL to load via XMLHttpRequest.
* @param {String} selector An optional selector representing a subset of an HTML document to load.
* @param {Function} callback An optional function to run after the content has been loaded.
* @chainable
*/
Y.Node.prototype.load = function(url, selector, callback) {
if (typeof selector == 'function') {
callback = selector;
selector = null;
}
var config = {
context: this,
on: {
complete: this._ioComplete
},
arguments: [selector, callback]
};
Y.io(url, config);
return this;
}
}, '3.5.1' ,{requires:['node-base', 'io-base']});
|