sproutcore 1.11.0.rc3 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +6 -14
- data/CHANGELOG +5 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/Buildfile +3 -2
- data/lib/frameworks/sproutcore/CHANGELOG.md +59 -10
- data/lib/frameworks/sproutcore/apps/showcase/resources/main_page.js +1 -0
- data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +9 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +0 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +10 -45
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/touch.js +76 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/{touch.js → touch_test.js} +64 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/design_mode_test.js +61 -24
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createChildViews.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/destroy.js +0 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/{layoutStyle.js → layout_style_test.js} +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout_test.js +602 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +0 -23
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +18 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/design_mode.js +64 -24
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +904 -871
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +40 -24
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +36 -33
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/autonomous_dataSourceCallbacks.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/retrieveRecord.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/designer/coders/object.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +30 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +12 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroller_view.js +0 -36
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch_gesture.js +286 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe_gesture.js +449 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap_gesture.js +259 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gesturable.js +218 -30
- data/lib/frameworks/sproutcore/frameworks/foundation/system/gesture.js +259 -158
- data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +58 -50
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/gestures/pinch_gesture_test.js +321 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/gestures/swipe_gesture_test.js +154 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/gestures/tap_gesture_test.js +55 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/gesturable_test.js +233 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/gesture_test.js +254 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/legacy/object_keys_polyfill.js +51 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation/system/req_anim_frame.js → legacy/request_animation_frame_polyfill.js} +10 -3
- data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +19 -25
- data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +9 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/insertAt.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeAt.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +66 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/tree.js +44 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +4 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +0 -25
- data/lib/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +67 -15
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -11
- data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/system/string.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/{observable.js → observable_test.js} +110 -16
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +1 -1
- data/lib/sproutcore/render_engines/haml.rb +1 -1
- metadata +610 -604
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +0 -210
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +0 -275
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +0 -119
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +0 -234
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +0 -157
@@ -77,7 +77,7 @@ test("raises exception if you try to write an attribute before an attribute hash
|
|
77
77
|
try {
|
78
78
|
foo.writeAttribute("foo", "bar");
|
79
79
|
} catch(e) {
|
80
|
-
equals(e, SC.Record.BAD_STATE_ERROR, 'should throw BAD_STATE_ERROR');
|
80
|
+
equals(e.message, SC.Record.BAD_STATE_ERROR.toString(), 'should throw BAD_STATE_ERROR');
|
81
81
|
cnt++;
|
82
82
|
}
|
83
83
|
equals(cnt, 1, 'should raise exception');
|
@@ -163,7 +163,7 @@ test("Confirm that dataSourceDidCancel switched the records to the right states"
|
|
163
163
|
}catch(error){
|
164
164
|
msg=error.message;
|
165
165
|
}
|
166
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
166
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
167
167
|
"should throw the following error ");
|
168
168
|
|
169
169
|
store.dataSourceDidCancel(storeKey2);
|
@@ -196,7 +196,7 @@ test("Confirm that dataSourceDidCancel switched the records to the right states"
|
|
196
196
|
}catch(error){
|
197
197
|
msg=error.message;
|
198
198
|
}
|
199
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
199
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
200
200
|
"should throw the following error ");
|
201
201
|
|
202
202
|
});
|
@@ -210,7 +210,7 @@ test("Confirm that dataSourceDidComplete switched the records to the right state
|
|
210
210
|
}catch(error){
|
211
211
|
msg=error.message;
|
212
212
|
}
|
213
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
213
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
214
214
|
"should throw the following error ");
|
215
215
|
|
216
216
|
try{
|
@@ -219,7 +219,7 @@ test("Confirm that dataSourceDidComplete switched the records to the right state
|
|
219
219
|
}catch(error){
|
220
220
|
msg=error.message;
|
221
221
|
}
|
222
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
222
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
223
223
|
"should throw the following error ");
|
224
224
|
|
225
225
|
store.dataSourceDidComplete(storeKey11);
|
@@ -237,7 +237,7 @@ test("Confirm that dataSourceDidDestroy switched the records to the right states
|
|
237
237
|
}catch(error){
|
238
238
|
msg=error.message;
|
239
239
|
}
|
240
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
240
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
241
241
|
"should throw the following error ");
|
242
242
|
|
243
243
|
store.dataSourceDidDestroy(storeKey13);
|
@@ -255,7 +255,7 @@ test("Confirm that dataSourceDidError switched the records to the right states",
|
|
255
255
|
}catch(error){
|
256
256
|
msg = error.message;
|
257
257
|
}
|
258
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
258
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
259
259
|
"should throw the following error ");
|
260
260
|
|
261
261
|
store.dataSourceDidError(storeKey15, SC.Record.BAD_STATE_ERROR);
|
@@ -118,7 +118,7 @@ function createConflict(force) {
|
|
118
118
|
try {
|
119
119
|
child.commitChanges(force);
|
120
120
|
} catch(e) {
|
121
|
-
equals(e, SC.Store.CHAIN_CONFLICT_ERROR, 'should throw CHAIN_CONFLICT_ERROR');
|
121
|
+
equals(e.message, SC.Store.CHAIN_CONFLICT_ERROR.toString(), 'should throw CHAIN_CONFLICT_ERROR');
|
122
122
|
errorCount++;
|
123
123
|
}
|
124
124
|
|
@@ -156,7 +156,7 @@ test("Confirm that all the states are switched as expected after running commitR
|
|
156
156
|
throwError=true;
|
157
157
|
msg=error.message;
|
158
158
|
}
|
159
|
-
equals(msg, SC.Record.NOT_FOUND_ERROR.
|
159
|
+
equals(msg, SC.Record.NOT_FOUND_ERROR.toString(), "commitRecord should throw the following error");
|
160
160
|
|
161
161
|
store.commitRecord(undefined, undefined, storeKey7);
|
162
162
|
status = store.readStatus( storeKey7);
|
data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js
CHANGED
@@ -161,7 +161,7 @@ test("Confirm that dataSourceDidCancel switched the records to the right states"
|
|
161
161
|
}catch(error){
|
162
162
|
msg=error.message;
|
163
163
|
}
|
164
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
164
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
165
165
|
"should throw the following error ");
|
166
166
|
|
167
167
|
store.dataSourceDidCancel(storeKey2);
|
@@ -194,7 +194,7 @@ test("Confirm that dataSourceDidCancel switched the records to the right states"
|
|
194
194
|
}catch(error){
|
195
195
|
msg=error.message;
|
196
196
|
}
|
197
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
197
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
198
198
|
"should throw the following error ");
|
199
199
|
|
200
200
|
});
|
@@ -208,7 +208,7 @@ test("Confirm that dataSourceDidComplete switched the records to the right state
|
|
208
208
|
}catch(error){
|
209
209
|
msg=error.message;
|
210
210
|
}
|
211
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
211
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
212
212
|
"should throw the following error ");
|
213
213
|
|
214
214
|
try{
|
@@ -217,7 +217,7 @@ test("Confirm that dataSourceDidComplete switched the records to the right state
|
|
217
217
|
}catch(error){
|
218
218
|
msg=error.message;
|
219
219
|
}
|
220
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
220
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
221
221
|
"should throw the following error ");
|
222
222
|
|
223
223
|
store.dataSourceDidComplete(storeKey11);
|
@@ -258,8 +258,8 @@ test("Confirm that dataSourceDidDestroy switched the records to the right states
|
|
258
258
|
msg='';
|
259
259
|
}catch(error){
|
260
260
|
msg=error.message;
|
261
|
-
}
|
262
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
261
|
+
}
|
262
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
263
263
|
"should throw the following error ");
|
264
264
|
|
265
265
|
store.dataSourceDidDestroy(storeKey13);
|
@@ -277,7 +277,7 @@ test("Confirm that dataSourceDidError switched the records to the right states",
|
|
277
277
|
}catch(error){
|
278
278
|
msg = error.message;
|
279
279
|
}
|
280
|
-
equals(SC.Record.BAD_STATE_ERROR.
|
280
|
+
equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
|
281
281
|
"should throw the following error ");
|
282
282
|
|
283
283
|
store.dataSourceDidError(storeKey15, SC.Record.BAD_STATE_ERROR);
|
@@ -86,7 +86,7 @@ test("Check for different states after/before executing destroyRecord", function
|
|
86
86
|
}catch(error1){
|
87
87
|
msg=error1.message;
|
88
88
|
}
|
89
|
-
equals(msg, SC.Record.NOT_FOUND_ERROR.
|
89
|
+
equals(msg, SC.Record.NOT_FOUND_ERROR.toString(), "destroyRecord should throw the following error");
|
90
90
|
|
91
91
|
try{
|
92
92
|
store.destroyRecord(undefined, undefined, storeKey4);
|
@@ -94,7 +94,7 @@ test("Check for different states after/before executing destroyRecord", function
|
|
94
94
|
}catch(error2){
|
95
95
|
msg=error2.message;
|
96
96
|
}
|
97
|
-
equals(msg, SC.Record.BUSY_ERROR.
|
97
|
+
equals(msg, SC.Record.BUSY_ERROR.toString(), "destroyRecord should throw the following error");
|
98
98
|
|
99
99
|
store.destroyRecord(undefined, undefined, storeKey5);
|
100
100
|
status = store.readStatus(storeKey5);
|
@@ -56,13 +56,13 @@ test("recordDidChange", function() {
|
|
56
56
|
try{
|
57
57
|
store.recordDidChange(undefined, undefined, storeKey1);
|
58
58
|
}catch(error1){
|
59
|
-
equals(SC.Record.BUSY_ERROR.
|
59
|
+
equals(SC.Record.BUSY_ERROR.toString(), error1.message, "the status shouldn't have changed.");
|
60
60
|
}
|
61
61
|
|
62
62
|
try{
|
63
63
|
store.recordDidChange(undefined, undefined, storeKey2);
|
64
64
|
}catch(error2){
|
65
|
-
equals(SC.Record.NOT_FOUND_ERROR.
|
65
|
+
equals(SC.Record.NOT_FOUND_ERROR.toString(), error2.message, "the status shouldn't have changed.");
|
66
66
|
}
|
67
67
|
|
68
68
|
store.recordDidChange(undefined, undefined, storeKey3);
|
@@ -119,7 +119,7 @@ function testStates(canLoad) {
|
|
119
119
|
}catch(error1){
|
120
120
|
msg=error1.message;
|
121
121
|
}
|
122
|
-
equals(msg, SC.Record.BUSY_ERROR.
|
122
|
+
equals(msg, SC.Record.BUSY_ERROR.toString(), "should throw error");
|
123
123
|
|
124
124
|
try{
|
125
125
|
store.retrieveRecord(undefined, undefined, storeKey5, YES);
|
@@ -127,7 +127,7 @@ function testStates(canLoad) {
|
|
127
127
|
}catch(error2){
|
128
128
|
msg=error2.message;
|
129
129
|
}
|
130
|
-
equals(msg, SC.Record.BUSY_ERROR.
|
130
|
+
equals(msg, SC.Record.BUSY_ERROR.toString(), "should throw error");
|
131
131
|
|
132
132
|
try{
|
133
133
|
store.retrieveRecord(undefined, undefined, storeKey6, YES);
|
@@ -135,7 +135,7 @@ function testStates(canLoad) {
|
|
135
135
|
}catch(error3){
|
136
136
|
msg=error3.message;
|
137
137
|
}
|
138
|
-
equals(msg, SC.Record.BUSY_ERROR.
|
138
|
+
equals(msg, SC.Record.BUSY_ERROR.toString(), "should throw error");
|
139
139
|
|
140
140
|
try{
|
141
141
|
store.retrieveRecord(undefined, undefined, storeKey7, YES);
|
@@ -143,7 +143,7 @@ function testStates(canLoad) {
|
|
143
143
|
}catch(error4){
|
144
144
|
msg=error4.message;
|
145
145
|
}
|
146
|
-
equals(msg, SC.Record.BAD_STATE_ERROR.
|
146
|
+
equals(msg, SC.Record.BAD_STATE_ERROR.toString(), "should throw error");
|
147
147
|
|
148
148
|
|
149
149
|
store.retrieveRecord(undefined, undefined, storeKey8, YES);
|
@@ -12,7 +12,7 @@
|
|
12
12
|
@constant
|
13
13
|
@type Error
|
14
14
|
*/
|
15
|
-
SC.SCANNER_OUT_OF_BOUNDS_ERROR =
|
15
|
+
SC.SCANNER_OUT_OF_BOUNDS_ERROR = SC.$error("Out of bounds.");
|
16
16
|
|
17
17
|
/**
|
18
18
|
Standard error thrown by `SC.Scanner` when you pass a value not an integer.
|
@@ -21,7 +21,7 @@ SC.SCANNER_OUT_OF_BOUNDS_ERROR = new Error("Out of bounds.");
|
|
21
21
|
@constant
|
22
22
|
@type Error
|
23
23
|
*/
|
24
|
-
SC.SCANNER_INT_ERROR =
|
24
|
+
SC.SCANNER_INT_ERROR = SC.$error("Not an int.");
|
25
25
|
|
26
26
|
/**
|
27
27
|
Standard error thrown by `SC.SCanner` when it cannot find a string to skip.
|
@@ -30,7 +30,7 @@ SC.SCANNER_INT_ERROR = new Error("Not an int.");
|
|
30
30
|
@constant
|
31
31
|
@type Error
|
32
32
|
*/
|
33
|
-
SC.SCANNER_SKIP_ERROR =
|
33
|
+
SC.SCANNER_SKIP_ERROR = SC.$error("Did not find the string to skip.");
|
34
34
|
|
35
35
|
/**
|
36
36
|
Standard error thrown by `SC.Scanner` when it can any kind a string in the
|
@@ -40,7 +40,7 @@ SC.SCANNER_SKIP_ERROR = new Error("Did not find the string to skip.");
|
|
40
40
|
@constant
|
41
41
|
@type Error
|
42
42
|
*/
|
43
|
-
SC.SCANNER_SCAN_ARRAY_ERROR =
|
43
|
+
SC.SCANNER_SCAN_ARRAY_ERROR = SC.$error("Did not find any string of the given array to scan.");
|
44
44
|
|
45
45
|
/**
|
46
46
|
Standard error thrown when trying to compare two dates in different
|
@@ -50,7 +50,7 @@ SC.SCANNER_SCAN_ARRAY_ERROR = new Error("Did not find any string of the given ar
|
|
50
50
|
@constant
|
51
51
|
@type Error
|
52
52
|
*/
|
53
|
-
SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR =
|
53
|
+
SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR = SC.$error("Can't compare the dates of two DateTimes that don't have the same timezone.");
|
54
54
|
|
55
55
|
/**
|
56
56
|
Standard ISO8601 date format
|
@@ -106,7 +106,7 @@ SC.Scanner = SC.Object.extend(
|
|
106
106
|
@returns {String} The characters
|
107
107
|
*/
|
108
108
|
scan: function(len) {
|
109
|
-
if (this.scanLocation + len > this.length)
|
109
|
+
if (this.scanLocation + len > this.length) SC.SCANNER_OUT_OF_BOUNDS_ERROR.throw();
|
110
110
|
var str = this.string.substr(this.scanLocation, len);
|
111
111
|
this.scanLocation += len;
|
112
112
|
return str;
|
@@ -125,7 +125,7 @@ SC.Scanner = SC.Object.extend(
|
|
125
125
|
var str = this.scan(max_len);
|
126
126
|
var re = new RegExp("^\\d{" + min_len + "," + max_len + "}");
|
127
127
|
var match = str.match(re);
|
128
|
-
if (!match)
|
128
|
+
if (!match) SC.SCANNER_INT_ERROR.throw();
|
129
129
|
if (match[0].length < max_len) {
|
130
130
|
this.scanLocation += match[0].length - max_len;
|
131
131
|
}
|
@@ -140,7 +140,7 @@ SC.Scanner = SC.Object.extend(
|
|
140
140
|
@returns {Boolean} YES if the given string was successfully scanned, NO otherwise
|
141
141
|
*/
|
142
142
|
skipString: function(str) {
|
143
|
-
if (this.scan(str.length) !== str)
|
143
|
+
if (this.scan(str.length) !== str) SC.SCANNER_SKIP_ERROR.throw();
|
144
144
|
return YES;
|
145
145
|
},
|
146
146
|
|
@@ -158,7 +158,7 @@ SC.Scanner = SC.Object.extend(
|
|
158
158
|
}
|
159
159
|
this.scanLocation -= ary[i].length;
|
160
160
|
}
|
161
|
-
|
161
|
+
SC.SCANNER_SCAN_ARRAY_ERROR.throw();
|
162
162
|
}
|
163
163
|
|
164
164
|
});
|
@@ -1227,7 +1227,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
1227
1227
|
*/
|
1228
1228
|
compareDate: function(a, b) {
|
1229
1229
|
if (SC.none(a) || SC.none(b)) throw new Error("You must pass two valid dates to compareDate()");
|
1230
|
-
if (a.get('timezone') !== b.get('timezone'))
|
1230
|
+
if (a.get('timezone') !== b.get('timezone')) SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR.throw();
|
1231
1231
|
var ma = a.adjust({hour: 0}).get('milliseconds');
|
1232
1232
|
var mb = b.adjust({hour: 0}).get('milliseconds');
|
1233
1233
|
return ma < mb ? -1 : ma === mb ? 0 : 1;
|
@@ -1273,7 +1273,7 @@ SC.DateTime.mixin(SC.Comparable,
|
|
1273
1273
|
divider = 6048e5; // week: 1000 * 60 * 60 * 24 * 7
|
1274
1274
|
break;
|
1275
1275
|
default:
|
1276
|
-
throw format + " is not supported";
|
1276
|
+
throw new Error(format + " is not supported");
|
1277
1277
|
}
|
1278
1278
|
|
1279
1279
|
var ret = diff/divider;
|
@@ -309,7 +309,7 @@ SC.ObjectCoder = SC.Object.extend({
|
|
309
309
|
begin: function(object) {
|
310
310
|
var methodName = this.get('encodeMethodName');
|
311
311
|
if (SC.typeOf(object[methodName]) !== SC.T_FUNCTION) {
|
312
|
-
throw
|
312
|
+
SC.throw("Cannot encode %@ because it does not respond to %@()".fmt(object, methodName));
|
313
313
|
}
|
314
314
|
|
315
315
|
// save className for later coding
|
@@ -557,7 +557,7 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
557
557
|
@returns {SC.View} receiver
|
558
558
|
*/
|
559
559
|
createChildViews: function () {
|
560
|
-
var scroll, menuView
|
560
|
+
var scroll, menuView;
|
561
561
|
|
562
562
|
// Create the menu items collection view.
|
563
563
|
// TODO: Should this not be an SC.ListView?
|
@@ -1273,3 +1273,32 @@ SC._menu_fetchItem = function (k) {
|
|
1273
1273
|
if (!k) return null;
|
1274
1274
|
return this.get ? this.get(k) : this[k];
|
1275
1275
|
};
|
1276
|
+
|
1277
|
+
|
1278
|
+
/**
|
1279
|
+
Default metrics for the different control sizes.
|
1280
|
+
*/
|
1281
|
+
SC.MenuPane.TINY_MENU_ITEM_HEIGHT = 10;
|
1282
|
+
// SC.MenuPane.TINY_MENU_ITEM_SEPARATOR_HEIGHT = 2;
|
1283
|
+
// SC.MenuPane.TINY_MENU_HEIGHT_PADDING = 2;
|
1284
|
+
// SC.MenuPane.TINY_SUBMENU_OFFSET_X = 0;
|
1285
|
+
|
1286
|
+
SC.MenuPane.SMALL_MENU_ITEM_HEIGHT = 16;
|
1287
|
+
// SC.MenuPane.SMALL_MENU_ITEM_SEPARATOR_HEIGHT = 7;
|
1288
|
+
// SC.MenuPane.SMALL_MENU_HEIGHT_PADDING = 4;
|
1289
|
+
// SC.MenuPane.SMALL_SUBMENU_OFFSET_X = 2;
|
1290
|
+
|
1291
|
+
SC.MenuPane.REGULAR_MENU_ITEM_HEIGHT = 22;
|
1292
|
+
// SC.MenuPane.REGULAR_MENU_ITEM_SEPARATOR_HEIGHT = 9;
|
1293
|
+
// SC.MenuPane.REGULAR_MENU_HEIGHT_PADDING = 6;
|
1294
|
+
// SC.MenuPane.REGULAR_SUBMENU_OFFSET_X = 2;
|
1295
|
+
|
1296
|
+
SC.MenuPane.LARGE_MENU_ITEM_HEIGHT = 31;
|
1297
|
+
// SC.MenuPane.LARGE_MENU_ITEM_SEPARATOR_HEIGHT = 20;
|
1298
|
+
// SC.MenuPane.LARGE_MENU_HEIGHT_PADDING = 0;
|
1299
|
+
// SC.MenuPane.LARGE_SUBMENU_OFFSET_X = 4;
|
1300
|
+
|
1301
|
+
SC.MenuPane.HUGE_MENU_ITEM_HEIGHT = 20;
|
1302
|
+
// SC.MenuPane.HUGE_MENU_ITEM_SEPARATOR_HEIGHT = 9;
|
1303
|
+
// SC.MenuPane.HUGE_MENU_HEIGHT_PADDING = 0;
|
1304
|
+
// SC.MenuPane.HUGE_SUBMENU_OFFSET_X = 0;
|
@@ -309,7 +309,7 @@ SC.PickerPane = SC.PalettePane.extend(
|
|
309
309
|
// Throw an error if a null or empty value is set. You're not allowed to go anchorless.
|
310
310
|
// (TODO: why can't we go anchorless? positionPane happily centers an unmoored pane.)
|
311
311
|
if (!value) {
|
312
|
-
throw
|
312
|
+
SC.throw("You must set 'anchorElement' to either a view or a DOM element");
|
313
313
|
}
|
314
314
|
|
315
315
|
// Clean up any previous anchor elements.
|
@@ -641,11 +641,22 @@ SC.PickerPane = SC.PalettePane.extend(
|
|
641
641
|
|
642
642
|
frame = this.fitPositionToScreen(origin, frame, anchor);
|
643
643
|
|
644
|
+
// Create an adjustment layout from the computed position.
|
644
645
|
adjustHash = {
|
645
646
|
left: frame.x,
|
646
647
|
top: frame.y
|
647
648
|
};
|
648
649
|
|
650
|
+
// If the computed position also constrains width or height, add it to the adjustment.
|
651
|
+
/*jshint eqnull:true*/
|
652
|
+
if (frame.width != null) {
|
653
|
+
adjustHash.width = frame.width;
|
654
|
+
}
|
655
|
+
|
656
|
+
if (frame.height != null) {
|
657
|
+
adjustHash.height = frame.height;
|
658
|
+
}
|
659
|
+
|
649
660
|
/*
|
650
661
|
Special case behavior for transitions that include scale or rotate: notably SC.View.SCALE_IN and SC.View.POP_IN.
|
651
662
|
|
@@ -100,7 +100,7 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
100
100
|
},
|
101
101
|
|
102
102
|
/** @private @see SC.ScrollView. When the content view's size changes, we need to update our scroll offset properties. */
|
103
|
-
|
103
|
+
_sc_repositionContentViewUnfiltered: function () {
|
104
104
|
var hasVerticalScroller = this.get('hasVerticalScroller'),
|
105
105
|
// UNUSED. minimumVerticalScrollOffset = this.get('minimumVerticalScrollOffset'),
|
106
106
|
maximumVerticalScrollOffset = this.get('maximumVerticalScrollOffset');
|
@@ -120,6 +120,8 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
120
120
|
this.setIfChanged('isVerticalScrollerVisible', contentHeight > containerHeight);
|
121
121
|
}
|
122
122
|
}
|
123
|
+
|
124
|
+
sc_super();
|
123
125
|
},
|
124
126
|
|
125
127
|
/** @private @see SC.ScrollView. Re-position the scrollers and content depending on the need to scroll or not. */
|
@@ -214,7 +216,7 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
214
216
|
layout: { height: 0 },
|
215
217
|
|
216
218
|
value: this.get('verticalScrollOffset'),
|
217
|
-
valueBinding: '.
|
219
|
+
valueBinding: '.parentView.verticalScrollOffset', // Bind the value of the scroller to our vertical offset.
|
218
220
|
minimum: this.get('minimumVerticalScrollOffset'),
|
219
221
|
maximum: this.get('maximumVerticalScrollOffset')
|
220
222
|
});
|
@@ -242,7 +244,7 @@ SC.MenuScrollView = SC.ScrollView.extend(
|
|
242
244
|
layout: { bottom: 0, height: 0 },
|
243
245
|
|
244
246
|
value: this.get('verticalScrollOffset'),
|
245
|
-
valueBinding: '.
|
247
|
+
valueBinding: '.parentView.verticalScrollOffset', // Bind the value of the scroller to our vertical offset.
|
246
248
|
minimum: this.get('minimumVerticalScrollOffset'),
|
247
249
|
maximum: this.get('maximumVerticalScrollOffset')
|
248
250
|
});
|
@@ -87,12 +87,6 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
|
|
87
87
|
}
|
88
88
|
},
|
89
89
|
|
90
|
-
/** @private */
|
91
|
-
willDestroyLayer: function () {
|
92
|
-
var callback = this._sc_scroller_scrollDidChange;
|
93
|
-
SC.Event.remove(this.$(), 'scroll', this, callback);
|
94
|
-
},
|
95
|
-
|
96
90
|
/** @private */
|
97
91
|
mouseEntered: function (evt) {
|
98
92
|
this.set('isMouseOver', YES);
|
@@ -104,36 +98,6 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
|
|
104
98
|
this.set('isMouseOver', NO);
|
105
99
|
},
|
106
100
|
|
107
|
-
/** @private */
|
108
|
-
_sc_scroller_armScrollTimer: function () {
|
109
|
-
if (!this._sc_scrollTimer) {
|
110
|
-
SC.run(function () {
|
111
|
-
var method = this._sc_scroller_scrollDidChange;
|
112
|
-
this._sc_scrollTimer = this.invokeLater(method, 50);
|
113
|
-
});
|
114
|
-
}
|
115
|
-
},
|
116
|
-
|
117
|
-
/** @private */
|
118
|
-
_sc_scroller_scrollDidChange: function () {
|
119
|
-
var now = Date.now(),
|
120
|
-
last = this._sc_lastScroll,
|
121
|
-
layer = this.get('layer'),
|
122
|
-
scroll = 0;
|
123
|
-
|
124
|
-
if (last && (now - last) < 50) return this._sc_scroller_armScrollTimer();
|
125
|
-
this._sc_scrollTimer = null;
|
126
|
-
this._sc_lastScroll = now;
|
127
|
-
|
128
|
-
SC.run(function () {
|
129
|
-
if (!this.get('isEnabledInPane')) return; // nothing to do.
|
130
|
-
|
131
|
-
this._sc_scrollValue = scroll = layer.scrollTop;
|
132
|
-
this.set('value', scroll); // will now enforce minimum and maximum
|
133
|
-
});
|
134
|
-
},
|
135
|
-
|
136
|
-
|
137
101
|
/** @private
|
138
102
|
Scroll the menu if it is is an up or down arrow. This is called by
|
139
103
|
the function that simulates mouseOver.
|