|
1 YUI.add('scrollview-base-ie', function (Y, NAME) { |
|
2 |
|
3 /** |
|
4 * IE specific support for the scrollview-base module. |
|
5 * |
|
6 * @module scrollview-base-ie |
|
7 */ |
|
8 |
|
9 Y.mix(Y.ScrollView.prototype, { |
|
10 |
|
11 /** |
|
12 * Internal method to fix text selection in IE |
|
13 * |
|
14 * @method _fixIESelect |
|
15 * @for ScrollView |
|
16 * @private |
|
17 * @param {Node} bb The bounding box |
|
18 * @param {Node} cb The content box |
|
19 */ |
|
20 _fixIESelect : function(bb, cb) { |
|
21 this._cbDoc = cb.get("ownerDocument"); |
|
22 this._nativeBody = Y.Node.getDOMNode(Y.one("body", this._cbDoc)); |
|
23 |
|
24 cb.on("mousedown", function() { |
|
25 this._selectstart = this._nativeBody.onselectstart; |
|
26 this._nativeBody.onselectstart = this._iePreventSelect; |
|
27 this._cbDoc.once("mouseup", this._ieRestoreSelect, this); |
|
28 }, this); |
|
29 }, |
|
30 |
|
31 /** |
|
32 * Native onselectstart handle to prevent selection in IE |
|
33 * |
|
34 * @method _iePreventSelect |
|
35 * @for ScrollView |
|
36 * @private |
|
37 */ |
|
38 _iePreventSelect : function() { |
|
39 return false; |
|
40 }, |
|
41 |
|
42 /** |
|
43 * Restores native onselectstart handle, backed up to prevent selection in IE |
|
44 * |
|
45 * @method _ieRestoreSelect |
|
46 * @for ScrollView |
|
47 * @private |
|
48 */ |
|
49 _ieRestoreSelect : function() { |
|
50 this._nativeBody.onselectstart = this._selectstart; |
|
51 } |
|
52 }, true); |
|
53 |
|
54 |
|
55 }, '@VERSION@', {"requires": ["scrollview-base"]}); |