on master help sign in
Fix Float32Array bug in IE. Fix input selection bug in IE.
582a4c5evancz
libraries/Native/Graphics/Input.js+10−2
@@ -140,6 +140,14 @@ Elm.Native.Graphics.Input = function(elm) {
140 return { _:{}, box:F2(box), events:events };
140 return { _:{}, box:F2(box), events:events };
141 }
141 }
142
142
143+ function setRange(node, start, end, dir) {
144+ if (node.parentNode) {
145+ node.setSelectionRange(start, end, dir);
146+ } else {
147+ setTimeout(function(){node.setSelectionRange(start, end, dir);}, 0);
148+ }
149+ }
150+
143 function mkTextPool(type) { return function fields(defaultValue) {
151 function mkTextPool(type) { return function fields(defaultValue) {
144 var events = Signal.constant(defaultValue);
152 var events = Signal.constant(defaultValue);
145
153
@@ -153,7 +161,7 @@ Elm.Native.Graphics.Input = function(elm) {
153 field.type = type;
161 field.type = type;
154 field.placeholder = fromString(model.placeHolder);
162 field.placeholder = fromString(model.placeHolder);
155 field.value = fromString(model.state.string);
163 field.value = fromString(model.state.string);
156− field.setSelectionRange(model.state.selectionStart, model.state.selectionEnd);
164+ setRange(field, model.state.selectionStart, model.state.selectionEnd, 'forward');
157 field.style.border = 'none';
165 field.style.border = 'none';
158 state = model.state;
166 state = model.state;
159
167
@@ -202,7 +210,7 @@ Elm.Native.Graphics.Input = function(elm) {
202 if (node.selectionStart !== start
210 if (node.selectionStart !== start
203 || node.selectionEnd !== end
211 || node.selectionEnd !== end
204 || node.selectionDirection !== direction) {
212 || node.selectionDirection !== direction) {
205− node.setSelectionRange(start, end, direction);
213+ setRange(node, start, end, direction);
206 }
214 }
207 }
215 }
208
216
libraries/Native/Matrix2D.js+14−2
@@ -5,8 +5,20 @@ Elm.Native.Matrix2D = function(elm) {
5 elm.Native = elm.Native || {};
5 elm.Native = elm.Native || {};
6 if (elm.Native.Matrix2D) return elm.Native.Matrix2D;
6 if (elm.Native.Matrix2D) return elm.Native.Matrix2D;
7
7
8+ var A;
8− if (typeof Float32Array === 'undefined'){ Float32Array = Array; }
9+ if (typeof Float32Array === 'undefined') {
10+ A = function(arr) {
11+ this.length = arr.length;
12+ this[0] = arr[0];
13+ this[1] = arr[1];
14+ this[2] = arr[2];
15+ this[3] = arr[3];
16+ this[4] = arr[4];
17+ this[5] = arr[5];
18+ };
19+ } else {
9− var A = Float32Array;
20+ A = Float32Array;
21+ }
10
22
11 // layout of matrix in an array is
23 // layout of matrix in an array is
12 //
24 //
runtime/Render/Collage.js+6−1
@@ -279,7 +279,12 @@ function updateTracker(w,h,div) {
279 if (!container) {
279 if (!container) {
280 div.appendChild(container);
280 div.appendChild(container);
281 } else {
281 } else {
282− div.insertBefore(container, kids[i]);
282+ var kid = kids[i];
283+ if (kid) {
284+ div.insertBefore(container, kid);
285+ } else {
286+ div.appendChild(container);
287+ }
283 }
288 }
284 }
289 }
285 // we have added a new node, so we must step our position
290 // we have added a new node, so we must step our position