MDL-32843 import YUI 3.5.1
[moodle.git] / lib / yui / 3.5.1 / build / scrollview-base-ie / scrollview-base-ie.js
bloba827d61204a0a9e79740128246a4058ed448198a
1 /*
2 YUI 3.5.1 (build 22)
3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
7 YUI.add('scrollview-base-ie', function(Y) {
9 /**
10  * IE specific support for the scrollview-base module.
11  *
12  * @module scrollview-base-ie
13  */
15 Y.mix(Y.ScrollView.prototype, {
17     /**
18      * Internal method to fix text selection in IE
19      * 
20      * @method _fixIESelect
21      * @for ScrollView
22      * @private
23      * @param {Node} bb The bounding box
24      * @param {Node} cb The content box
25      */
26     _fixIESelect : function(bb, cb) {
27         this._cbDoc = cb.get("ownerDocument");
28         this._nativeBody = Y.Node.getDOMNode(Y.one("body", this._cbDoc));
30         cb.on("mousedown", function() {
31             this._selectstart = this._nativeBody.onselectstart;
32             this._nativeBody.onselectstart = this._iePreventSelect;
33             this._cbDoc.once("mouseup", this._ieRestoreSelect, this);
34         }, this);
35     },
37     /**
38      * Native onselectstart handle to prevent selection in IE
39      *
40      * @method _iePreventSelect
41      * @for ScrollView
42      * @private
43      */
44     _iePreventSelect : function() {
45         return false;
46     },
48     /**
49      * Restores native onselectstart handle, backed up to prevent selection in IE
50      *
51      * @method _ieRestoreSelect
52      * @for ScrollView
53      * @private
54      */
55     _ieRestoreSelect : function() {
56         this._nativeBody.onselectstart = this._selectstart;
57     }
58 }, true);
61 }, '3.5.1' ,{requires:['scrollview-base']});