sproutcore 1.0.1003 → 1.0.1008
Sign up to get free protection for your applications and to get access to all the features.
- data/Buildfile +15 -3
- data/Rakefile +3 -7
- data/VERSION.yml +2 -2
- data/buildtasks/manifest.rake +2 -0
- data/frameworks/sproutcore/Buildfile +2 -0
- data/frameworks/sproutcore/HISTORY +218 -203
- data/frameworks/sproutcore/README +47 -6
- data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +4 -0
- data/frameworks/sproutcore/design/Design Charts.graffle +2945 -4332
- data/frameworks/sproutcore/frameworks/bootstrap/README +9 -0
- data/frameworks/sproutcore/frameworks/bootstrap/core.js +7 -0
- data/frameworks/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +45 -0
- data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +9 -8
- data/frameworks/sproutcore/frameworks/datastore/models/record.js +49 -9
- data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +9 -0
- data/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +3 -2
- data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +81 -8
- data/frameworks/sproutcore/frameworks/datastore/system/query.js +26 -5
- data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +47 -0
- data/frameworks/sproutcore/frameworks/datastore/system/store.js +164 -32
- data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +32 -4
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +15 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +16 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +22 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +32 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +12 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +9 -9
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +8 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +79 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +24 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +2 -0
- data/frameworks/sproutcore/frameworks/debug/core.js +10 -6
- data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +43 -18
- data/frameworks/sproutcore/frameworks/designer/core.js +10 -0
- data/frameworks/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
- data/frameworks/sproutcore/frameworks/designer/{views/mixins → mixins}/button.js +0 -0
- data/frameworks/sproutcore/frameworks/designer/views/{controls/button.js → button.js} +6 -2
- data/frameworks/sproutcore/frameworks/designer/views/designer.js +566 -136
- data/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +77 -0
- data/frameworks/sproutcore/frameworks/desktop/core.js +12 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +1 -1
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +3 -2
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -36
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +14 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +4 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +2 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +0 -4
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +8 -5
- data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -2
- data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +100 -111
- data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +51 -13
- data/frameworks/sproutcore/frameworks/desktop/panes/{drop_down.js → select_button.js} +70 -109
- data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +8 -0
- data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +69 -23
- data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +4 -4
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +2 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/methods.js +15 -11
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/ui.js +22 -22
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +0 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +19 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +53 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +23 -9
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +24 -10
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +50 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +3 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +8 -8
- data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/button.js +5 -3
- data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +4 -3
- data/frameworks/sproutcore/frameworks/desktop/views/collection.js +125 -96
- data/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -0
- data/frameworks/sproutcore/frameworks/desktop/views/list.js +68 -18
- data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +134 -56
- data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +18 -11
- data/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +562 -2
- data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +13 -0
- data/frameworks/sproutcore/frameworks/desktop/views/progress.js +11 -8
- data/frameworks/sproutcore/frameworks/desktop/views/radio.js +7 -7
- data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +99 -33
- data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +3 -7
- data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +0 -7
- data/frameworks/sproutcore/frameworks/desktop/views/separator.js +2 -3
- data/frameworks/sproutcore/frameworks/desktop/views/slider.js +0 -8
- data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/split.js +27 -7
- data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -6
- data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +15 -10
- data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +20 -1
- data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +3 -6
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +3 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +8 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +11 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +13 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -2
- data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +70 -21
- data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +88 -54
- data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +0 -25
- data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +23 -2
- data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +34 -23
- data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +20 -0
- data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +32 -23
- data/frameworks/sproutcore/frameworks/foundation/system/browser.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +77 -15
- data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +5 -4
- data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +22 -7
- data/frameworks/sproutcore/frameworks/foundation/system/request.js +466 -309
- data/frameworks/sproutcore/frameworks/foundation/system/responder.js +2 -1
- data/frameworks/sproutcore/frameworks/foundation/system/response.js +457 -0
- data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +66 -15
- data/frameworks/sproutcore/frameworks/foundation/system/routes.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/system/timer.js +6 -4
- data/frameworks/sproutcore/frameworks/foundation/system/utils.js +46 -8
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +17 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +18 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +11 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +14 -14
- data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +15 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +8 -7
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +3 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +51 -44
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +2 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +9 -9
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +3 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +14 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -11
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/validators/password.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +4 -2
- data/frameworks/sproutcore/frameworks/foundation/views/field.js +5 -8
- data/frameworks/sproutcore/frameworks/foundation/views/label.js +21 -5
- data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +112 -69
- data/frameworks/sproutcore/frameworks/foundation/views/view.js +67 -6
- data/frameworks/sproutcore/frameworks/runtime/core.js +51 -2
- data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +4 -1
- data/frameworks/sproutcore/frameworks/runtime/system/binding.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +5 -4
- data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -1
- data/frameworks/sproutcore/frameworks/runtime/system/logger.js +408 -0
- data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -4
- data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +30 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +5 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +3 -3
- data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +2 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +2 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +11 -7
- data/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +3 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +18 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +165 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +3 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +13 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +24 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +32 -13
- data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +2 -2
- data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +7 -2
- data/frameworks/sproutcore/lib/index.rhtml +6 -20
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +0 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +5 -4
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +4 -3
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +7 -7
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +38 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +3 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +1 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +0 -15
- data/gen/data-source/Buildfile +18 -0
- data/gen/data-source/README +1 -0
- data/gen/data-source/USAGE +15 -0
- data/gen/data-source/templates/data_sources/@filename@.js +64 -0
- data/lib/sproutcore/builders/combine.rb +23 -0
- data/lib/sproutcore/builders/javascript.rb +27 -2
- data/lib/sproutcore/buildfile/task.rb +1 -1
- data/lib/sproutcore/helpers/entry_sorter.rb +2 -2
- data/lib/sproutcore/helpers/static_helper.rb +79 -0
- data/lib/sproutcore/models/manifest.rb +2 -2
- data/lib/sproutcore/models/target.rb +1 -1
- data/lib/sproutcore/tools/build.rb +1 -1
- data/lib/sproutcore/tools/docs.rb +3 -3
- data/lib/sproutcore/tools/gen.rb +17 -15
- data/lib/sproutcore/tools/manifest.rb +9 -9
- data/lib/sproutcore/tools/server.rb +3 -3
- data/lib/sproutcore/tools.rb +259 -250
- data/lib/sproutcore.rb +9 -1
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +2 -2
- data/spec/fixtures/entry_for_project/frameworks/unrelated/PLACEHOLDER +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/{lproj → english.lproj}/strings.js +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/main.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/resources/main_page.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/t.js +1 -0
- data/spec/lib/models/manifest/find_entry.rb +12 -0
- data/spec/lib/tools/gen_spec.rb +1 -0
- data/spec/lib/tools/tools_spec.rb +1 -0
- data/sproutcore-abbot.gemspec +36 -44
- metadata +43 -44
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/views/form.js +0 -594
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
- data/lib/thor/CHANGELOG.rdoc +0 -52
- data/lib/thor/LICENSE +0 -20
- data/lib/thor/README.markdown +0 -76
- data/lib/thor/Rakefile +0 -6
- data/lib/thor/Thorfile +0 -45
- data/lib/thor/bin/rake2thor +0 -83
- data/lib/thor/bin/thor +0 -7
- data/lib/thor/lib/thor/error.rb +0 -3
- data/lib/thor/lib/thor/options.rb +0 -267
- data/lib/thor/lib/thor/ordered_hash.rb +0 -64
- data/lib/thor/lib/thor/runner.rb +0 -305
- data/lib/thor/lib/thor/task.rb +0 -83
- data/lib/thor/lib/thor/task_hash.rb +0 -22
- data/lib/thor/lib/thor/tasks/package.rb +0 -18
- data/lib/thor/lib/thor/tasks.rb +0 -77
- data/lib/thor/lib/thor/util.rb +0 -75
- data/lib/thor/lib/thor.rb +0 -170
- data/lib/thor/script/destroy +0 -14
- data/lib/thor/script/generate +0 -14
- data/lib/thor/spec/fixtures/task.thor +0 -10
- data/lib/thor/spec/options_spec.rb +0 -271
- data/lib/thor/spec/ordered_hash_spec.rb +0 -84
- data/lib/thor/spec/spec.opts +0 -1
- data/lib/thor/spec/spec_helper.rb +0 -30
- data/lib/thor/spec/task_spec.rb +0 -11
- data/lib/thor/spec/tasks_spec.rb +0 -28
- data/lib/thor/spec/thor_runner_spec.rb +0 -194
- data/lib/thor/spec/thor_spec.rb +0 -206
- data/lib/thor/spec/util_spec.rb +0 -99
- data/lib/thor/task.thor +0 -15
- data/lib/thor/thor.gemspec +0 -29
@@ -95,6 +95,8 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
95
95
|
accessory view wider, with empty space on the left.
|
96
96
|
*/
|
97
97
|
rightAccessoryView: null,
|
98
|
+
|
99
|
+
_isFocused: NO,
|
98
100
|
|
99
101
|
|
100
102
|
/** isEditable maps to isEnabled with a TextField. */
|
@@ -115,12 +117,14 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
115
117
|
*/
|
116
118
|
selection: function(key, value) {
|
117
119
|
var element = this.$input().get(0) ;
|
120
|
+
var range, start, end;
|
118
121
|
|
119
122
|
// Are we being asked to set the value, or return the current value?
|
120
123
|
if (value === undefined) {
|
121
124
|
// The client is retrieving the value.
|
122
125
|
if (element) {
|
123
|
-
|
126
|
+
start = null;
|
127
|
+
end = null;
|
124
128
|
|
125
129
|
if (!element.value) {
|
126
130
|
start = end = 0 ;
|
@@ -140,7 +144,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
140
144
|
if (selection) {
|
141
145
|
var type = selection.type ;
|
142
146
|
if (type && (type === 'None' || type === 'Text')) {
|
143
|
-
|
147
|
+
range = selection.createRange() ;
|
144
148
|
|
145
149
|
if (!this.get('isTextArea')) {
|
146
150
|
// Input tag support. Figure out the starting position by
|
@@ -194,8 +198,8 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
194
198
|
|
195
199
|
// Support Internet Explorer.
|
196
200
|
if (!setStart || !setEnd) {
|
197
|
-
|
198
|
-
|
201
|
+
range = element.createTextRange() ;
|
202
|
+
start = value.get('start') ;
|
199
203
|
range.move('character', start) ;
|
200
204
|
range.moveEnd('character', value.get('end') - start) ;
|
201
205
|
range.select() ;
|
@@ -334,15 +338,29 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
334
338
|
if (rightAdjustment) rightAdjustment += 'px' ;
|
335
339
|
|
336
340
|
this._renderField(context, firstTime, v, leftAdjustment, rightAdjustment) ;
|
341
|
+
if(SC.browser.mozilla) this.invokeLast(this._applyFirefoxCursorFix);
|
337
342
|
},
|
338
343
|
|
344
|
+
|
345
|
+
/**
|
346
|
+
If isTextArea is changed (this might happen in inlineeditor constantly)
|
347
|
+
force the field render to render like the firsttime to avoid writing extra
|
348
|
+
code. This can be useful also
|
349
|
+
*/
|
350
|
+
_forceRenderFirstTime: NO,
|
351
|
+
|
352
|
+
_renderFieldLikeFirstTime: function(){
|
353
|
+
this.set('_forceRenderFirstTime', YES);
|
354
|
+
}.observes('isTextArea'),
|
355
|
+
|
339
356
|
_renderField: function(context, firstTime, value, leftAdjustment, rightAdjustment) {
|
340
357
|
// TODO: The cleanest thing might be to create a sub- rendering context
|
341
358
|
// here, but currently SC.RenderContext will render sibling
|
342
359
|
// contexts as parent/child.
|
343
360
|
var hint = this.get('hint') ;
|
344
361
|
|
345
|
-
if (firstTime) {
|
362
|
+
if (firstTime || this._forceRenderFirstTime) {
|
363
|
+
this._forceRenderFirstTime = NO;
|
346
364
|
var disabled = this.get('isEnabled') ? '' : 'disabled="disabled"' ;
|
347
365
|
var name = SC.guidFor(this) ;
|
348
366
|
|
@@ -364,7 +382,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
364
382
|
|
365
383
|
// Render the input/textarea field itself, and close off the padding.
|
366
384
|
if (this.get('isTextArea')) {
|
367
|
-
context.push('<textarea name="%@"
|
385
|
+
context.push('<textarea name="%@" %@>%@</textarea></span>'.fmt(name, disabled, value)) ;
|
368
386
|
}
|
369
387
|
else {
|
370
388
|
var type = this.get('isPassword') ? 'password' : 'text' ;
|
@@ -415,9 +433,11 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
415
433
|
// Firefox needs a bit of help to recalculate the width of the text
|
416
434
|
// field, if it has focus. (Even though it's set to 100% of its
|
417
435
|
// parent, if we adjust the parent it doesn't always adjust in kind.)
|
418
|
-
if (SC.browser.mozilla) {
|
419
|
-
|
420
|
-
|
436
|
+
// if (SC.browser.mozilla) {
|
437
|
+
// if(paddingElement.clientWidth>0){
|
438
|
+
// element.style.width = paddingElement.clientWidth + "px";
|
439
|
+
// }
|
440
|
+
// }
|
421
441
|
}
|
422
442
|
}
|
423
443
|
},
|
@@ -465,6 +485,12 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
465
485
|
// our key/mouse down/up handlers (such as the user choosing Select All
|
466
486
|
// from a menu).
|
467
487
|
SC.Event.add(input, 'select', this, this._textField_selectionDidChange);
|
488
|
+
|
489
|
+
if(SC.browser.mozilla){
|
490
|
+
// cache references to layer items to improve firefox hack perf
|
491
|
+
this._cacheInputElement = this.$input();
|
492
|
+
this._cachePaddingElement = this.$('.padding');
|
493
|
+
}
|
468
494
|
},
|
469
495
|
|
470
496
|
willDestroyLayer: function() {
|
@@ -487,48 +513,61 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
487
513
|
this.fieldDidBlur();
|
488
514
|
SC.RunLoop.end();
|
489
515
|
},
|
490
|
-
|
516
|
+
|
491
517
|
fieldDidFocus: function(evt) {
|
492
|
-
|
493
|
-
this._isFocused = YES ;
|
494
|
-
this.beginEditing();
|
495
|
-
}
|
518
|
+
this.beginEditing();
|
496
519
|
},
|
497
|
-
|
520
|
+
|
498
521
|
fieldDidBlur: function() {
|
499
|
-
|
500
|
-
this._isFocused = NO ;
|
501
|
-
this.commitEditing();
|
502
|
-
//}
|
522
|
+
this.commitEditing();
|
503
523
|
},
|
504
524
|
|
525
|
+
/**
|
526
|
+
Move magic number out so it can be over-written later in inline editor
|
527
|
+
*/
|
528
|
+
_topOffsetForFirefoxCursorFix: 3,
|
529
|
+
|
505
530
|
_applyFirefoxCursorFix: function() {
|
506
|
-
|
507
|
-
if
|
531
|
+
// Be extremely careful changing this code. !!!!!!!!
|
532
|
+
// Contact me if you need to change or improve the code. After several
|
533
|
+
// iterations the new way to apply the fix seems to be the most
|
534
|
+
// consistent.
|
535
|
+
// This fixes: selection visibility, cursor visibility, and the ability
|
536
|
+
// to fix the cursor at any position. As of FF 3.5.3 mozilla hasn't fixed this
|
537
|
+
// bug, even though related bugs that I've found on their database appear
|
538
|
+
// as fixed.
|
539
|
+
//
|
540
|
+
// Juan Pinzon
|
541
|
+
|
508
542
|
if (SC.browser.mozilla) {
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
543
|
+
var top, left, width, height, p, layer, element, textfield;
|
544
|
+
|
545
|
+
// I'm caching in didCreateLayer this elements to improve perf
|
546
|
+
element = this._cacheInputElement;
|
547
|
+
textfield = this._cachePaddingElement;
|
548
|
+
if(textfield && textfield[0]){
|
549
|
+
layer = textfield[0];
|
550
|
+
p = SC.$(layer).offset() ;
|
551
|
+
|
552
|
+
// this is to take into account an styling issue.
|
553
|
+
if(element[0].tagName.toLowerCase()==="input") {
|
554
|
+
top = p.top+this._topOffsetForFirefoxCursorFix;
|
555
|
+
}
|
556
|
+
else top = p.top;
|
557
|
+
left = p.left;
|
558
|
+
width = layer.offsetWidth;
|
559
|
+
height = layer.offsetHeight ;
|
560
|
+
|
561
|
+
var style = 'position: fixed; top: %@px; left: %@px; width: %@px; height: %@px;'.fmt(top, left, width, height) ;
|
562
|
+
// if the style is the same don't re-apply
|
563
|
+
if(!this._prevStyle || this._prevStyle!=style) element.attr('style', style) ;
|
564
|
+
this._prevStyle = style;
|
565
|
+
}
|
521
566
|
}
|
522
567
|
return this ;
|
523
568
|
},
|
524
|
-
|
525
|
-
|
526
|
-
if (!this._hasFirefoxCursorFix) return this;
|
527
|
-
this._hasFirefoxCursorFix = NO ;
|
528
|
-
if (SC.browser.mozilla) this.$input().attr('style', '') ;
|
529
|
-
return this ;
|
530
|
-
},
|
531
|
-
|
569
|
+
|
570
|
+
|
532
571
|
_textField_selectionDidChange: function() {
|
533
572
|
this.notifyPropertyChange('selection');
|
534
573
|
},
|
@@ -544,21 +583,20 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
544
583
|
// hide the hint text.
|
545
584
|
/** @private */
|
546
585
|
willBecomeKeyResponderFrom: function(keyView) {
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
this.
|
551
|
-
|
552
|
-
|
553
|
-
this.
|
554
|
-
|
555
|
-
if(!this._txtFieldMouseDown){
|
556
|
-
if(!SC.browser.safari) this.invokeOnce(this._selectRootElement) ;
|
557
|
-
else this.invokeLater(this._selectRootElement, 1) ;
|
558
|
-
}
|
586
|
+
if(this.get('isVisibleInWindow')) {
|
587
|
+
this.$input()[0].focus();
|
588
|
+
|
589
|
+
if(!this._txtFieldMouseDown){
|
590
|
+
if(SC.browser.mozilla) this.invokeOnce(this._selectRootElement) ;
|
591
|
+
else if(SC.browser.safari) this.invokeLater(this._selectRootElement, 1) ;
|
592
|
+
else this._selectRootElement();
|
559
593
|
}
|
560
594
|
}
|
561
595
|
},
|
596
|
+
|
597
|
+
willLoseKeyResponderTo: function(responder) {
|
598
|
+
//if (this._isFocused) this._isFocused = NO ;
|
599
|
+
},
|
562
600
|
|
563
601
|
// In IE, you can't modify functions on DOM elements so we need to wrap the
|
564
602
|
// call to select() like this.
|
@@ -570,44 +608,39 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
570
608
|
// the hint text if needed.
|
571
609
|
/** @private */
|
572
610
|
didLoseKeyResponderTo: function(keyView) {
|
573
|
-
|
574
|
-
this._isFocused = NO ;
|
575
|
-
this.$input()[0].blur() ;
|
576
|
-
} else {
|
577
|
-
this.fieldValueDidChange() ;
|
578
|
-
}
|
579
|
-
if(this._hasFirefoxCursorFix) this._removeFirefoxCursorFix();
|
611
|
+
this.$input()[0].blur() ;
|
580
612
|
},
|
581
613
|
|
582
614
|
parentViewDidResize: function() {
|
583
|
-
if (SC.browser.mozilla
|
584
|
-
this.
|
585
|
-
if (this._applyTimer) this._applyTimer.invalidate();
|
586
|
-
this._applyTimer = this.invokeLater(this._applyFirefoxCursorFix, 250);
|
615
|
+
if (SC.browser.mozilla) {
|
616
|
+
this.invokeLast(this._applyFirefoxCursorFix);
|
587
617
|
}
|
588
|
-
|
589
618
|
sc_super();
|
590
619
|
},
|
591
620
|
|
592
|
-
_isFocused: false,
|
593
621
|
|
594
622
|
/** @private
|
595
623
|
Simply allow keyDown & keyUp to pass through to the default web browser
|
596
624
|
implementation.
|
597
625
|
*/
|
598
626
|
keyDown: function(evt) {
|
599
|
-
|
600
627
|
// handle return and escape. this way they can be passed on to the
|
601
628
|
// responder chain.
|
602
629
|
if ((evt.which === 13) && !this.get('isTextArea')) return NO ;
|
603
630
|
if (evt.which === 27) return NO ;
|
604
631
|
|
605
632
|
// handle tab key
|
606
|
-
if (evt.which === 9 && !this.get('
|
633
|
+
if (evt.which === 9 && !this.get('isTextArea')) {
|
607
634
|
var view = evt.shiftKey ? this.get('previousValidKeyView') : this.get('nextValidKeyView');
|
608
635
|
view.becomeFirstResponder();
|
609
636
|
return YES ; // handled
|
610
637
|
}
|
638
|
+
|
639
|
+
// handle delete key, set dontForceDeleteKey to allow the default behavior
|
640
|
+
// of the delete key.
|
641
|
+
if (evt.which === 8){
|
642
|
+
evt.dontForceDeleteKey=YES;
|
643
|
+
}
|
611
644
|
|
612
645
|
// validate keyDown...
|
613
646
|
if (this.performValidateKeyDown(evt)) {
|
@@ -621,6 +654,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
621
654
|
},
|
622
655
|
|
623
656
|
keyUp: function(evt) {
|
657
|
+
|
624
658
|
// The caret/selection could have moved. In some browsers, though, the
|
625
659
|
// element's values won't be updated until after this event is finished
|
626
660
|
// processing.
|
@@ -640,7 +674,13 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
640
674
|
if (!this.get('isEnabled')) {
|
641
675
|
evt.stop();
|
642
676
|
return YES;
|
643
|
-
} else
|
677
|
+
} else if((this.value && this.value.length===0) || !this.value) {
|
678
|
+
return YES;
|
679
|
+
} else {
|
680
|
+
// This fixes the double click issue in firefox
|
681
|
+
if(SC.browser.mozilla) this.$input()[0].focus();
|
682
|
+
return sc_super();
|
683
|
+
}
|
644
684
|
},
|
645
685
|
|
646
686
|
mouseUp: function(evt) {
|
@@ -653,6 +693,9 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
653
693
|
if (!this.get('isEnabled')) {
|
654
694
|
evt.stop();
|
655
695
|
return YES;
|
696
|
+
} else if((this.value && this.value.length===0) || !this.value) {
|
697
|
+
this.$input()[0].focus();
|
698
|
+
return YES;
|
656
699
|
} else return sc_super();
|
657
700
|
},
|
658
701
|
|
@@ -482,9 +482,37 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
482
482
|
this.set('layerLocationNeedsUpdate', YES) ;
|
483
483
|
this.invokeOnce(this.updateLayerLocationIfNeeded) ;
|
484
484
|
|
485
|
+
// We also need to iterate down through the view hierarchy and invalidate
|
486
|
+
// all our child view's caches for 'pane', since it could have changed.
|
487
|
+
//
|
488
|
+
// Note: In theory we could try to avoid this invalidation if we
|
489
|
+
// do this only in cases where we "know" the 'pane' value might
|
490
|
+
// have changed, but those cases are few and far between.
|
491
|
+
|
492
|
+
this._invalidatePaneCacheForSelfAndAllChildViews();
|
493
|
+
|
485
494
|
return this ;
|
486
495
|
}.observes('isVisible'),
|
487
496
|
|
497
|
+
/** @private
|
498
|
+
We want to cache the 'pane' property, but it's impossible for us to
|
499
|
+
declare a dependence on all properties that can affect the value. (For
|
500
|
+
example, if our grandparent gets attached to a new pane, our pane will
|
501
|
+
have changed.) So when there's the potential for the pane changing, we
|
502
|
+
need to invalidate the caches for all our child views, and their child
|
503
|
+
views, and so on.
|
504
|
+
*/
|
505
|
+
_invalidatePaneCacheForSelfAndAllChildViews: function () {
|
506
|
+
this.notifyPropertyChange('pane');
|
507
|
+
|
508
|
+
var childViews = this.get('childViews');
|
509
|
+
var len = childViews.length ;
|
510
|
+
for (var idx=0; idx<len; ++idx) {
|
511
|
+
var childView = childViews[idx];
|
512
|
+
if (childView._invalidatePaneCacheForSelfAndAllChildViews) childView._invalidatePaneCacheForSelfAndAllChildViews();
|
513
|
+
}
|
514
|
+
},
|
515
|
+
|
488
516
|
// ..........................................................
|
489
517
|
// LAYER SUPPORT
|
490
518
|
//
|
@@ -599,7 +627,7 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
599
627
|
while(q.length!==0){
|
600
628
|
node=q[0];
|
601
629
|
q.shift();
|
602
|
-
if(node.id
|
630
|
+
if(node.id===layerId){
|
603
631
|
found=true;
|
604
632
|
elem=node;
|
605
633
|
break;
|
@@ -1142,7 +1170,7 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
1142
1170
|
@returns {Object} object that handled event, if any
|
1143
1171
|
*/
|
1144
1172
|
interpretKeyEvents: function(event) {
|
1145
|
-
var codes = event.commandCodes(), cmd = codes[0], chr = codes[1];
|
1173
|
+
var codes = event.commandCodes(), cmd = codes[0], chr = codes[1], ret;
|
1146
1174
|
|
1147
1175
|
if (!cmd && !chr) return null ; //nothing to do.
|
1148
1176
|
|
@@ -1162,7 +1190,8 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
1162
1190
|
// if we haven't returned yet and there is plain text, then do an insert
|
1163
1191
|
// of the text. Since this is not an action, do not send it up the
|
1164
1192
|
// responder chain.
|
1165
|
-
|
1193
|
+
ret = this.insertText(chr, event);
|
1194
|
+
return ret ? (ret===YES ? this : ret) : null ; // map YES|NO => this|nil
|
1166
1195
|
}
|
1167
1196
|
|
1168
1197
|
return null ; //nothing to do.
|
@@ -1175,7 +1204,7 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
1175
1204
|
@returns {Object} receiver or object that handled event
|
1176
1205
|
*/
|
1177
1206
|
insertText: function(chr) {
|
1178
|
-
return
|
1207
|
+
return NO ;
|
1179
1208
|
},
|
1180
1209
|
|
1181
1210
|
/**
|
@@ -1320,8 +1349,10 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
1320
1349
|
SC.View.views[this.get('layerId')] = this ;
|
1321
1350
|
}
|
1322
1351
|
|
1352
|
+
var childViews = this.get('childViews');
|
1353
|
+
|
1323
1354
|
// setup child views. be sure to clone the child views array first
|
1324
|
-
this.childViews =
|
1355
|
+
this.childViews = childViews ? childViews.slice() : [] ;
|
1325
1356
|
this.createChildViews() ; // setup child Views
|
1326
1357
|
|
1327
1358
|
// register display property observers ..
|
@@ -1598,6 +1629,10 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
1598
1629
|
convertFrameToView: function(frame, targetView) {
|
1599
1630
|
var myX=0, myY=0, targetX=0, targetY=0, view = this, f ;
|
1600
1631
|
|
1632
|
+
if (this.get('useStaticLayout')) {
|
1633
|
+
throw "convertFrameToView is not available with static layout";
|
1634
|
+
}
|
1635
|
+
|
1601
1636
|
// walk up this side
|
1602
1637
|
while (view) {
|
1603
1638
|
f = view.get('frame'); myX += f.x; myY += f.y ;
|
@@ -1640,6 +1675,10 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
1640
1675
|
convertFrameFromView: function(frame, targetView) {
|
1641
1676
|
var myX=0, myY=0, targetX=0, targetY=0, view = this, next, f ;
|
1642
1677
|
|
1678
|
+
if (this.get('useStaticLayout')) {
|
1679
|
+
throw "convertFrameToView is not available with static layout";
|
1680
|
+
}
|
1681
|
+
|
1643
1682
|
// walk up this side
|
1644
1683
|
while (view) {
|
1645
1684
|
f = view.get('frame'); myX += f.x; myY += f.y ;
|
@@ -1661,6 +1700,26 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
1661
1700
|
return { x: myX, y: myY, width: frame.width, height: frame.height } ;
|
1662
1701
|
},
|
1663
1702
|
|
1703
|
+
/**
|
1704
|
+
Attempt to scroll the view to visible. This will walk up the parent
|
1705
|
+
view hierarchy looking looking for a scrollable view. It will then
|
1706
|
+
call scrollToVisible() on it.
|
1707
|
+
|
1708
|
+
Returns YES if an actual scroll took place, no otherwise.
|
1709
|
+
|
1710
|
+
@returns {Boolean}
|
1711
|
+
*/
|
1712
|
+
scrollToVisible: function() {
|
1713
|
+
var pv = this.get('parentView');
|
1714
|
+
while(pv && !pv.get('isScrollable')) pv = pv.get('parentView');
|
1715
|
+
|
1716
|
+
// found view, first make it scroll itself visible then scroll this.
|
1717
|
+
if (pv) {
|
1718
|
+
pv.scrollToVisible();
|
1719
|
+
return pv.scrollToVisible(this);
|
1720
|
+
} else return NO ;
|
1721
|
+
},
|
1722
|
+
|
1664
1723
|
/**
|
1665
1724
|
Frame describes the current bounding rect for your view. This is always
|
1666
1725
|
measured from the top-left corner of the parent view.
|
@@ -1670,7 +1729,7 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
1670
1729
|
*/
|
1671
1730
|
frame: function() {
|
1672
1731
|
return this.computeFrameWithParentFrame(null) ;
|
1673
|
-
}.property('layout').cacheable(),
|
1732
|
+
}.property('layout', 'useStaticLayout').cacheable(),
|
1674
1733
|
|
1675
1734
|
/**
|
1676
1735
|
Computes what the frame of this view would be if the parent were resized
|
@@ -1708,6 +1767,8 @@ SC.View = SC.Responder.extend(SC.DelegateSupport,
|
|
1708
1767
|
throw error ;
|
1709
1768
|
}
|
1710
1769
|
|
1770
|
+
if (stLayout) return null; // can't compute
|
1771
|
+
|
1711
1772
|
// handle left aligned and left/right
|
1712
1773
|
if (!SC.none(layout.left)) {
|
1713
1774
|
f.x = Math.floor(layout.left) ;
|
@@ -86,7 +86,6 @@ SC.mixin = function() {
|
|
86
86
|
if (!(options = arguments[idx])) continue ;
|
87
87
|
for(var key in options) {
|
88
88
|
if (!options.hasOwnProperty(key)) continue ;
|
89
|
-
var src = target[key];
|
90
89
|
var copy = options[key] ;
|
91
90
|
if (target===copy) continue ; // prevent never-ending loop
|
92
91
|
if (copy !== undefined) target[key] = copy ;
|
@@ -96,6 +95,45 @@ SC.mixin = function() {
|
|
96
95
|
return target;
|
97
96
|
} ;
|
98
97
|
|
98
|
+
/**
|
99
|
+
Adds properties to a target object. Unlike SC.mixin, however, if the target
|
100
|
+
already has a value for a property, it will not be overwritten.
|
101
|
+
|
102
|
+
Takes the root object and adds the attributes for any additional
|
103
|
+
arguments passed.
|
104
|
+
|
105
|
+
@param target {Object} the target object to extend
|
106
|
+
@param properties {Object} one or more objects with properties to copy.
|
107
|
+
@returns {Object} the target object.
|
108
|
+
@static
|
109
|
+
*/
|
110
|
+
SC.supplement = function() {
|
111
|
+
// copy reference to target object
|
112
|
+
var target = arguments[0] || {};
|
113
|
+
var idx = 1;
|
114
|
+
var length = arguments.length ;
|
115
|
+
var options ;
|
116
|
+
|
117
|
+
// Handle case where we have only one item...extend SC
|
118
|
+
if (length === 1) {
|
119
|
+
target = this || {};
|
120
|
+
idx=0;
|
121
|
+
}
|
122
|
+
|
123
|
+
for ( ; idx < length; idx++ ) {
|
124
|
+
if (!(options = arguments[idx])) continue ;
|
125
|
+
for(var key in options) {
|
126
|
+
if (!options.hasOwnProperty(key)) continue ;
|
127
|
+
var src = target[key] ;
|
128
|
+
var copy = options[key] ;
|
129
|
+
if (target===copy) continue ; // prevent never-ending loop
|
130
|
+
if (copy !== undefined && src === undefined) target[key] = copy ;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
return target;
|
135
|
+
} ;
|
136
|
+
|
99
137
|
/**
|
100
138
|
Alternative to mixin. Provided for compatibility with jQuery.
|
101
139
|
@function
|
@@ -178,13 +216,24 @@ SC.mixin(/** @scope SC */ {
|
|
178
216
|
from JSLint complaining about use of ==, which can be technically
|
179
217
|
confusing.
|
180
218
|
|
181
|
-
@
|
219
|
+
@param {Object} obj value to test
|
182
220
|
@returns {Boolean}
|
183
221
|
*/
|
184
222
|
none: function(obj) {
|
185
223
|
return obj===null || obj===undefined;
|
186
224
|
},
|
187
225
|
|
226
|
+
/**
|
227
|
+
Verifies that a value is either null or an empty string. Return false if
|
228
|
+
the object is not a string.
|
229
|
+
|
230
|
+
@param {Object} obj value to test
|
231
|
+
@returns {Boolean}
|
232
|
+
*/
|
233
|
+
empty: function(obj) {
|
234
|
+
return obj===null || obj===undefined || obj==='';
|
235
|
+
},
|
236
|
+
|
188
237
|
/**
|
189
238
|
Returns YES if the passed object is an array or array-like. Instances
|
190
239
|
of the NodeList class return NO.
|
@@ -1122,7 +1122,10 @@ SC.Observable = {
|
|
1122
1122
|
if (seenRevisions[key] != currentRevision) {
|
1123
1123
|
// yes, check the value with the last seen value
|
1124
1124
|
var value = this.get(key) ;
|
1125
|
-
if (seenValues[key] !== value)
|
1125
|
+
if (seenValues[key] !== value) {
|
1126
|
+
ret = true ; // did change!
|
1127
|
+
seenValues[key] = value;
|
1128
|
+
}
|
1126
1129
|
}
|
1127
1130
|
seenRevisions[key] = currentRevision;
|
1128
1131
|
}
|
@@ -928,7 +928,8 @@ SC.Binding = {
|
|
928
928
|
|
929
929
|
var to = this._toRoot ? "<%@>:%@".fmt(this._toRoot,this._toPropertyPath) : this._toPropertyPath;
|
930
930
|
|
931
|
-
|
931
|
+
var oneWay = this._oneWay ? '[oneWay]' : '';
|
932
|
+
return "SC.Binding%@(%@ -> %@)%@".fmt(SC.guidFor(this), from, to, oneWay);
|
932
933
|
}
|
933
934
|
} ;
|
934
935
|
|
@@ -58,8 +58,8 @@ SC.Enumerator.prototype = {
|
|
58
58
|
reset: function() {
|
59
59
|
var e = this.enumerable ;
|
60
60
|
if (!e) throw SC.$error("Enumerator has been destroyed");
|
61
|
-
|
62
|
-
var len = this._length
|
61
|
+
this._length = e.get ? e.get('length') : e.length ;
|
62
|
+
var len = this._length;
|
63
63
|
this._index = 0;
|
64
64
|
this._previousObject = null ;
|
65
65
|
this._context = (len > 0) ? SC.Enumerator._popContext() : null;
|
@@ -94,12 +94,13 @@ SC.Enumerator.create = function(enumerableObject) {
|
|
94
94
|
// objects.
|
95
95
|
|
96
96
|
SC.Enumerator._popContext = function() {
|
97
|
-
var ret =
|
97
|
+
var ret = this._contextCache ? this._contextCache.pop() : null ;
|
98
98
|
return ret || {} ;
|
99
99
|
} ;
|
100
100
|
|
101
101
|
SC.Enumerator._pushContext = function(context) {
|
102
|
-
|
102
|
+
this._contextCache = this._contextCache || [] ;
|
103
|
+
var cache = this._contextCache;
|
103
104
|
cache.push(context);
|
104
105
|
return null ;
|
105
106
|
};
|
@@ -439,6 +439,9 @@ SC.IndexSet = SC.mixin({},
|
|
439
439
|
}
|
440
440
|
} else if (length === null) length = 1 ;
|
441
441
|
|
442
|
+
// if no length - do nothing.
|
443
|
+
if (length <= 0) return this;
|
444
|
+
|
442
445
|
// special case - appending to end of set
|
443
446
|
var max = this.get('max'),
|
444
447
|
oldmax = max,
|
@@ -513,7 +516,7 @@ SC.IndexSet = SC.mixin({},
|
|
513
516
|
} else {
|
514
517
|
start = cur ;
|
515
518
|
if (next > max) {
|
516
|
-
delta -= next - max ;
|
519
|
+
// delta -= next - max ;
|
517
520
|
max = next ;
|
518
521
|
}
|
519
522
|
}
|
@@ -599,6 +602,8 @@ SC.IndexSet = SC.mixin({},
|
|
599
602
|
}
|
600
603
|
}
|
601
604
|
|
605
|
+
if (length <= 0) return this; // nothing to do
|
606
|
+
|
602
607
|
// special case - appending to end of set
|
603
608
|
var max = this.get('max'),
|
604
609
|
oldmax = max,
|