2 Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.com/yui/license.html
8 YUI.add('node-pluginhost', function(Y) {
11 * Registers plugins to be instantiated at the class level (plugins
12 * which should be plugged into every instance of Node by default).
17 * @param {Function | Array} plugin Either the plugin class, an array of plugin classes or an array of objects (with fn and cfg properties defined)
18 * @param {Object} config (Optional) If plugin is the plugin class, the configuration for the plugin
20 Y.Node.plug = function() {
21 var args = Y.Array(arguments);
23 Y.Plugin.Host.plug.apply(Y.Base, args);
28 * Unregisters any class level plugins which have been registered by the Node
33 * @param {Function | Array} plugin The plugin class, or an array of plugin classes
35 Y.Node.unplug = function() {
36 var args = Y.Array(arguments);
38 Y.Plugin.Host.unplug.apply(Y.Base, args);
42 Y.mix(Y.Node, Y.Plugin.Host, false, null, 1);
44 // allow batching of plug/unplug via NodeList
45 // doesn't use NodeList.importMethod because we need real Nodes (not tmpNode)
46 Y.NodeList.prototype.plug = function() {
48 Y.NodeList.each(this, function(node) {
49 Y.Node.prototype.plug.apply(Y.one(node), args);
53 Y.NodeList.prototype.unplug = function() {
55 Y.NodeList.each(this, function(node) {
56 Y.Node.prototype.unplug.apply(Y.one(node), args);
61 }, '3.3.0' ,{requires:['node-base', 'pluginhost']});