| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /*
- Copyright (c) 2010, Yahoo! Inc. All rights reserved.
- Code licensed under the BSD License:
- http://developer.yahoo.com/yui/license.html
- version: 3.4.0
- build: nightly
- */
- YUI.add('node-pluginhost', function(Y) {
-
- /**
- * @module node
- * @submodule node-pluginhost
- */
-
- /**
- * Registers plugins to be instantiated at the class level (plugins
- * which should be plugged into every instance of Node by default).
- *
- * @method plug
- * @static
- * @for Node
- * @param {Function | Array} plugin Either the plugin class, an array of plugin classes or an array of objects (with fn and cfg properties defined)
- * @param {Object} config (Optional) If plugin is the plugin class, the configuration for the plugin
- */
- Y.Node.plug = function() {
- var args = Y.Array(arguments);
- args.unshift(Y.Node);
- Y.Plugin.Host.plug.apply(Y.Base, args);
- return Y.Node;
- };
-
- /**
- * Unregisters any class level plugins which have been registered by the Node
- *
- * @method unplug
- * @static
- *
- * @param {Function | Array} plugin The plugin class, or an array of plugin classes
- */
- Y.Node.unplug = function() {
- var args = Y.Array(arguments);
- args.unshift(Y.Node);
- Y.Plugin.Host.unplug.apply(Y.Base, args);
- return Y.Node;
- };
-
- Y.mix(Y.Node, Y.Plugin.Host, false, null, 1);
-
- // allow batching of plug/unplug via NodeList
- // doesn't use NodeList.importMethod because we need real Nodes (not tmpNode)
- Y.NodeList.prototype.plug = function() {
- var args = arguments;
- Y.NodeList.each(this, function(node) {
- Y.Node.prototype.plug.apply(Y.one(node), args);
- });
- };
-
- Y.NodeList.prototype.unplug = function() {
- var args = arguments;
- Y.NodeList.each(this, function(node) {
- Y.Node.prototype.unplug.apply(Y.one(node), args);
- });
- };
-
-
- }, '3.4.0' ,{requires:['node-base', 'pluginhost']});
|