3
Copyright 2011 Yahoo! Inc. All rights reserved.
4
Licensed under the BSD License.
5
http://yuilibrary.com/license/
7
YUI.add('shim-plugin', function(Y) {
10
* Provides shimming support for Node via a Plugin.
11
* This fixes SELECT bleedthrough for IE6 & Mac scrollbars
16
* Node plugin which can be used to add shim support.
19
* @param {Object} User configuration object
21
function Shim(config) {
26
* Default class used to mark the shim element
28
* @property CLASS_NAME
31
* @default "yui-node-shim"
33
// TODO: use ClassNameManager
34
Shim.CLASS_NAME = 'yui-node-shim';
37
* Default markup template used to generate the shim element.
43
Shim.TEMPLATE = '<iframe class="' + Shim.CLASS_NAME +
44
'" frameborder="0" title="Node Stacking Shim"' +
45
'src="javascript:false" tabindex="-1" role="presentation"' +
46
'style="position:absolute; z-index:-1;"></iframe>';
49
init: function(config) {
50
this._host = config.host;
56
initEvents: function() {
57
this._resizeHandle = this._host.on('resize', this.sync, this);
61
return this._shim || (
62
this._shim = Y.Node.create(
64
this._host.get('ownerDocument')
70
var node = this._host;
71
this._shim = node.insertBefore( this.getShim(),
72
node.get('firstChild'));
76
* Updates the size of the shim to fill its container
80
var shim = this._shim,
85
width: node.getStyle('width'),
86
height: node.getStyle('height')
92
* Removes the shim and destroys the plugin
96
var shim = this._shim;
101
this._resizeHandle.detach();
108
Y.namespace('Plugin');
109
Y.Plugin.Shim = Shim;
112
}, '3.4.1' ,{requires:['node-style', 'node-pluginhost']});