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