|
36 | 36 | version: "@VERSION",
|
37 | 37 |
|
38 | 38 | setup: function() {
|
39 |
| - // Use passive event listeners if supported |
40 |
| - var passiveSupported = false; |
41 |
| - try { |
42 |
| - var opts = Object.defineProperty({}, "passive", { |
43 |
| - get: function() { |
44 |
| - passiveSupported = true; |
45 |
| - } |
46 |
| - }); |
47 |
| - window.addEventListener("test", null, opts); |
48 |
| - } catch (e) {} |
49 |
| - this.addEventListener( |
50 |
| - "wheel", |
51 |
| - handler, |
52 |
| - passiveSupported ? { passive: true } : false |
53 |
| - ); |
| 39 | + // Use passive event listeners if supported |
| 40 | + var passiveSupported = false; |
| 41 | + try { |
| 42 | + var opts = Object.defineProperty({}, "passive", { |
| 43 | + get: function() { |
| 44 | + passiveSupported = true; |
| 45 | + } |
| 46 | + }); |
| 47 | + window.addEventListener("test", null, opts); |
| 48 | + } catch (e) {} |
| 49 | + this.addEventListener( |
| 50 | + "wheel", |
| 51 | + handler, |
| 52 | + passiveSupported ? { passive: true } : false |
| 53 | + ); |
54 | 54 |
|
55 | 55 | // Store the line height and page height for this particular element
|
56 | 56 | $.data( this, "mousewheel-line-height", special.getLineHeight( this ) );
|
57 | 57 | $.data( this, "mousewheel-page-height", special.getPageHeight( this ) );
|
58 | 58 | },
|
59 | 59 |
|
60 | 60 | teardown: function() {
|
61 |
| - // Remove with same passive option as setup |
62 |
| - var passiveSupported = false; |
63 |
| - try { |
64 |
| - var opts = Object.defineProperty({}, "passive", { |
65 |
| - get: function() { |
66 |
| - passiveSupported = true; |
67 |
| - } |
68 |
| - }); |
69 |
| - window.addEventListener("test", null, opts); |
70 |
| - } catch (e) {} |
71 |
| - this.removeEventListener( |
72 |
| - "wheel", |
73 |
| - handler, |
74 |
| - passiveSupported ? { passive: true } : false |
75 |
| - ); |
| 61 | + // Remove with same passive option as setup |
| 62 | + var passiveSupported = false; |
| 63 | + try { |
| 64 | + var opts = Object.defineProperty({}, "passive", { |
| 65 | + get: function() { |
| 66 | + passiveSupported = true; |
| 67 | + } |
| 68 | + }); |
| 69 | + window.addEventListener("test", null, opts); |
| 70 | + } catch (e) {} |
| 71 | + this.removeEventListener( |
| 72 | + "wheel", |
| 73 | + handler, |
| 74 | + passiveSupported ? { passive: true } : false |
| 75 | + ); |
76 | 76 |
|
77 | 77 | // Clean up the data we added to the element
|
78 | 78 | $.removeData( this, "mousewheel-line-height" );
|
|
0 commit comments