3
Copyright 2011 Yahoo! Inc. All rights reserved.
4
Licensed under the BSD License.
5
http://yuilibrary.com/license/
7
YUI.add('node-pluginhost', function(Y) {
11
* @submodule node-pluginhost
15
* Registers plugins to be instantiated at the class level (plugins
16
* which should be plugged into every instance of Node by default).
21
* @param {Function | Array} plugin Either the plugin class, an array of plugin classes or an array of objects (with fn and cfg properties defined)
22
* @param {Object} config (Optional) If plugin is the plugin class, the configuration for the plugin
24
Y.Node.plug = function() {
25
var args = Y.Array(arguments);
27
Y.Plugin.Host.plug.apply(Y.Base, args);
32
* Unregisters any class level plugins which have been registered by the Node
37
* @param {Function | Array} plugin The plugin class, or an array of plugin classes
39
Y.Node.unplug = function() {
40
var args = Y.Array(arguments);
42
Y.Plugin.Host.unplug.apply(Y.Base, args);
46
Y.mix(Y.Node, Y.Plugin.Host, false, null, 1);
48
// allow batching of plug/unplug via NodeList
49
// doesn't use NodeList.importMethod because we need real Nodes (not tmpNode)
50
Y.NodeList.prototype.plug = function() {
52
Y.NodeList.each(this, function(node) {
53
Y.Node.prototype.plug.apply(Y.one(node), args);
57
Y.NodeList.prototype.unplug = function() {
59
Y.NodeList.each(this, function(node) {
60
Y.Node.prototype.unplug.apply(Y.one(node), args);
65
}, '3.4.1' ,{requires:['node-base', 'pluginhost']});