aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/scroller.reel/scroller.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/ui/scroller.reel/scroller.js')
-rw-r--r--node_modules/montage/ui/scroller.reel/scroller.js49
1 files changed, 9 insertions, 40 deletions
diff --git a/node_modules/montage/ui/scroller.reel/scroller.js b/node_modules/montage/ui/scroller.reel/scroller.js
index b578807e..8c367cd1 100644
--- a/node_modules/montage/ui/scroller.reel/scroller.js
+++ b/node_modules/montage/ui/scroller.reel/scroller.js
@@ -5,8 +5,7 @@
5 </copyright> */ 5 </copyright> */
6 6
7var Montage = require("montage").Montage, 7var Montage = require("montage").Montage,
8 Component = require("ui/component").Component 8 Component = require("ui/component").Component;
9 TranslateComposer = require("ui/composer/translate-composer").TranslateComposer;
10 9
11exports.Scroller = Montage.create(Component, { 10exports.Scroller = Montage.create(Component, {
12 11
@@ -116,40 +115,6 @@ exports.Scroller = Montage.create(Component, {
116 } 115 }
117 }, 116 },
118 117
119 _momentumDuration: {
120 enumerable: false,
121 value: 650
122 },
123
124 momentumDuration: {
125 get: function () {
126 return this._momentumDuration;
127 },
128 set: function (value) {
129 this._momentumDuration = isNaN(parseInt(value, 10)) ? 1 : parseInt(value, 10);
130 if (this._momentumDuration < 1) {
131 this._momentumDuration = 1;
132 }
133 }
134 },
135
136 _bouncingDuration: {
137 enumerable: false,
138 value: 750
139 },
140
141 bouncingDuration: {
142 get: function () {
143 return this._bouncingDuration;
144 },
145 set: function (value) {
146 this._bouncingDuration = isNaN(parseInt(value, 10)) ? 1 : parseInt(value, 10);
147 if (this._bouncingDuration < 1) {
148 this._bouncingDuration = 1;
149 }
150 }
151 },
152
153 _content: { 118 _content: {
154 enumerable: false, 119 enumerable: false,
155 value: null 120 value: null
@@ -157,11 +122,15 @@ exports.Scroller = Montage.create(Component, {
157 122
158 templateDidLoad: { 123 templateDidLoad: {
159 value: function () { 124 value: function () {
160 var orphanedFragment, 125 var orphanedFragment = document.createDocumentFragment(),
161 currentContentRange = this.element.ownerDocument.createRange(); 126 children = this.element.childNodes;
162 127
163 currentContentRange.selectNodeContents(this.element); 128
164 orphanedFragment = currentContentRange.extractContents(); 129 while (children.length > 0) {
130 // As the nodes are appended to item.fragment they are removed
131 // from item.element, so always use index 0.
132 orphanedFragment.appendChild(children[0]);
133 }
165 this._content.appendChild(orphanedFragment); 134 this._content.appendChild(orphanedFragment);
166 } 135 }
167 }, 136 },