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('shim-plugin', function(Y) {
11 * Provides shimming support for Node via a Plugin.
12 * This fixes SELECT bleedthrough for IE6 & Mac scrollbars
17 * Node plugin which can be used to add shim support.
20 * @param {Object} User configuration object
22 function Shim(config) {
27 * Default class used to mark the shim element
29 * @property Shim.CLASS_NAME
32 * @default "yui-node-shim"
34 // TODO: use ClassNameManager
35 Shim.CLASS_NAME = 'yui-node-shim';
38 * Default markup template used to generate the shim element.
40 * @property Shim.TEMPLATE
44 Shim.TEMPLATE = '<iframe class="' + Shim.CLASS_NAME +
45 '" frameborder="0" title="Node Stacking Shim"' +
46 'src="javascript:false" tabindex="-1" role="presentation"' +
47 'style="position:absolute; z-index:-1;"></iframe>';
50 init: function(config) {
51 this._host = config.host;
57 initEvents: function() {
58 this._resizeHandle = this._host.on('resize', this.sync, this);
62 return this._shim || (
63 this._shim = Y.Node.create(
65 this._host.get('ownerDocument')
71 var node = this._host;
72 this._shim = node.insertBefore( this.getShim(),
73 node.get('firstChild'));
77 * Updates the size of the shim to fill its container
81 var shim = this._shim,
86 width: node.getStyle('width'),
87 height: node.getStyle('height')
93 * Removes the shim and destroys the plugin
97 var shim = this._shim;
102 this._resizeHandle.detach();
109 Y.namespace('Plugin');
110 Y.Plugin.Shim = Shim;
113 }, '3.3.0' ,{requires:['node-style', 'node-pluginhost']});