sproutcore 1.10.3.1 → 1.11.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG +4 -8
- data/VERSION.yml +2 -2
- data/lib/frameworks/sproutcore/Buildfile +5 -4
- data/lib/frameworks/sproutcore/CHANGELOG.md +274 -40
- data/lib/frameworks/sproutcore/CONTRIBUTORS.md +133 -0
- data/lib/frameworks/sproutcore/README.md +31 -144
- data/lib/frameworks/sproutcore/apps/showcase/controllers/source_tree_controller.js +9 -4
- data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +5 -0
- data/lib/frameworks/sproutcore/apps/showcase/system/views_item_content.js +1 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/split_views.js +15 -2
- data/lib/frameworks/sproutcore/apps/showcase/views/stacked_views.js +1 -1
- data/lib/frameworks/sproutcore/apps/tests/english.lproj/main_page.js +11 -1
- data/lib/frameworks/sproutcore/frameworks/ajax/mixins/websocket_delegate.js +90 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +81 -5
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +23 -4
- data/lib/frameworks/sproutcore/frameworks/ajax/system/websocket.js +475 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +149 -26
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/websocket.js +197 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/xhr_response_test.js +65 -0
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/horizontal_stack_layout.js +232 -52
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/vertical_stack_layout.js +235 -49
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +23 -13
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +81 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/english.lproj/ordinal.js +17 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/string.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/{desktop/tests/views/disclosure/methods.js → core_foundation/french.lproj/ordinal.js} +7 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +2 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +104 -69
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +6 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/child_view_layout_protocol.js +59 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/view_transition_protocol.js +18 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +192 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/bezier_curves.js +52 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +384 -64
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/core_query.js +6 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +21 -35
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +72 -36
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +90 -34
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +55 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +20 -15
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/req_anim_frame.js +9 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +763 -542
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +1 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/touch.js +538 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils/rect.js +56 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +99 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_case.js +25 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/core_tests.js +75 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/ext/number_test.js +81 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/action_support.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/responder_context.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +19 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/color.js +36 -20
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/design_modes_test.js +83 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/makeMainPane.js +7 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/mouse_events.js +338 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/root_responder.js +14 -89
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/touch.js +106 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/touch.js +136 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/rect.js +42 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/design_mode_test.js +457 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/sendEvent.js +36 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/background_color.js +44 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/border_frame_test.js +51 -24
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/childViewLayout_test.js +176 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +46 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertFrames.js +69 -15
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +30 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +376 -71
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +0 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +117 -34
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view_states_test.js +52 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +656 -42
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +159 -38
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +0 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/design_mode.js +206 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +0 -28
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +21 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +372 -450
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +28 -13
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +22 -51
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +59 -30
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +0 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +22 -10
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +42 -36
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +54 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +178 -59
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +206 -132
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +214 -118
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +96 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +14 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +82 -42
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +272 -177
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/store_interaction_test.js +54 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/datetime_recordattribute.js +24 -16
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/data_store.js +267 -35
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +57 -46
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +150 -53
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +57 -17
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +13 -9
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/polymorphism → datastore}/tests/models/polymorphism/many.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/polymorphism → datastore}/tests/models/polymorphism/simple.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/polymorphism → datastore}/tests/models/polymorphism/single.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +20 -15
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/many_array/core_methods.js +80 -14
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/autonomous_dataSourceCallbacks.js +280 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/autonomous_pushChanges.js +232 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +31 -5
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/parse.js +16 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +60 -40
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/materializeRecord.js +78 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/{resources → english.lproj}/strings.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/french.lproj/strings.js +45 -0
- data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +7 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +125 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +139 -48
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/draggable.js +202 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +59 -56
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +13 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +466 -305
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +49 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +79 -21
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/split.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu_item_view.css +8 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/overlay-scroller.css +187 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +94 -30
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +163 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +97 -78
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +61 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +7 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +47 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +66 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +21 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +12 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +17 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/collection_fast_path.js +54 -21
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/content.js +52 -20
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +94 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/keyboard.js +177 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/layerIdFor.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/length.js +9 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +104 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +48 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/drag_and_drop.js +22 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +17 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/link_view_test.js +136 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/contentIndexesInRect.js +77 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/drag_and_drop.js +53 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/layoutForContentIndex.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowDelegate.js +25 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowOffsetForContentIndex.js +102 -27
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/{rowHeightForContentIndex.js → rowSizeForContentIndex.js} +7 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_outline.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +70 -75
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_simple.js +29 -30
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +57 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_scroll_view/menu_scroll_view_test.js +206 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +15 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/integration.js +16 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +164 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/scale.js +387 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/touch.js +549 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +214 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroller.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +73 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +88 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/methods.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/slider/methods.js +16 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/slider/ui.js +54 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/dividers.js +21 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +31 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +109 -29
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +10 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +779 -603
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +106 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/link_view.js +406 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +437 -245
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +13 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +124 -62
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +176 -597
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroller_view.js +206 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +56 -158
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +2560 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +458 -242
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +117 -54
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +18 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +162 -34
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +30 -15
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +33 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +22 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +47 -22
- data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +0 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +24 -10
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +7 -4
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +7 -9
- data/lib/frameworks/sproutcore/frameworks/{desktop/tests/panes/select_button/methods.js → experimental/frameworks/select_view/tests/views/select/method.js} +54 -76
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +35 -0
- data/lib/frameworks/sproutcore/frameworks/{desktop/tests/panes/select_button → experimental/frameworks/select_view/tests/views/select}/ui.js +107 -36
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +225 -66
- data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +39 -38
- data/lib/frameworks/sproutcore/frameworks/foundation/core.js +5 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +12 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/inflections.js +84 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/french.lproj/inflections.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +3 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +408 -239
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +2 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/spanish.lproj/inflections.js +38 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +104 -76
- data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +20 -94
- data/lib/frameworks/sproutcore/frameworks/foundation/system/text_selection.js +33 -22
- data/lib/frameworks/sproutcore/frameworks/foundation/system/undo_manager.js +475 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +163 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +2 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/methods.js +268 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/undo_manager.js +231 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +16 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +27 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +24 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +135 -6
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/fade_transition.js +6 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/pop_transition.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/scale_transition.js +6 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/slide_transition.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_dissolve_transition.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +65 -15
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +4 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +193 -213
- data/lib/frameworks/sproutcore/frameworks/jquery/{jquery-1.8.3-patched.js → jquery-1.11.1.js} +7507 -6684
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +28 -11
- data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +26 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +54 -25
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +0 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/number.js +36 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/window.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +156 -66
- data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +150 -65
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +57 -11
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +68 -49
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +14 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/system/string.js +23 -23
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/ext/number_test.js +44 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +0 -10
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +340 -285
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +104 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js +14 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/string.js +15 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +21 -18
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +52 -19
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/responder/pane.js +27 -24
- data/lib/frameworks/sproutcore/frameworks/template_view/controls/button.js +30 -0
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/bind.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/collection.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/view.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/mixins/template_helpers/checkbox_support.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/handlebars.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/template_view/views/template_collection.js +16 -14
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +13 -0
- data/lib/frameworks/sproutcore/lib/index.rhtml +2 -2
- data/lib/frameworks/sproutcore/phantomjs/test_runner.js +28 -7
- data/lib/frameworks/sproutcore/scripts/run_sc_server_master.sh +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/_variables.css +2 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/disclosure/ace/disclosure.css +1 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/popover.css +3 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal.css +15 -15
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal_overlay.css +74 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical.css +11 -13
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical_overlay.css +74 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob-active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob-active@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/{22px → jumbo}/slider.css +9 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/track.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/track@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob-active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob-active@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/slider.css +32 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/track.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/track@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/slider.css +13 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob-active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob-active@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/slider.css +32 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/track.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/track@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/split/split.css +2 -3
- data/lib/sproutcore/builders/chance_file.rb +3 -3
- data/lib/sproutcore/helpers/minifier.rb +1 -0
- data/vendor/chance/lib/chance/instance.rb +34 -34
- data/vendor/chance/lib/chance/instance/spriting.rb +21 -16
- metadata +81 -58
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +0 -710
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +0 -267
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/touch-scroller.css +0 -196
- data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +0 -224
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +0 -163
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +0 -177
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +0 -2053
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +0 -1024
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +0 -404
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/render_delegates/menu_scroller.js +0 -28
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/tests/menu/scroll.js +0 -235
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroll.js +0 -363
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroller.js +0 -250
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +0 -47
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +0 -134
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/desktop_scroller.js +0 -92
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/native_scroll.js +0 -25
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/scroll.js +0 -33
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/touch_scroller.js +0 -76
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/integration.js +0 -25
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/methods.js +0 -143
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/ui.js +0 -256
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroll.js +0 -1164
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroller.js +0 -332
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroll.js +0 -236
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroller.js +0 -347
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroll.js +0 -15
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroller.js +0 -10
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroll.js +0 -804
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroller.js +0 -133
- data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +0 -41
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal_touch.css +0 -91
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical_touch.css +0 -92
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/knob_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/slider.css +0 -27
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/knob_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/slider.css +0 -27
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/knob_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/track.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/track.png +0 -0
@@ -246,19 +246,24 @@ SC.routes = SC.Object.create(
|
|
246
246
|
value = crumbs.route + crumbs.params;
|
247
247
|
}
|
248
248
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
if (this.
|
253
|
-
|
254
|
-
|
249
|
+
// Only update the browser if this event triggered from within the app, rather
|
250
|
+
// than from the browser back or forward buttons.
|
251
|
+
if (!this._exogenous) {
|
252
|
+
if (!SC.empty(value) || (this._location && this._location !== value)) {
|
253
|
+
encodedValue = encodeURI(value);
|
254
|
+
|
255
|
+
if (this.usesHistory) {
|
256
|
+
if (encodedValue.length > 0) {
|
257
|
+
encodedValue = '/' + encodedValue;
|
258
|
+
}
|
259
|
+
window.history.pushState(null, null, this.get('baseURI') + encodedValue);
|
260
|
+
} else {
|
261
|
+
window.location.hash = encodedValue;
|
255
262
|
}
|
256
|
-
window.history.pushState(null, null, this.get('baseURI') + encodedValue);
|
257
|
-
} else {
|
258
|
-
window.location.hash = encodedValue;
|
259
263
|
}
|
260
264
|
}
|
261
265
|
|
266
|
+
// Cache locally.
|
262
267
|
this._location = value;
|
263
268
|
}
|
264
269
|
|
@@ -310,6 +315,10 @@ SC.routes = SC.Object.create(
|
|
310
315
|
if it supports the hashchange event, or by our timer if not.
|
311
316
|
*/
|
312
317
|
hashChange: function(event) {
|
318
|
+
// Mark this location change as coming from the browser, which therefore doesn't
|
319
|
+
// need to be updated.
|
320
|
+
this._exogenous = YES;
|
321
|
+
|
313
322
|
var loc = window.location.hash;
|
314
323
|
|
315
324
|
// Remove the '#' prefix
|
@@ -325,10 +334,16 @@ SC.routes = SC.Object.create(
|
|
325
334
|
this.set('location', loc);
|
326
335
|
}, this);
|
327
336
|
}
|
328
|
-
|
337
|
+
|
338
|
+
this._skipRoute = NO;
|
339
|
+
this._exogenous = NO;
|
329
340
|
},
|
330
341
|
|
331
342
|
popState: function(event) {
|
343
|
+
// Mark this location change as coming from the browser, which therefore doesn't
|
344
|
+
// need to be updated.
|
345
|
+
this._exogenous = YES;
|
346
|
+
|
332
347
|
var base = this.get('baseURI'),
|
333
348
|
loc = document.location.href;
|
334
349
|
|
@@ -343,7 +358,9 @@ SC.routes = SC.Object.create(
|
|
343
358
|
}, this);
|
344
359
|
}
|
345
360
|
}
|
346
|
-
|
361
|
+
|
362
|
+
this._skipRoute = NO;
|
363
|
+
this._exogenous = NO;
|
347
364
|
},
|
348
365
|
|
349
366
|
/**
|
@@ -441,3 +441,29 @@ test('deparam outputs object from string', function() {
|
|
441
441
|
{ query: 'test', numItems: 5, size: 'small' },
|
442
442
|
'deparam works with params only string');
|
443
443
|
});
|
444
|
+
|
445
|
+
|
446
|
+
// For this module, we're going to replace the route's inner plumbing with a test
|
447
|
+
// version. Fragile. Apologies.
|
448
|
+
var _extractLocation = SC.routes._extractLocation;
|
449
|
+
module("Browser events", {
|
450
|
+
teardown: function() {
|
451
|
+
// Reset the innards.
|
452
|
+
SC.routes._extractLocation = _extractLocation;
|
453
|
+
}
|
454
|
+
});
|
455
|
+
|
456
|
+
test("Internal flag is properly set for browser events.", function() {
|
457
|
+
var runCount = 0;
|
458
|
+
SC.routes._extractLocation = function() {
|
459
|
+
runCount++;
|
460
|
+
ok(this._exogenous, "Internal flag reflects that location is being updated by the browser.");
|
461
|
+
}
|
462
|
+
|
463
|
+
SC.routes.hashChange();
|
464
|
+
if (runCount === 0) ok(false, "Internal plumbing method '_extractLocation' failed to fire as expected.");
|
465
|
+
|
466
|
+
runCount = 0;
|
467
|
+
SC.routes.popState();
|
468
|
+
if (runCount === 0) ok(false, "Internal plumbing method '_extractLocation' failed to fire as expected.");
|
469
|
+
});
|
@@ -4,7 +4,7 @@
|
|
4
4
|
// Portions ©2008-2011 Apple Inc. All rights reserved.
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
|
-
/*global
|
7
|
+
/*global require, console */
|
8
8
|
|
9
9
|
// These commands are used by the build tools to control load order. On the
|
10
10
|
// client side these are a no-op.
|
@@ -39,7 +39,7 @@ window.SproutCore = window.SproutCore || SC;
|
|
39
39
|
// rest of the methods go into the mixin defined below.
|
40
40
|
|
41
41
|
/**
|
42
|
-
@version
|
42
|
+
@version 1.11.0.rc1
|
43
43
|
@namespace
|
44
44
|
|
45
45
|
All SproutCore methods and functions are defined
|
@@ -48,18 +48,15 @@ window.SproutCore = window.SproutCore || SC;
|
|
48
48
|
|
49
49
|
You can also use the shorthand "SC" instead of "SproutCore".
|
50
50
|
|
51
|
-
SproutCore-
|
51
|
+
SproutCore-runtime is a framework that provides core functions for SproutCore
|
52
52
|
including cross-platform functions, support for property observing and
|
53
53
|
objects. It's focus is on small size and performance. You can use this
|
54
54
|
in place of or along-side other cross-platform libraries such as jQuery or
|
55
55
|
Prototype.
|
56
|
-
|
57
|
-
The core Base framework is based on the jQuery API with a number of
|
58
|
-
performance optimizations.
|
59
56
|
*/
|
60
57
|
SC = window.SC; // This is dumb but necessary for jsdoc to get it right
|
61
58
|
|
62
|
-
SC.VERSION = '1.
|
59
|
+
SC.VERSION = '1.11.0.rc1';
|
63
60
|
|
64
61
|
/**
|
65
62
|
@private
|
@@ -77,10 +74,9 @@ SC.VERSION = '1.10.3';
|
|
77
74
|
@returns {Object} the target object.
|
78
75
|
@static
|
79
76
|
*/
|
80
|
-
SC._baseMixin = function (override) {
|
81
|
-
|
82
|
-
|
83
|
-
target = args[0] || {},
|
77
|
+
SC._baseMixin = function (override, args) {
|
78
|
+
// Copy reference to target object
|
79
|
+
var target = args[0] || {},
|
84
80
|
idx = 1,
|
85
81
|
length = args.length,
|
86
82
|
options, copy, key;
|
@@ -119,9 +115,12 @@ SC._baseMixin = function (override) {
|
|
119
115
|
@static
|
120
116
|
*/
|
121
117
|
SC.mixin = function () {
|
122
|
-
|
123
|
-
|
124
|
-
|
118
|
+
// Accessing `arguments.length` is just a Number and doesn't materialize the `arguments` object, which is costly.
|
119
|
+
// TODO: Add macro to build tools for this.
|
120
|
+
var args = new Array(arguments.length); // Array.prototype.slice.call(arguments)
|
121
|
+
for (var i = 0, len = args.length; i < len; i++) { args[i] = arguments[i]; }
|
122
|
+
|
123
|
+
return SC._baseMixin(true, args);
|
125
124
|
};
|
126
125
|
|
127
126
|
/**
|
@@ -137,9 +136,12 @@ SC.mixin = function () {
|
|
137
136
|
@static
|
138
137
|
*/
|
139
138
|
SC.supplement = function () {
|
140
|
-
|
141
|
-
|
142
|
-
|
139
|
+
// Accessing `arguments.length` is just a Number and doesn't materialize the `arguments` object which is costly.
|
140
|
+
// TODO: Add macro to build tools for this.
|
141
|
+
var args = new Array(arguments.length); // Array.prototype.slice.call(arguments)
|
142
|
+
for (var i = 0, len = args.length; i < len; i++) { args[i] = arguments[i]; }
|
143
|
+
|
144
|
+
return SC._baseMixin(false, args);
|
143
145
|
};
|
144
146
|
|
145
147
|
/**
|
@@ -200,11 +202,9 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
200
202
|
SC.T_ERROR: A SproutCore SC.Error object <br>
|
201
203
|
*/
|
202
204
|
typeOf: function (item) {
|
203
|
-
|
204
|
-
if (item === null) return SC.T_NULL;
|
205
|
-
|
206
|
-
var nativeType = jQuery.type(item);
|
205
|
+
var nativeType = SC._nativeTypeOf(item);
|
207
206
|
|
207
|
+
// Translate it into an SC type.
|
208
208
|
if (nativeType === "function") {
|
209
209
|
return item.isClass ? SC.T_CLASS : SC.T_FUNCTION;
|
210
210
|
} else if (nativeType === "object") {
|
@@ -224,6 +224,33 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
224
224
|
|
225
225
|
return nativeType;
|
226
226
|
},
|
227
|
+
// Inlined from jQuery.type to avoid dependency.
|
228
|
+
_nativeTypeOf: function(item) {
|
229
|
+
if (item === undefined) return SC.T_UNDEFINED;
|
230
|
+
if (item === null) return SC.T_NULL;
|
231
|
+
|
232
|
+
var nativeType = typeof item,
|
233
|
+
toString;
|
234
|
+
if (nativeType === "object" || nativeType === "function") {
|
235
|
+
toString = SC._nativeToString.call(item);
|
236
|
+
return SC._nativeTypeHash[toString] || "object";
|
237
|
+
} else {
|
238
|
+
return nativeType;
|
239
|
+
}
|
240
|
+
} ,
|
241
|
+
// Inlined from jQuery's class2type to avoid dependency.
|
242
|
+
_nativeTypeHash: {
|
243
|
+
"[object Boolean]": "boolean",
|
244
|
+
"[object Number]": "number",
|
245
|
+
"[object String]": "string",
|
246
|
+
"[object Function]": "function",
|
247
|
+
"[object Array]": "array",
|
248
|
+
"[object Date]": "date",
|
249
|
+
"[object RegExp]": "regexp",
|
250
|
+
"[object Object]": "object"
|
251
|
+
},
|
252
|
+
// Inlined from jQuery to avoid dependency.
|
253
|
+
_nativeToString: Object.prototype.toString,
|
227
254
|
|
228
255
|
/**
|
229
256
|
Returns YES if the passed value is null or undefined. This avoids errors
|
@@ -268,7 +295,7 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
268
295
|
if (!obj || obj.setInterval) { return false; }
|
269
296
|
if (Array.isArray && Array.isArray(obj)) { return true; }
|
270
297
|
if (obj.objectAt) { return true; }
|
271
|
-
if (obj.length !== undefined &&
|
298
|
+
if (obj.length !== undefined && SC._nativeTypeOf(obj) === "object") { return true; }
|
272
299
|
|
273
300
|
return false;
|
274
301
|
},
|
@@ -329,6 +356,7 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
329
356
|
_numberGuids: [],
|
330
357
|
_stringGuids: {},
|
331
358
|
_keyCache: {},
|
359
|
+
_uuid: 0,
|
332
360
|
|
333
361
|
/**"
|
334
362
|
Returns a unique GUID for the object. If the object does not yet have
|
@@ -353,7 +381,7 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
353
381
|
cache = this._guidCaches[type];
|
354
382
|
ret = cache[obj];
|
355
383
|
if (!ret) {
|
356
|
-
ret = "st" + (
|
384
|
+
ret = "st" + (SC._uuid++);
|
357
385
|
cache[obj] = ret;
|
358
386
|
}
|
359
387
|
return ret;
|
@@ -399,7 +427,7 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
399
427
|
@returns {String} the guid
|
400
428
|
*/
|
401
429
|
generateGuid: function (obj, prefix) {
|
402
|
-
var ret = (prefix + (
|
430
|
+
var ret = (prefix + (SC._uuid++));
|
403
431
|
if (obj) obj[this.guidKey] = ret;
|
404
432
|
return ret;
|
405
433
|
},
|
@@ -621,7 +649,7 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
621
649
|
if (object.clone) return object.clone();
|
622
650
|
}
|
623
651
|
|
624
|
-
switch (
|
652
|
+
switch (SC._nativeTypeOf(object)) {
|
625
653
|
case "array":
|
626
654
|
ret = object.slice();
|
627
655
|
|
@@ -696,6 +724,7 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
696
724
|
@returns {Array} array with [object, property] if found or null
|
697
725
|
*/
|
698
726
|
tupleForPropertyPath: function (path, root) {
|
727
|
+
/* jshint eqnull:true */
|
699
728
|
// if passed nothing, return nothing.
|
700
729
|
if (path == null) return null;
|
701
730
|
|
@@ -31,13 +31,7 @@ SC.mixin(Array.prototype,
|
|
31
31
|
this.splice.apply(this, args);
|
32
32
|
}
|
33
33
|
|
34
|
-
// Both arrayContentDidChange and enumerableContentDidChange will invoke
|
35
|
-
// "this.notifyPropertyChange('[]')". To prevent multiple notifications
|
36
|
-
// these calls are made as grouped property changes.
|
37
|
-
this.beginPropertyChanges();
|
38
34
|
this.arrayContentDidChange(idx, amt, len);
|
39
|
-
this.enumerableContentDidChange(idx, amt, len - amt);
|
40
|
-
this.endPropertyChanges();
|
41
35
|
|
42
36
|
return this;
|
43
37
|
},
|
@@ -0,0 +1,36 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// Copyright: ©2006-2011 Strobe Inc. and contributors.
|
4
|
+
// Portions ©2008-2011 Apple Inc. All rights reserved.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
SC.supplement(Number.prototype, {
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Returns the ordinal associated for the current number:
|
12
|
+
*
|
13
|
+
* eg: 1 => 'st', 2 => 'nd'
|
14
|
+
*
|
15
|
+
*
|
16
|
+
* If the current Locale exists (which it almost always does except for in
|
17
|
+
* testing) we try and delegate to it. Otherwise we use this inner anonymous
|
18
|
+
* function (to prevent further mucking with the prototype)
|
19
|
+
*
|
20
|
+
*/
|
21
|
+
ordinal: function () {
|
22
|
+
// FAST PATH: If we have a localization, use its ordinals.
|
23
|
+
if (SC.Locale) {
|
24
|
+
return SC.Locale.currentLocale.ordinalForNumber(this);
|
25
|
+
}
|
26
|
+
|
27
|
+
// Otherwise, fall back on a basic (en) implementation (e.g. in testing, or as
|
28
|
+
// the datetime framework only requires the runtime framework).
|
29
|
+
var d = this % 10;
|
30
|
+
return (~~(this % 100 / 10) === 1) ? 'th' :
|
31
|
+
(d === 1) ? 'st' :
|
32
|
+
(d === 2) ? 'nd' :
|
33
|
+
(d === 3) ? 'rd' : 'th';
|
34
|
+
}
|
35
|
+
|
36
|
+
});
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
Polyfills!
|
3
|
+
*/
|
4
|
+
|
5
|
+
// window.performance
|
6
|
+
(function() {
|
7
|
+
// TODO: Include polyfill for node.js
|
8
|
+
if (window && typeof window.performance === 'undefined') {
|
9
|
+
window.performance = {};
|
10
|
+
}
|
11
|
+
|
12
|
+
if (window && !window.performance.now) {
|
13
|
+
var initTimestamp;
|
14
|
+
if (window.performance.timing && window.performance.timing.navigationStart) {
|
15
|
+
initTimestamp = window.performance.timing.navigationStart;
|
16
|
+
} else {
|
17
|
+
window.performance.timing = {};
|
18
|
+
initTimestamp = window.performance.timing.navigationStart = Date.now ? Date.now() : (new Date()).getTime();
|
19
|
+
}
|
20
|
+
window.performance.now = function() {
|
21
|
+
var now = Date.now ? Date.now() : (new Date()).getTime();
|
22
|
+
return now - initTimestamp;
|
23
|
+
};
|
24
|
+
}
|
25
|
+
})();
|
@@ -37,7 +37,7 @@ SC.CoreArray = /** @lends SC.Array.prototype */ {
|
|
37
37
|
|
38
38
|
Before mutating the underlying data structure, you must call
|
39
39
|
this.arrayContentWillChange(). After the mutation is complete, you must
|
40
|
-
call arrayContentDidChange()
|
40
|
+
call arrayContentDidChange().
|
41
41
|
|
42
42
|
NOTE: JavaScript arrays already implement SC.Array and automatically call
|
43
43
|
the correct callbacks.
|
@@ -193,7 +193,7 @@ SC.CoreArray = /** @lends SC.Array.prototype */ {
|
|
193
193
|
var loc = this.get('length') || 0;
|
194
194
|
while (--loc >= 0) {
|
195
195
|
var curObject = this.objectAt(loc);
|
196
|
-
if (curObject
|
196
|
+
if (curObject === obj) this.removeAt(loc);
|
197
197
|
}
|
198
198
|
return this;
|
199
199
|
},
|
@@ -604,7 +604,7 @@ SC.CoreArray = /** @lends SC.Array.prototype */ {
|
|
604
604
|
}
|
605
605
|
}
|
606
606
|
|
607
|
-
this.
|
607
|
+
this.enumerableContentDidChange(start, addedCount, addedCount - removedCount);
|
608
608
|
this.endPropertyChanges();
|
609
609
|
|
610
610
|
return this;
|
@@ -557,7 +557,7 @@ SC.Enumerable = /** @scope SC.Enumerable.prototype */{
|
|
557
557
|
|
558
558
|
@param {Function} callback the callback to execute
|
559
559
|
@param {Object} target the target object to use
|
560
|
-
@returns {
|
560
|
+
@returns {Boolean} YES
|
561
561
|
*/
|
562
562
|
some: function (callback, target) {
|
563
563
|
if (typeof callback !== "function") throw new TypeError();
|
@@ -9,13 +9,16 @@ sc_require('ext/function');
|
|
9
9
|
sc_require('private/observer_set');
|
10
10
|
sc_require('private/chain_observer');
|
11
11
|
|
12
|
+
//@if(debug)
|
12
13
|
/**
|
13
|
-
Set to YES to have all observing activity logged to the
|
14
|
-
|
14
|
+
Set to YES to have all observing activity logged to the console.
|
15
|
+
|
16
|
+
This is only available in debug mode.
|
15
17
|
|
16
18
|
@type Boolean
|
17
19
|
*/
|
18
|
-
SC.LOG_OBSERVERS =
|
20
|
+
SC.LOG_OBSERVERS = false;
|
21
|
+
//@endif
|
19
22
|
|
20
23
|
SC.OBSERVES_HANDLER_ADD = 0;
|
21
24
|
SC.OBSERVES_HANDLER_REMOVE = 1;
|
@@ -136,7 +139,67 @@ SC.OBSERVES_HANDLER_REMOVE = 1;
|
|
136
139
|
|
137
140
|
@since SproutCore 1.0
|
138
141
|
*/
|
139
|
-
SC.Observable = /** @scope SC.Observable.prototype */{
|
142
|
+
SC.Observable = /** @scope SC.Observable.prototype */ {
|
143
|
+
|
144
|
+
//@if(debug)
|
145
|
+
/* BEGIN DEBUG ONLY PROPERTIES AND METHODS */
|
146
|
+
|
147
|
+
/**
|
148
|
+
Allows you to inspect a property for changes. Whenever the named property
|
149
|
+
changes, a log will be printed to the console. This (along with removeProbe)
|
150
|
+
are convenience methods meant for debugging purposes.
|
151
|
+
|
152
|
+
@param {String} key The name of the property you want probed for changes
|
153
|
+
*/
|
154
|
+
addProbe: function (key) { this.addObserver(key, SC.logChange); },
|
155
|
+
|
156
|
+
/**
|
157
|
+
Stops a running probe from observing changes to the observer.
|
158
|
+
|
159
|
+
@param {String} key The name of the property you want probed for changes
|
160
|
+
*/
|
161
|
+
removeProbe: function (key) { this.removeObserver(key, SC.logChange); },
|
162
|
+
|
163
|
+
/**
|
164
|
+
Logs the named properties to the console.
|
165
|
+
|
166
|
+
@param {String...} propertyNames one or more property names
|
167
|
+
*/
|
168
|
+
logProperty: function () {
|
169
|
+
var props = SC.$A(arguments),
|
170
|
+
prop, propsLen, idx;
|
171
|
+
for (idx = 0, propsLen = props.length; idx < propsLen; idx++) {
|
172
|
+
prop = props[idx];
|
173
|
+
console.log('%@:%@: '.fmt(SC.guidFor(this), prop), this.get(prop));
|
174
|
+
}
|
175
|
+
},
|
176
|
+
|
177
|
+
/* END DEBUG ONLY PROPERTIES AND METHODS */
|
178
|
+
//@endif
|
179
|
+
|
180
|
+
/** @private Property cache. */
|
181
|
+
_kvo_cache: null,
|
182
|
+
|
183
|
+
/** @private Whether properties of the object will be cacheable. Becomes true if any one computed property is .cacheable() */
|
184
|
+
_kvo_cacheable: false,
|
185
|
+
|
186
|
+
/** @private Cache of dependepents for a property. */
|
187
|
+
_kvo_cachedep: null,
|
188
|
+
|
189
|
+
/** @private */
|
190
|
+
_kvo_changeLevel: 0,
|
191
|
+
|
192
|
+
/** @private */
|
193
|
+
_kvo_changes: null,
|
194
|
+
|
195
|
+
/** @private */
|
196
|
+
_kvo_cloned: null,
|
197
|
+
|
198
|
+
/** @private */
|
199
|
+
_kvo_revision: 0,
|
200
|
+
|
201
|
+
/** @private */
|
202
|
+
_observableInited: false,
|
140
203
|
|
141
204
|
/**
|
142
205
|
Walk like that ol' duck
|
@@ -363,7 +426,7 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
363
426
|
@returns {SC.Observable}
|
364
427
|
*/
|
365
428
|
beginPropertyChanges: function () {
|
366
|
-
this._kvo_changeLevel =
|
429
|
+
this._kvo_changeLevel = this._kvo_changeLevel + 1;
|
367
430
|
return this;
|
368
431
|
},
|
369
432
|
|
@@ -427,10 +490,13 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
427
490
|
@returns {SC.Observable}
|
428
491
|
*/
|
429
492
|
propertyDidChange: function (key, value, _keepCache) {
|
430
|
-
this._kvo_revision =
|
431
|
-
var level = this._kvo_changeLevel
|
432
|
-
cachedep, idx, dfunc, func
|
433
|
-
|
493
|
+
this._kvo_revision = this._kvo_revision + 1;
|
494
|
+
var level = this._kvo_changeLevel,
|
495
|
+
cachedep, idx, dfunc, func;
|
496
|
+
|
497
|
+
//@if(debug)
|
498
|
+
var log = SC.LOG_OBSERVERS && (this.LOG_OBSERVING !== NO);
|
499
|
+
//@endif
|
434
500
|
|
435
501
|
// If any dependent keys contain this property in their path,
|
436
502
|
// invalidate the cache of the computed property and re-setup chain with
|
@@ -487,7 +553,9 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
487
553
|
changes.add(key);
|
488
554
|
|
489
555
|
if (suspended) {
|
490
|
-
if
|
556
|
+
//@if(debug)
|
557
|
+
if (log) console.log("%@%@: will not notify observers because observing is suspended".fmt(SC.KVO_SPACES, this));
|
558
|
+
//@endif
|
491
559
|
SC.Observers.objectHasPendingChanges(this);
|
492
560
|
}
|
493
561
|
|
@@ -829,6 +897,8 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
829
897
|
// if observers have not been cloned yet, do so now
|
830
898
|
observers = this._kvo_for(kvoKey);
|
831
899
|
observers.remove(target, method);
|
900
|
+
|
901
|
+
// Remove the key when no members remain.
|
832
902
|
if (observers.getMembers().length === 0) {
|
833
903
|
this._kvo_for('_kvo_observed_keys', SC.CoreSet).remove(key);
|
834
904
|
}
|
@@ -1098,21 +1168,23 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1098
1168
|
|
1099
1169
|
SC.Observers.flush(this); // hookup as many observers as possible.
|
1100
1170
|
|
1101
|
-
var
|
1102
|
-
observers, changes, dependents, starObservers, idx, keys, rev,
|
1171
|
+
var observers, changes, dependents, starObservers, idx, keys, rev,
|
1103
1172
|
members, membersLength, member, memberLoc, target, method, loc, func,
|
1104
1173
|
context, spaces, cache;
|
1105
1174
|
|
1175
|
+
//@if(debug)
|
1176
|
+
var log = SC.LOG_OBSERVERS && this.LOG_OBSERVING !== NO;
|
1106
1177
|
if (log) {
|
1107
1178
|
spaces = SC.KVO_SPACES = (SC.KVO_SPACES || '') + ' ';
|
1108
|
-
|
1179
|
+
console.log('%@%@: notifying observers after change to key "%@"'.fmt(spaces, this, key));
|
1109
1180
|
}
|
1181
|
+
//@endif
|
1110
1182
|
|
1111
1183
|
// Get any starObservers -- they will be notified of all changes.
|
1112
1184
|
starObservers = this['_kvo_observers_*'];
|
1113
1185
|
|
1114
1186
|
// prevent notifications from being sent until complete
|
1115
|
-
this._kvo_changeLevel =
|
1187
|
+
this._kvo_changeLevel = this._kvo_changeLevel + 1;
|
1116
1188
|
|
1117
1189
|
// keep sending notifications as long as there are changes
|
1118
1190
|
while (((changes = this._kvo_changes) && (changes.length > 0)) || key) {
|
@@ -1146,9 +1218,11 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1146
1218
|
// for each dependent key, add to set of changes. Also, if key
|
1147
1219
|
// value is a cacheable property, clear the cached value...
|
1148
1220
|
if (keys && (loc = keys.length)) {
|
1221
|
+
//@if(debug)
|
1149
1222
|
if (log) {
|
1150
|
-
|
1223
|
+
console.log("%@...including dependent keys for %@: %@".fmt(spaces, key, keys));
|
1151
1224
|
}
|
1225
|
+
//@endif
|
1152
1226
|
cache = this._kvo_cache;
|
1153
1227
|
if (!cache) cache = this._kvo_cache = {};
|
1154
1228
|
while (--loc >= 0) {
|
@@ -1186,14 +1260,16 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1186
1260
|
|
1187
1261
|
if (member[3] === rev) continue; // skip notified items.
|
1188
1262
|
|
1189
|
-
if (!member[1])
|
1263
|
+
if (!member[1]) console.log(member);
|
1190
1264
|
|
1191
1265
|
target = member[0] || this;
|
1192
1266
|
method = member[1];
|
1193
1267
|
context = member[2];
|
1194
1268
|
member[3] = rev;
|
1195
1269
|
|
1196
|
-
if
|
1270
|
+
//@if(debug)
|
1271
|
+
if (log) console.log('%@...firing observer on %@ for key "%@"'.fmt(spaces, target, key));
|
1272
|
+
//@endif
|
1197
1273
|
if (context !== undefined) {
|
1198
1274
|
method.call(target, this, key, null, context, rev);
|
1199
1275
|
} else {
|
@@ -1214,7 +1290,9 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1214
1290
|
member = members[memberLoc];
|
1215
1291
|
method = this[member]; // try to find observer function
|
1216
1292
|
if (method) {
|
1217
|
-
if
|
1293
|
+
//@if(debug)
|
1294
|
+
if (log) console.log('%@...firing local observer %@.%@ for key "%@"'.fmt(spaces, this, member, key));
|
1295
|
+
//@endif
|
1218
1296
|
method.call(this, this, key, null, rev);
|
1219
1297
|
}
|
1220
1298
|
}
|
@@ -1232,7 +1310,9 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1232
1310
|
method = member[1];
|
1233
1311
|
context = member[2];
|
1234
1312
|
|
1235
|
-
if
|
1313
|
+
//@if(debug)
|
1314
|
+
if (log) console.log('%@...firing * observer on %@ for key "%@"'.fmt(spaces, target, key));
|
1315
|
+
//@endif
|
1236
1316
|
if (context !== undefined) {
|
1237
1317
|
method.call(target, this, key, null, context, rev);
|
1238
1318
|
} else {
|
@@ -1243,7 +1323,9 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1243
1323
|
|
1244
1324
|
// if there is a default property observer, call that also
|
1245
1325
|
if (this.propertyObserver) {
|
1246
|
-
if
|
1326
|
+
//@if(debug)
|
1327
|
+
if (log) console.log('%@...firing %@.propertyObserver for key "%@"'.fmt(spaces, this, key));
|
1328
|
+
//@endif
|
1247
1329
|
this.propertyObserver(this, key, null, rev);
|
1248
1330
|
}
|
1249
1331
|
} // while(changes.length>0)
|
@@ -1259,7 +1341,9 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1259
1341
|
// done with loop, reduce change level so that future sets can resume
|
1260
1342
|
this._kvo_changeLevel = (this._kvo_changeLevel || 1) - 1;
|
1261
1343
|
|
1344
|
+
//@if(debug)
|
1262
1345
|
if (log) SC.KVO_SPACES = spaces.slice(0, -2);
|
1346
|
+
//@endif
|
1263
1347
|
|
1264
1348
|
return YES; // finished successfully
|
1265
1349
|
},
|
@@ -1312,21 +1396,53 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1312
1396
|
},
|
1313
1397
|
|
1314
1398
|
/**
|
1315
|
-
didChangeFor
|
1316
|
-
|
1317
|
-
first parameter (so didChangeFor can identify which method is calling it),
|
1318
|
-
followed by a list of keys that should be checked for changes.
|
1319
|
-
|
1320
|
-
For example, in your render method you might pass the following context:
|
1321
|
-
if (this.didChangeFor('render','height','width')) {
|
1322
|
-
// Only render if changed
|
1323
|
-
}
|
1399
|
+
didChangeFor is a very important method which allows you to tell whether
|
1400
|
+
a property or properties have changed.
|
1324
1401
|
|
1325
|
-
|
1402
|
+
The key to using didChangeFor is to pass a unique string as the first argument,
|
1403
|
+
which signals, "Has anything changed since the last time this was called with
|
1404
|
+
this unique key?" The string can be anything you want, as long as it's unique
|
1405
|
+
and stays the same from call to call.
|
1326
1406
|
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1407
|
+
After the key argument, you can pass as many property arguments as you like;
|
1408
|
+
didChangeFor will only return `true` if any of those properties have changed
|
1409
|
+
since the last call.
|
1410
|
+
|
1411
|
+
For example, in your view's update method, you might want to gate DOM changes
|
1412
|
+
(generally a slow operation) on whether the root values have changed. You might
|
1413
|
+
ask the following:
|
1414
|
+
|
1415
|
+
if (this.didChangeFor('updateOnDisplayValue', 'displayValue')) {
|
1416
|
+
// Update the DOM.
|
1417
|
+
}
|
1418
|
+
|
1419
|
+
In another method on the same view, you might send an event if that same value
|
1420
|
+
has changed:
|
1421
|
+
|
1422
|
+
if (this.didChangeFor('otherMethodDisplayValue', 'displayValue')) {
|
1423
|
+
// Send a statechart action.
|
1424
|
+
}
|
1425
|
+
|
1426
|
+
Each call will correctly return whether the property has changed since the last
|
1427
|
+
time displayDidChange was called *with that key*. The following sequence of calls
|
1428
|
+
will return the following values:
|
1429
|
+
|
1430
|
+
- this.set('displayValue', 'value1');
|
1431
|
+
- this.didChangeFor('updateOnDisplayValue', 'displayValue');
|
1432
|
+
> true;
|
1433
|
+
- this.didChangeFor('updateOnDisplayValue', 'displayValue');
|
1434
|
+
> false;
|
1435
|
+
- this.didChangeFor('otherMethodDisplayValue', 'displayValue');
|
1436
|
+
> true;
|
1437
|
+
- this.set('displayValue', 'value2');
|
1438
|
+
- this.didChangeFor('updateOnDisplayValue', 'displayValue');
|
1439
|
+
> true;
|
1440
|
+
- this.didChangeFor('updateOnDisplayValue', 'displayValue');
|
1441
|
+
> false;
|
1442
|
+
- this.didChangeFor('updateOnDisplayValue', 'displayValue');
|
1443
|
+
> false;
|
1444
|
+
- this.didChangeFor('otherMethodDisplayValue', 'displayValue');
|
1445
|
+
> false;
|
1330
1446
|
|
1331
1447
|
This method works by comparing property revision counts. Every time a
|
1332
1448
|
property changes, an internal counter is incremented. When didChangeFor is
|
@@ -1353,7 +1469,7 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1353
1469
|
|
1354
1470
|
// prepare too loop!
|
1355
1471
|
ret = false;
|
1356
|
-
currentRevision = this._kvo_revision
|
1472
|
+
currentRevision = this._kvo_revision;
|
1357
1473
|
idx = arguments.length;
|
1358
1474
|
while (--idx >= 1) { // NB: loop only to 1 to ignore context arg.
|
1359
1475
|
key = arguments[idx];
|
@@ -1548,44 +1664,16 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
1548
1664
|
return this;
|
1549
1665
|
},
|
1550
1666
|
|
1551
|
-
/**
|
1552
|
-
Allows you to inspect a property for changes. Whenever the named property
|
1553
|
-
changes, a log will be printed to the console. This (along with removeProbe)
|
1554
|
-
are convenience methods meant for debugging purposes.
|
1555
|
-
|
1556
|
-
@param {String} key The name of the property you want probed for changes
|
1557
|
-
*/
|
1558
|
-
addProbe: function (key) { this.addObserver(key, SC.logChange); },
|
1559
|
-
|
1560
|
-
/**
|
1561
|
-
Stops a running probe from observing changes to the observer.
|
1562
|
-
|
1563
|
-
@param {String} key The name of the property you want probed for changes
|
1564
|
-
*/
|
1565
|
-
removeProbe: function (key) { this.removeObserver(key, SC.logChange); },
|
1566
|
-
|
1567
|
-
/**
|
1568
|
-
Logs the named properties to the SC.Logger.
|
1569
|
-
|
1570
|
-
@param {String...} propertyNames one or more property names
|
1571
|
-
*/
|
1572
|
-
logProperty: function () {
|
1573
|
-
var props = SC.$A(arguments),
|
1574
|
-
prop, propsLen, idx;
|
1575
|
-
for (idx = 0, propsLen = props.length; idx < propsLen; idx++) {
|
1576
|
-
prop = props[idx];
|
1577
|
-
SC.Logger.log('%@:%@: '.fmt(SC.guidFor(this), prop), this.get(prop));
|
1578
|
-
}
|
1579
|
-
},
|
1580
|
-
|
1581
1667
|
propertyRevision: 1
|
1582
1668
|
|
1583
1669
|
};
|
1584
1670
|
|
1585
|
-
|
1671
|
+
//@if(debug)
|
1672
|
+
/** @private used by addProbe/removeProbe. Debug mode only. */
|
1586
1673
|
SC.logChange = function logChange(target, key, value) {
|
1587
|
-
|
1674
|
+
console.log("CHANGE: %@[%@] => %@".fmt(target, key, target.get(key)));
|
1588
1675
|
};
|
1676
|
+
//@endif
|
1589
1677
|
|
1590
1678
|
/**
|
1591
1679
|
Retrieves a property from an object, using get() if the
|
@@ -1595,6 +1683,7 @@ SC.logChange = function logChange(target, key, value) {
|
|
1595
1683
|
@param {String} key the property to retrieve
|
1596
1684
|
*/
|
1597
1685
|
SC.mixin(SC, {
|
1686
|
+
|
1598
1687
|
get: function (object, key) {
|
1599
1688
|
if (!object) return undefined;
|
1600
1689
|
if (key === undefined) return this[object];
|
@@ -1616,6 +1705,7 @@ SC.mixin(SC, {
|
|
1616
1705
|
}
|
1617
1706
|
return SC.objectForPropertyPath(path, object);
|
1618
1707
|
}
|
1708
|
+
|
1619
1709
|
});
|
1620
1710
|
|
1621
1711
|
// Make all Array's observable
|