sproutcore 1.6.0.rc.2-x86-mingw32 → 1.6.0.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +12 -0
 - data/VERSION.yml +1 -1
 - data/bin/sc-docs +6 -1
 - data/lib/buildtasks/target.rake +1 -1
 - data/lib/frameworks/sproutcore/Buildfile +5 -1
 - data/lib/frameworks/sproutcore/CHANGELOG.md +175 -1
 - data/lib/frameworks/sproutcore/apps/test_controls/controllers/select.js +12 -0
 - data/lib/frameworks/sproutcore/apps/test_controls/resources/select_page.js +19 -5
 - data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +28 -31
 - data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +9 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +21 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +6 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +26 -8
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +12 -5
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +25 -9
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +157 -5
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +7 -6
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +9 -3
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +8 -8
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +104 -4
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/theme.js +3 -56
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +4 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +59 -0
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +41 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +10 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +16 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +11 -0
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +18 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +10 -6
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +18 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +9 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +9 -4
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +15 -3
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +14 -8
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +8 -18
 - data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +12 -2
 - data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +296 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +330 -326
 - data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +22 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +614 -614
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +14 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +3 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +20 -13
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +61 -46
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +30 -30
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +24 -24
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/connectDataSource.js +31 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +1177 -0
 - data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +4 -63
 - data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +7 -8
 - data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +18 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +9 -0
 - data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +3 -3
 - data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +3 -3
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/master_detail.js +3 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js +12 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/picker.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/toolbar.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/well.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/workspace.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +1 -0
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +33 -22
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +20 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +10 -3
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +34 -7
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +14 -15
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +40 -14
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +699 -700
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +11 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +16 -6
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +0 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +49 -7
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +9 -0
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +6 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -26
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +20 -19
 - data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +249 -249
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js +13 -5
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/emptiness.js +53 -37
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form.js +2 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form_row.js +3 -11
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/edit_mode.js +53 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/emptiness.js +114 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form.js +174 -6
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_row.js +86 -6
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +80 -110
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +96 -97
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +2 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +20 -36
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +121 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +90 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +139 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/render_delegates/select_button.js +14 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +25 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +43 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +32 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/menu_setup.js +40 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/show_menu.js +45 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/menu_width.js +49 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +191 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +264 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +450 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +14 -6
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split_divider.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +9 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/thumb.js +3 -2
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -17
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +35 -8
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor_delegate.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/image.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +6 -6
 - data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/favicon.ico +0 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +0 -5
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/exception_handler.js +4 -2
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/math.js +2 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +13 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +6 -9
 - data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +912 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +36 -7
 - data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +58 -4
 - data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +1 -3
 - data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +0 -15
 - data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +25 -14
 - data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/core.js +15 -9
 - data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/flatten.js +24 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +2 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +5 -5
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +19 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +3 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +14 -14
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +3 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +15 -16
 - data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +6 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +30 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +17 -0
 - data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +9 -2
 - data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +3 -1
 - data/lib/frameworks/sproutcore/frameworks/testing/resources/runner.css +0 -1
 - data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +80 -0
 - data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +0 -4
 - data/lib/frameworks/sproutcore/lib/index.rhtml +2 -1
 - data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +3 -3
 - data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
 - data/lib/frameworks/sproutcore/themes/ace/resources/form/form.css +9 -0
 - data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +3 -1
 - data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/picker.js +1 -1
 - data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/workspace.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/button.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/panel.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/progress.js +2 -0
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/slider.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/well.js +1 -1
 - data/lib/sproutcore/builders/base.rb +5 -1
 - data/lib/sproutcore/builders/handlebars.rb +12 -1
 - data/lib/sproutcore/models/target.rb +1 -9
 - data/lib/sproutcore/rack/proxy.rb +238 -92
 - data/lib/sproutcore/tools/docs.rb +1 -7
 - data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -0
 - data/spec/fixtures/builder_tests/apps/handlebars_test/{template.handlebars → templates/template.handlebars} +2 -0
 - data/spec/lib/builders/handlebars_spec.rb +10 -4
 - data/sproutcore.gemspec +3 -1
 - metadata +73 -44
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/default_styles.css +0 -5
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/strings.js +0 -15
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_checkbox_field.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_field.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_label.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_radio_field.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_text_field.js +0 -17
 
| 
         @@ -38,6 +38,10 @@ 
     | 
|
| 
       38 
38 
     | 
    
         
             
                equals(textFieldView.$('input').val(), "afterlife", "sets value of DOM to value property");
         
     | 
| 
       39 
39 
     | 
    
         
             
              });
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
      
 41 
     | 
    
         
            +
              // Not really sure how to test this without doing something like adding a selection then checking 
         
     | 
| 
      
 42 
     | 
    
         
            +
              // to see if it's still there after setting value
         
     | 
| 
      
 43 
     | 
    
         
            +
              test("only update DOM if value changed");
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       41 
45 
     | 
    
         
             
              test("value binding works properly for inputs that haven't been created", function() {
         
     | 
| 
       42 
46 
     | 
    
         
             
                var view = SC.TemplateView.create(SC.TextFieldSupport, {
         
     | 
| 
       43 
47 
     | 
    
         
             
                  template: SC.Handlebars.compile('<input type="text">'),
         
     | 
| 
         @@ -74,7 +78,7 @@ 
     | 
|
| 
       74 
78 
     | 
    
         
             
                equals(focusCalled, 1, "focus called after field receives focus");
         
     | 
| 
       75 
79 
     | 
    
         | 
| 
       76 
80 
     | 
    
         
             
                textFieldView.$('input').blur();
         
     | 
| 
       77 
     | 
    
         
            -
                equals(blurCalled, 1, "blur  
     | 
| 
      
 81 
     | 
    
         
            +
                equals(blurCalled, 1, "blur called after field blurs");
         
     | 
| 
       78 
82 
     | 
    
         
             
              });
         
     | 
| 
       79 
83 
     | 
    
         | 
| 
       80 
84 
     | 
    
         
             
              test("calls correct method for key events", function() {
         
     | 
| 
         @@ -130,6 +134,10 @@ 
     | 
|
| 
       130 
134 
     | 
    
         
             
                equals(textFieldView.$('input').val(), "afterlife", "sets value of DOM to value property");
         
     | 
| 
       131 
135 
     | 
    
         
             
              });
         
     | 
| 
       132 
136 
     | 
    
         | 
| 
      
 137 
     | 
    
         
            +
              // Not really sure how to test this without doing something like adding a selection then checking 
         
     | 
| 
      
 138 
     | 
    
         
            +
              // to see if it's still there after setting value
         
     | 
| 
      
 139 
     | 
    
         
            +
              test("only update DOM if value changed");
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
       133 
141 
     | 
    
         
             
              test("value binding works properly for inputs that haven't been created", function() {
         
     | 
| 
       134 
142 
     | 
    
         
             
                var view = SC.TextField.create({
         
     | 
| 
       135 
143 
     | 
    
         
             
                  valueBinding: 'TestObject.value'
         
     | 
| 
         @@ -165,7 +173,7 @@ 
     | 
|
| 
       165 
173 
     | 
    
         
             
                equals(focusCalled, 1, "focus called after field receives focus");
         
     | 
| 
       166 
174 
     | 
    
         | 
| 
       167 
175 
     | 
    
         
             
                textFieldView.$('input').blur();
         
     | 
| 
       168 
     | 
    
         
            -
                equals(blurCalled, 1, "blur  
     | 
| 
      
 176 
     | 
    
         
            +
                equals(blurCalled, 1, "blur called after field blurs");
         
     | 
| 
       169 
177 
     | 
    
         
             
              });
         
     | 
| 
       170 
178 
     | 
    
         | 
| 
       171 
179 
     | 
    
         
             
              test("calls correct method for key events", function() {
         
     | 
| 
         @@ -9,7 +9,6 @@ module("Template Panes"); 
     | 
|
| 
       9 
9 
     | 
    
         
             
            test("Template panes append a main pane to the document body", function() {
         
     | 
| 
       10 
10 
     | 
    
         
             
              var pane = SC.TemplatePane.append({
         
     | 
| 
       11 
11 
     | 
    
         
             
                layerId: 'template-panes-are-so-cool',
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
12 
     | 
    
         
             
                template: SC.Handlebars.compile('<h1>foo bar baz</h1>')
         
     | 
| 
       14 
13 
     | 
    
         
             
              });
         
     | 
| 
       15 
14 
     | 
    
         | 
| 
         @@ -18,3 +17,19 @@ test("Template panes append a main pane to the document body", function() { 
     | 
|
| 
       18 
17 
     | 
    
         | 
| 
       19 
18 
     | 
    
         
             
              pane.remove();
         
     | 
| 
       20 
19 
     | 
    
         
             
            });
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            test("Template panes should be awoken", function(){
         
     | 
| 
      
 22 
     | 
    
         
            +
              var didAwake = false;
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              var originalAwake = SC.MainPane.prototype.awake; // null for now, but just in case
         
     | 
| 
      
 25 
     | 
    
         
            +
              SC.MainPane.prototype.awake = function(){ didAwake = true; }
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              var pane = SC.TemplatePane.append({
         
     | 
| 
      
 28 
     | 
    
         
            +
                layerId: 'template-panes-are-so-cool',
         
     | 
| 
      
 29 
     | 
    
         
            +
                template: SC.Handlebars.compile('<h1>foo bar baz</h1>')
         
     | 
| 
      
 30 
     | 
    
         
            +
              });
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              SC.MainPane.prototype.awake = originalAwake;
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              ok(didAwake, "should have awoken the pane");
         
     | 
| 
      
 35 
     | 
    
         
            +
            });
         
     | 
    
        data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js
    CHANGED
    
    | 
         @@ -898,7 +898,7 @@ test("should be able to bind class attribute with {{bindAttr}}", function() { 
     | 
|
| 
       898 
898 
     | 
    
         
             
            });
         
     | 
| 
       899 
899 
     | 
    
         | 
| 
       900 
900 
     | 
    
         
             
            test("should be able to bind boolean element attributes using {{bindAttr}}", function() {
         
     | 
| 
       901 
     | 
    
         
            -
              var template = SC.Handlebars.compile('<input type=" 
     | 
| 
      
 901 
     | 
    
         
            +
              var template = SC.Handlebars.compile('<input type="checkbox" {{bindAttr disabled="content.isDisabled" checked="content.isChecked"}} />');
         
     | 
| 
       902 
902 
     | 
    
         
             
              var content = SC.Object.create({
         
     | 
| 
       903 
903 
     | 
    
         
             
                isDisabled: false,
         
     | 
| 
       904 
904 
     | 
    
         
             
                isChecked: true
         
     | 
| 
         @@ -115,3 +115,14 @@ test("notifies receiver and each child if parent clipping frame changes", functi 
     | 
|
| 
       115 
115 
     | 
    
         
             
              // number.
         
     | 
| 
       116 
116 
     | 
    
         
             
              equals(callCount, 2, 'should invoke observer on child and nested child');
         
     | 
| 
       117 
117 
     | 
    
         
             
            });
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            test("returns 0, 0, W, H if parentView has no clippingFrame", function(){
         
     | 
| 
      
 120 
     | 
    
         
            +
              a.clippingFrame = null;
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
              var targetFrame = aa.get('clippingFrame');
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
              equals(targetFrame.x, 0, "x should be 0");
         
     | 
| 
      
 125 
     | 
    
         
            +
              equals(targetFrame.y, 0, "y should be 0");
         
     | 
| 
      
 126 
     | 
    
         
            +
              equals(targetFrame.width, 40, "width should be 40");
         
     | 
| 
      
 127 
     | 
    
         
            +
              equals(targetFrame.height, 40, "height should be 40");
         
     | 
| 
      
 128 
     | 
    
         
            +
            });
         
     | 
    
        data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js
    CHANGED
    
    | 
         @@ -21,6 +21,7 @@ module("SC.View#didAppendToDocument", { 
     | 
|
| 
       21 
21 
     | 
    
         
             
                        context.push('new string');
         
     | 
| 
       22 
22 
     | 
    
         
             
                      },
         
     | 
| 
       23 
23 
     | 
    
         
             
                      didAppendToDocument: function(){
         
     | 
| 
      
 24 
     | 
    
         
            +
                        ok(document.getElementById(this.get('layerId')), "view layer should exist");
         
     | 
| 
       24 
25 
     | 
    
         
             
                        counter++;
         
     | 
| 
       25 
26 
     | 
    
         
             
                      }
         
     | 
| 
       26 
27 
     | 
    
         
             
                    })
         
     | 
| 
         @@ -30,6 +31,7 @@ module("SC.View#didAppendToDocument", { 
     | 
|
| 
       30 
31 
     | 
    
         | 
| 
       31 
32 
     | 
    
         
             
                additionalView = SC.View.create({
         
     | 
| 
       32 
33 
     | 
    
         
             
                  didAppendToDocument: function(){
         
     | 
| 
      
 34 
     | 
    
         
            +
                    ok(document.getElementById(this.get('layerId')), "additionalView layer should exist");
         
     | 
| 
       33 
35 
     | 
    
         
             
                    counter++;
         
     | 
| 
       34 
36 
     | 
    
         
             
                  }
         
     | 
| 
       35 
37 
     | 
    
         
             
                });
         
     | 
| 
         @@ -59,11 +61,12 @@ test("Check that didAppendToDocument gets called at the right moment", function( 
     | 
|
| 
       59 
61 
     | 
    
         
             
              equals(counter, 3, "");
         
     | 
| 
       60 
62 
     | 
    
         
             
            });
         
     | 
| 
       61 
63 
     | 
    
         | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
       62 
65 
     | 
    
         
             
            // Test for bug: when a childView has a non-fixed layout and we request its frame before the parentView has
         
     | 
| 
       63 
66 
     | 
    
         
             
            // a layer and the parentView uses static layout, then the frame returned will be {x: 0, y:0, width: 0, height: 0}
         
     | 
| 
       64 
67 
     | 
    
         
             
            // and any further requests for the childView's frame will not return a new value unless the parentViewDidChange
         
     | 
| 
       65 
68 
     | 
    
         
             
            // or parentViewDidResize.  A weird case, but we prevent it from failing anyhow.
         
     | 
| 
       66 
     | 
    
         
            -
            test("Check that childView is updated if  
     | 
| 
      
 69 
     | 
    
         
            +
            test("Check that childView is updated if the pane has a static layout and view doesn't have a fixed layout", function() {
         
     | 
| 
       67 
70 
     | 
    
         
             
              var childFrame,
         
     | 
| 
       68 
71 
     | 
    
         
             
                  wrongFrame = {x:0, y:0, width: 0, height: 0},
         
     | 
| 
       69 
72 
     | 
    
         
             
                  correctFrame;
         
     | 
| 
         @@ -80,4 +83,17 @@ test("Check that childView is updated if we have static layout and they don't ha 
     | 
|
| 
       80 
83 
     | 
    
         
             
              correctFrame = pane.get('frame');
         
     | 
| 
       81 
84 
     | 
    
         | 
| 
       82 
85 
     | 
    
         
             
              same(childFrame, correctFrame, 'getting frame after layer exists on non-fixed layout childView should return actual frame');
         
     | 
| 
       83 
     | 
    
         
            -
            });
         
     | 
| 
      
 86 
     | 
    
         
            +
            });
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            test("Check that childView is updated if it has a static layout", function() {
         
     | 
| 
      
 90 
     | 
    
         
            +
              var childFrame,
         
     | 
| 
      
 91 
     | 
    
         
            +
                  wrongFrame = {x:0, y:0, width: 0, height: 0},
         
     | 
| 
      
 92 
     | 
    
         
            +
                  correctFrame;
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
              view.set('useStaticLayout', YES);
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
              equals(counter, 0, "precond - has not been called yet");
         
     | 
| 
      
 97 
     | 
    
         
            +
              pane.append(); // make sure there is a layer...
         
     | 
| 
      
 98 
     | 
    
         
            +
              equals(counter, 1, "didAppendToDocument was called once");
         
     | 
| 
      
 99 
     | 
    
         
            +
            });
         
     | 
| 
         @@ -80,7 +80,7 @@ test("invokes willAddChild() on receiver if defined before adding child" ,functi 
     | 
|
| 
       80 
80 
     | 
    
         | 
| 
       81 
81 
     | 
    
         | 
| 
       82 
82 
     | 
    
         
             
              parent.insertBefore(child, otherChild);
         
     | 
| 
       83 
     | 
    
         
            -
               
     | 
| 
      
 83 
     | 
    
         
            +
              equals(callCount, 1, 'invoked');
         
     | 
| 
       84 
84 
     | 
    
         
             
            });
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
       86 
86 
     | 
    
         
             
            test("invokes willAddToParent() on child view if defined before adding child" ,function() {
         
     | 
| 
         @@ -102,7 +102,7 @@ test("invokes willAddToParent() on child view if defined before adding child" ,f 
     | 
|
| 
       102 
102 
     | 
    
         | 
| 
       103 
103 
     | 
    
         | 
| 
       104 
104 
     | 
    
         
             
              parent.insertBefore(child, otherChild);
         
     | 
| 
       105 
     | 
    
         
            -
               
     | 
| 
      
 105 
     | 
    
         
            +
              equals(callCount, 1, 'invoked');
         
     | 
| 
       106 
106 
     | 
    
         
             
            });
         
     | 
| 
       107 
107 
     | 
    
         | 
| 
       108 
108 
     | 
    
         
             
            test("invokes didAddChild() on receiver if defined after adding child" ,function() {
         
     | 
| 
         @@ -122,9 +122,11 @@ test("invokes didAddChild() on receiver if defined after adding child" ,function 
     | 
|
| 
       122 
122 
     | 
    
         
             
              	callCount++;
         
     | 
| 
       123 
123 
     | 
    
         
             
              };
         
     | 
| 
       124 
124 
     | 
    
         | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
      
 125 
     | 
    
         
            +
              SC.RunLoop.begin();
         
     | 
| 
       126 
126 
     | 
    
         
             
              parent.insertBefore(child, otherChild);
         
     | 
| 
       127 
     | 
    
         
            -
               
     | 
| 
      
 127 
     | 
    
         
            +
              SC.RunLoop.end();
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
              equals(callCount, 1, 'invoked');
         
     | 
| 
       128 
130 
     | 
    
         
             
            });
         
     | 
| 
       129 
131 
     | 
    
         | 
| 
       130 
132 
     | 
    
         
             
            test("invokes didAddToParent() on child view if defined after adding child" ,function() {
         
     | 
| 
         @@ -144,9 +146,11 @@ test("invokes didAddToParent() on child view if defined after adding child" ,fun 
     | 
|
| 
       144 
146 
     | 
    
         
             
              	callCount++;
         
     | 
| 
       145 
147 
     | 
    
         
             
              };
         
     | 
| 
       146 
148 
     | 
    
         | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
      
 149 
     | 
    
         
            +
              SC.RunLoop.begin();
         
     | 
| 
       148 
150 
     | 
    
         
             
              parent.insertBefore(child, otherChild);
         
     | 
| 
       149 
     | 
    
         
            -
               
     | 
| 
      
 151 
     | 
    
         
            +
              SC.RunLoop.end();
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
              equals(callCount, 1, 'invoked');
         
     | 
| 
       150 
154 
     | 
    
         
             
            });
         
     | 
| 
       151 
155 
     | 
    
         | 
| 
       152 
156 
     | 
    
         
             
            test("invokes parentViewDidChange() on child view.  this is used by the view internals to update layer loc", function() {
         
     | 
| 
         @@ -4,7 +4,18 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
            //            ©2008-2011 Apple Inc. All rights reserved.
         
     | 
| 
       5 
5 
     | 
    
         
             
            // License:   Licensed under MIT license (see license.js)
         
     | 
| 
       6 
6 
     | 
    
         
             
            // ==========================================================================
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            var originalTabbing;
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            module("SC.View - Keyboard support with Tabbing Only Inside Document", {
         
     | 
| 
      
 11 
     | 
    
         
            +
              setup: function(){
         
     | 
| 
      
 12 
     | 
    
         
            +
                originalTabbing = SC.TABBING_ONLY_INSIDE_DOCUMENT;
         
     | 
| 
      
 13 
     | 
    
         
            +
                SC.TABBING_ONLY_INSIDE_DOCUMENT = YES;
         
     | 
| 
      
 14 
     | 
    
         
            +
              },
         
     | 
| 
      
 15 
     | 
    
         
            +
              teardown: function(){
         
     | 
| 
      
 16 
     | 
    
         
            +
                SC.TABBING_ONLY_INSIDE_DOCUMENT = originalTabbing;
         
     | 
| 
      
 17 
     | 
    
         
            +
              }
         
     | 
| 
      
 18 
     | 
    
         
            +
            });
         
     | 
| 
       8 
19 
     | 
    
         | 
| 
       9 
20 
     | 
    
         
             
            test("Views only attempt to call performKeyEquivalent on child views that support it", function() {
         
     | 
| 
       10 
21 
     | 
    
         
             
              var performKeyEquivalentCalled = 0;
         
     | 
| 
         @@ -422,3 +433,9 @@ test("previousValidKeyView prioritizes parent's firstKeyView even if previousKey 
     | 
|
| 
       422 
433 
     | 
    
         
             
              equals(pane.view2.view6.get('previousValidKeyView'), pane.view1.view4, "firstKeyView was respected; views before firstKeyView were skipped");
         
     | 
| 
       423 
434 
     | 
    
         
             
            });
         
     | 
| 
       424 
435 
     | 
    
         | 
| 
      
 436 
     | 
    
         
            +
             
     | 
| 
      
 437 
     | 
    
         
            +
            module("SC.View - Keyboard support with Tabbing Outside of Document");
         
     | 
| 
      
 438 
     | 
    
         
            +
             
     | 
| 
      
 439 
     | 
    
         
            +
            test("forward tab with no next responder moves out of document");
         
     | 
| 
      
 440 
     | 
    
         
            +
             
     | 
| 
      
 441 
     | 
    
         
            +
            test("backwards tab with no previous responder moves out of document");
         
     | 
| 
         @@ -9,7 +9,15 @@ sc_require('views/template'); 
     | 
|
| 
       9 
9 
     | 
    
         
             
            */
         
     | 
| 
       10 
10 
     | 
    
         
             
            SC.TemplateCollectionView = SC.TemplateView.extend(
         
     | 
| 
       11 
11 
     | 
    
         
             
              /** @scope SC.TemplateCollectionView.prototype */{
         
     | 
| 
      
 12 
     | 
    
         
            +
              /**
         
     | 
| 
      
 13 
     | 
    
         
            +
                Name of the tag that is used for the collection
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                If the tag is a list ('ul' or 'ol') each item will be wrapped into a 'li' tag.
         
     | 
| 
      
 16 
     | 
    
         
            +
                If the tag is a table ('table', 'thead', 'tbody') each item will be wrapped into a 'tr' tag.
         
     | 
| 
       12 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
                @property {String}
         
     | 
| 
      
 19 
     | 
    
         
            +
                @default ul
         
     | 
| 
      
 20 
     | 
    
         
            +
              */
         
     | 
| 
       13 
21 
     | 
    
         
             
              tagName: 'ul',
         
     | 
| 
       14 
22 
     | 
    
         
             
              content: null,
         
     | 
| 
       15 
23 
     | 
    
         
             
              template: SC.Handlebars.compile(''),
         
     | 
| 
         @@ -297,7 +305,7 @@ SC.TemplateCollectionView = SC.TemplateView.extend( 
     | 
|
| 
       297 
305 
     | 
    
         
             
                  case 'thead':
         
     | 
| 
       298 
306 
     | 
    
         
             
                  case 'tbody':
         
     | 
| 
       299 
307 
     | 
    
         
             
                  case 'tfoot':
         
     | 
| 
       300 
     | 
    
         
            -
                    return 'tr'
         
     | 
| 
      
 308 
     | 
    
         
            +
                    return 'tr';
         
     | 
| 
       301 
309 
     | 
    
         
             
                }
         
     | 
| 
       302 
310 
     | 
    
         
             
              }.property('tagName'),
         
     | 
| 
       303 
311 
     | 
    
         | 
| 
         @@ -24,7 +24,7 @@ SC.CONTEXT_MENU_ENABLED = YES; 
     | 
|
| 
       24 
24 
     | 
    
         
             
              Default property to disable or enable if the focus can jump to the address
         
     | 
| 
       25 
25 
     | 
    
         
             
              bar or not.
         
     | 
| 
       26 
26 
     | 
    
         
             
            */
         
     | 
| 
       27 
     | 
    
         
            -
            SC.TABBING_ONLY_INSIDE_DOCUMENT =  
     | 
| 
      
 27 
     | 
    
         
            +
            SC.TABBING_ONLY_INSIDE_DOCUMENT = NO;
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            /**
         
     | 
| 
       30 
30 
     | 
    
         
             
              Tells the property (when fetched with themed()) to get its value from the renderer (if any).
         
     | 
| 
         @@ -674,7 +674,12 @@ SC.CoreView.reopen( 
     | 
|
| 
       674 
674 
     | 
    
         | 
| 
       675 
675 
     | 
    
         
             
                if (this.get('isTextSelectable')) { context.addClass('allow-select'); }
         
     | 
| 
       676 
676 
     | 
    
         
             
                if (!this.get('isVisible')) { context.addClass('sc-hidden'); }
         
     | 
| 
       677 
     | 
    
         
            -
                if (this.get('isFirstResponder')) {  
     | 
| 
      
 677 
     | 
    
         
            +
                if (this.get('isFirstResponder')) { 
         
     | 
| 
      
 678 
     | 
    
         
            +
                  context.addClass('focus');
         
     | 
| 
      
 679 
     | 
    
         
            +
                  context.attr('tabindex', '0'); 
         
     | 
| 
      
 680 
     | 
    
         
            +
                }else{
         
     | 
| 
      
 681 
     | 
    
         
            +
                  context.attr('tabindex', '-1');
         
     | 
| 
      
 682 
     | 
    
         
            +
                }
         
     | 
| 
       678 
683 
     | 
    
         | 
| 
       679 
684 
     | 
    
         
             
                context.id(this.get('layerId'));
         
     | 
| 
       680 
685 
     | 
    
         
             
                context.attr('role', this.get('ariaRole'));
         
     | 
| 
         @@ -999,7 +1004,7 @@ SC.CoreView.reopen( 
     | 
|
| 
       999 
1004 
     | 
    
         
             
                pv = this.get('parentView');
         
     | 
| 
       1000 
1005 
     | 
    
         
             
                if (pv) {
         
     | 
| 
       1001 
1006 
     | 
    
         
             
                  cf = pv.get('clippingFrame');
         
     | 
| 
       1002 
     | 
    
         
            -
                  if (!cf) return f;
         
     | 
| 
      
 1007 
     | 
    
         
            +
                  if (!cf) return { x: 0, y: 0, width: f.width, height: f.height};
         
     | 
| 
       1003 
1008 
     | 
    
         
             
                  ret = SC.intersectRects(cf, f);
         
     | 
| 
       1004 
1009 
     | 
    
         
             
                }
         
     | 
| 
       1005 
1010 
     | 
    
         
             
                ret.x -= f.x;
         
     | 
| 
         @@ -1236,7 +1241,7 @@ SC.CoreView.reopen( 
     | 
|
| 
       1236 
1241 
     | 
    
         | 
| 
       1237 
1242 
     | 
    
         
             
            });
         
     | 
| 
       1238 
1243 
     | 
    
         | 
| 
       1239 
     | 
    
         
            -
            SC.CoreView.mixin(/** @scope SC. 
     | 
| 
      
 1244 
     | 
    
         
            +
            SC.CoreView.mixin(/** @scope SC.CoreView.prototype */ {
         
     | 
| 
       1240 
1245 
     | 
    
         | 
| 
       1241 
1246 
     | 
    
         
             
              /** @private walk like a duck -- used by SC.Page */
         
     | 
| 
       1242 
1247 
     | 
    
         
             
              isViewClass: YES,
         
     | 
| 
         @@ -39,13 +39,20 @@ SC.View.reopen( 
     | 
|
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
              /**
         
     | 
| 
       41 
41 
     | 
    
         
             
                Invokved just after the responder loses key responder status.
         
     | 
| 
      
 42 
     | 
    
         
            +
                @param {SC.Responder} responder
         
     | 
| 
       42 
43 
     | 
    
         
             
              */
         
     | 
| 
       43 
44 
     | 
    
         
             
              didLoseKeyResponderTo: function(responder) {},
         
     | 
| 
       44 
45 
     | 
    
         | 
| 
       45 
46 
     | 
    
         
             
              /**
         
     | 
| 
       46 
47 
     | 
    
         
             
                Invoked just after the responder gains key responder status.
         
     | 
| 
      
 48 
     | 
    
         
            +
                By default, it calls focus on the view root element. For accessibility 
         
     | 
| 
      
 49 
     | 
    
         
            +
                purposes.
         
     | 
| 
      
 50 
     | 
    
         
            +
              
         
     | 
| 
      
 51 
     | 
    
         
            +
                @param {SC.Responder} responder
         
     | 
| 
       47 
52 
     | 
    
         
             
              */
         
     | 
| 
       48 
     | 
    
         
            -
              didBecomeKeyResponderFrom: function(responder) { 
     | 
| 
      
 53 
     | 
    
         
            +
              didBecomeKeyResponderFrom: function(responder) {
         
     | 
| 
      
 54 
     | 
    
         
            +
                this.$().focus();
         
     | 
| 
      
 55 
     | 
    
         
            +
              },
         
     | 
| 
       49 
56 
     | 
    
         | 
| 
       50 
57 
     | 
    
         
             
              /**
         
     | 
| 
       51 
58 
     | 
    
         
             
                This method will process a key input event, attempting to convert it to
         
     | 
| 
         @@ -276,7 +283,10 @@ SC.View.reopen( 
     | 
|
| 
       276 
283 
     | 
    
         
             
                  }
         
     | 
| 
       277 
284 
     | 
    
         | 
| 
       278 
285 
     | 
    
         
             
                  // if no parents have a next sibling, start over from the beginning
         
     | 
| 
       279 
     | 
    
         
            -
                  if(!next)  
     | 
| 
      
 286 
     | 
    
         
            +
                  if(!next) {
         
     | 
| 
      
 287 
     | 
    
         
            +
                    if(!SC.TABBING_ONLY_INSIDE_DOCUMENT) break;
         
     | 
| 
      
 288 
     | 
    
         
            +
                    else next = this.get('pane');
         
     | 
| 
      
 289 
     | 
    
         
            +
                  }
         
     | 
| 
       280 
290 
     | 
    
         | 
| 
       281 
291 
     | 
    
         
             
                  // if it's a valid firstResponder, we're done!
         
     | 
| 
       282 
292 
     | 
    
         
             
                  if(next.get('isVisibleInWindow') && next.get('acceptsFirstResponder')) return next;
         
     | 
| 
         @@ -287,7 +297,6 @@ SC.View.reopen( 
     | 
|
| 
       287 
297 
     | 
    
         | 
| 
       288 
298 
     | 
    
         
             
                // this will only happen if no views are visible and accept first responder
         
     | 
| 
       289 
299 
     | 
    
         
             
                return null;
         
     | 
| 
       290 
     | 
    
         
            -
             
     | 
| 
       291 
300 
     | 
    
         
             
              }.property('nextKeyView'),
         
     | 
| 
       292 
301 
     | 
    
         | 
| 
       293 
302 
     | 
    
         
             
              /**
         
     | 
| 
         @@ -355,6 +364,9 @@ SC.View.reopen( 
     | 
|
| 
       355 
364 
     | 
    
         
             
                  // normally, just try to get previous view's last child
         
     | 
| 
       356 
365 
     | 
    
         
             
                  if(cur.get('parentView')) prev = cur._getPreviousKeyView();
         
     | 
| 
       357 
366 
     | 
    
         | 
| 
      
 367 
     | 
    
         
            +
                  // if we are the pane and address bar tabbing is enabled, trigger it now
         
     | 
| 
      
 368 
     | 
    
         
            +
                  else if(!SC.TABBING_ONLY_INSIDE_DOCUMENT) break;
         
     | 
| 
      
 369 
     | 
    
         
            +
             
     | 
| 
       358 
370 
     | 
    
         
             
                  // if we are the pane, get our own last child
         
     | 
| 
       359 
371 
     | 
    
         
             
                  else prev = cur;
         
     | 
| 
       360 
372 
     | 
    
         | 
| 
         @@ -126,16 +126,22 @@ SC.View.reopen( 
     | 
|
| 
       126 
126 
     | 
    
         
             
                if(view.parentViewDidChange) view.parentViewDidChange();
         
     | 
| 
       127 
127 
     | 
    
         
             
                if(view.layoutDidChange) view.layoutDidChange();
         
     | 
| 
       128 
128 
     | 
    
         | 
| 
       129 
     | 
    
         
            -
                 
     | 
| 
       130 
     | 
    
         
            -
                if(pane && pane.get('isPaneAttached')) {
         
     | 
| 
       131 
     | 
    
         
            -
                  view._notifyDidAppendToDocument();
         
     | 
| 
       132 
     | 
    
         
            -
                }
         
     | 
| 
      
 129 
     | 
    
         
            +
                view.endPropertyChanges();
         
     | 
| 
       133 
130 
     | 
    
         | 
| 
       134 
     | 
    
         
            -
                //  
     | 
| 
       135 
     | 
    
         
            -
                 
     | 
| 
       136 
     | 
    
         
            -
                 
     | 
| 
      
 131 
     | 
    
         
            +
                // Make sure all notifications are delayed since the appending
         
     | 
| 
      
 132 
     | 
    
         
            +
                // doesn't complete until the end of the RunLoop
         
     | 
| 
      
 133 
     | 
    
         
            +
                // There may be better ways to do this than with invokeLast,
         
     | 
| 
      
 134 
     | 
    
         
            +
                // but it's the best I can do for now - PDW
         
     | 
| 
      
 135 
     | 
    
         
            +
                this.invokeLast(function(){
         
     | 
| 
      
 136 
     | 
    
         
            +
                  var pane = view.get('pane');
         
     | 
| 
      
 137 
     | 
    
         
            +
                  if(pane && pane.get('isPaneAttached')) {
         
     | 
| 
      
 138 
     | 
    
         
            +
                    view._notifyDidAppendToDocument();
         
     | 
| 
      
 139 
     | 
    
         
            +
                  }
         
     | 
| 
       137 
140 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
      
 141 
     | 
    
         
            +
                  // notify views
         
     | 
| 
      
 142 
     | 
    
         
            +
                  if (this.didAddChild) { this.didAddChild(view, beforeView) ; }
         
     | 
| 
      
 143 
     | 
    
         
            +
                  if (view.didAddToParent) { view.didAddToParent(this, beforeView) ; }
         
     | 
| 
      
 144 
     | 
    
         
            +
                });
         
     | 
| 
       139 
145 
     | 
    
         | 
| 
       140 
146 
     | 
    
         
             
                return this ;
         
     | 
| 
       141 
147 
     | 
    
         
             
              },
         
     | 
| 
         @@ -116,23 +116,6 @@ SC.View.reopen( 
     | 
|
| 
       116 
116 
     | 
    
         
             
                }
         
     | 
| 
       117 
117 
     | 
    
         
             
              }.property('baseThemeName', 'parentView').cacheable(),
         
     | 
| 
       118 
118 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
              /**
         
     | 
| 
       120 
     | 
    
         
            -
               * Returns the named property if it is specified on the view, and
         
     | 
| 
       121 
     | 
    
         
            -
               * otherwise returns the named constant from the view's theme.
         
     | 
| 
       122 
     | 
    
         
            -
               *
         
     | 
| 
       123 
     | 
    
         
            -
               * @param {String} property The property on the view.
         
     | 
| 
       124 
     | 
    
         
            -
               * @param {String} constantName The name of the constant on the theme.
         
     | 
| 
       125 
     | 
    
         
            -
              */
         
     | 
| 
       126 
     | 
    
         
            -
              getThemedProperty: function(property, constantName){
         
     | 
| 
       127 
     | 
    
         
            -
                var value = this.get(property);
         
     | 
| 
       128 
     | 
    
         
            -
                if (value !== undefined) { return value; }
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
                var theme = this.get('theme');
         
     | 
| 
       131 
     | 
    
         
            -
                if (!theme) { return undefined; }
         
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
                return theme[constantName];
         
     | 
| 
       134 
     | 
    
         
            -
              },
         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
119 
     | 
    
         
             
              /**
         
     | 
| 
       137 
120 
     | 
    
         
             
                The object to which rendering and updating the HTML representation of this
         
     | 
| 
       138 
121 
     | 
    
         
             
                view should be delegated.
         
     | 
| 
         @@ -253,9 +236,16 @@ SC.View.reopen( 
     | 
|
| 
       253 
236 
     | 
    
         
             
                original(context);
         
     | 
| 
       254 
237 
     | 
    
         | 
| 
       255 
238 
     | 
    
         
             
                var renderDelegate = this.get('renderDelegate');
         
     | 
| 
      
 239 
     | 
    
         
            +
                if (renderDelegate && renderDelegate.className) {
         
     | 
| 
      
 240 
     | 
    
         
            +
                  context.addClass(renderDelegate.className);
         
     | 
| 
      
 241 
     | 
    
         
            +
                }
         
     | 
| 
      
 242 
     | 
    
         
            +
                
         
     | 
| 
      
 243 
     | 
    
         
            +
                // @if(debug)
         
     | 
| 
       256 
244 
     | 
    
         
             
                if (renderDelegate && renderDelegate.name) {
         
     | 
| 
       257 
     | 
    
         
            -
                   
     | 
| 
      
 245 
     | 
    
         
            +
                  SC.Logger.error("Render delegates now use 'className' instead of 'name'.");
         
     | 
| 
      
 246 
     | 
    
         
            +
                  SC.Logger.error("Name '%@' will be ignored.", renderDelegate.name);
         
     | 
| 
       258 
247 
     | 
    
         
             
                }
         
     | 
| 
      
 248 
     | 
    
         
            +
                // @endif
         
     | 
| 
       259 
249 
     | 
    
         
             
              }.enhance()
         
     | 
| 
       260 
250 
     | 
    
         
             
            });
         
     | 
| 
       261 
251 
     | 
    
         | 
| 
         @@ -236,7 +236,7 @@ SC.FixturesDataSource = SC.DataSource.extend( 
     | 
|
| 
       236 
236 
     | 
    
         
             
                @param {SC.Store} store the store to load into
         
     | 
| 
       237 
237 
     | 
    
         
             
                @param {SC.Record} recordType the record type to load
         
     | 
| 
       238 
238 
     | 
    
         
             
                @param {SC.Array} ret is passed, array to add loaded storeKeys to.
         
     | 
| 
       239 
     | 
    
         
            -
                @returns {SC. 
     | 
| 
      
 239 
     | 
    
         
            +
                @returns {SC.FixturesDataSource} receiver
         
     | 
| 
       240 
240 
     | 
    
         
             
              */
         
     | 
| 
       241 
241 
     | 
    
         
             
              loadFixturesFor: function(store, recordType, ret) {
         
     | 
| 
       242 
242 
     | 
    
         
             
                var hashes   = [],
         
     | 
| 
         @@ -344,7 +344,17 @@ SC.FixturesDataSource = SC.DataSource.extend( 
     | 
|
| 
       344 
344 
     | 
    
         
             
                var ret = [], fixtures = this._fixtures[SC.guidFor(recordType)];
         
     | 
| 
       345 
345 
     | 
    
         
             
                return fixtures ? YES: NO;
         
     | 
| 
       346 
346 
     | 
    
         
             
              },
         
     | 
| 
       347 
     | 
    
         
            -
             
     | 
| 
      
 347 
     | 
    
         
            +
             
     | 
| 
      
 348 
     | 
    
         
            +
              /**
         
     | 
| 
      
 349 
     | 
    
         
            +
                Resets the fixtures to their original values.
         
     | 
| 
      
 350 
     | 
    
         
            +
             
     | 
| 
      
 351 
     | 
    
         
            +
                @returns {SC.FixturesDataSource} receiver
         
     | 
| 
      
 352 
     | 
    
         
            +
              */
         
     | 
| 
      
 353 
     | 
    
         
            +
              reset: function(){
         
     | 
| 
      
 354 
     | 
    
         
            +
                this._fixtures = null;
         
     | 
| 
      
 355 
     | 
    
         
            +
                return this;
         
     | 
| 
      
 356 
     | 
    
         
            +
              },
         
     | 
| 
      
 357 
     | 
    
         
            +
             
     | 
| 
       348 
358 
     | 
    
         
             
              /**
         
     | 
| 
       349 
359 
     | 
    
         
             
                Returns YES or SC.MIXED_STATE if one or more of the storeKeys can be 
         
     | 
| 
       350 
360 
     | 
    
         
             
                handled by the fixture data source.
         
     | 
| 
         @@ -0,0 +1,296 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
            /** @class
         
     | 
| 
      
 9 
     | 
    
         
            +
              Provides support for having relationships propagate by
         
     | 
| 
      
 10 
     | 
    
         
            +
              data provided by the data source.
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              This means the following interaction is now valid:
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  App = { store: SC.Store.create(SC.RelationshipSupport) };
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  App.Person = SC.Record.extend({
         
     | 
| 
      
 17 
     | 
    
         
            +
                    primaryKey: 'name',
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                    name: SC.Record.attr(String),
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    power: SC.Record.toOne('App.Power', {
         
     | 
| 
      
 22 
     | 
    
         
            +
                      isMaster: NO,
         
     | 
| 
      
 23 
     | 
    
         
            +
                      inverse: 'person'
         
     | 
| 
      
 24 
     | 
    
         
            +
                    })
         
     | 
| 
      
 25 
     | 
    
         
            +
                  });
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  App.Power = SC.Record.extend({
         
     | 
| 
      
 28 
     | 
    
         
            +
                    person: SC.Record.toOne('App.Person', {
         
     | 
| 
      
 29 
     | 
    
         
            +
                      isMaster: YES,
         
     | 
| 
      
 30 
     | 
    
         
            +
                      inverse: 'power'
         
     | 
| 
      
 31 
     | 
    
         
            +
                    })
         
     | 
| 
      
 32 
     | 
    
         
            +
                  });
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  var zan = App.store.createRecord(App.Person, { name: 'Zan' }),
         
     | 
| 
      
 35 
     | 
    
         
            +
                      jayna = App.store.createRecord(App.Person, { name: 'Janya' });
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  // Wondertwins activate!
         
     | 
| 
      
 38 
     | 
    
         
            +
                  var glacier = App.store.loadRecords(App.Power, [{
         
     | 
| 
      
 39 
     | 
    
         
            +
                    guid: 'petunia',  // Shape of...
         
     | 
| 
      
 40 
     | 
    
         
            +
                    person: 'Jayna'
         
     | 
| 
      
 41 
     | 
    
         
            +
                  }, {
         
     | 
| 
      
 42 
     | 
    
         
            +
                    guid: 'drizzle',  // Form of...
         
     | 
| 
      
 43 
     | 
    
         
            +
                    person: 'Zan'
         
     | 
| 
      
 44 
     | 
    
         
            +
                  }]);
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              Leveraging this mixin requires your records to be unambiguously
         
     | 
| 
      
 48 
     | 
    
         
            +
              defined. Note that this mixin does not take into account record
         
     | 
| 
      
 49 
     | 
    
         
            +
              relationship created / destroyed on `dataSourceDidComplete`,
         
     | 
| 
      
 50 
     | 
    
         
            +
              `writeAttribute`, etc. The only support here is for `pushRetrieve`,
         
     | 
| 
      
 51 
     | 
    
         
            +
              `pushDestroy`, and `loadRecords` (under the hood, `loadRecord(s)` uses
         
     | 
| 
      
 52 
     | 
    
         
            +
              `pushRetrieve`).
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              This mixin also supports lazily creating records when a related
         
     | 
| 
      
 55 
     | 
    
         
            +
              record is pushed in from the store (but it doesn't exist).
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              This means that the previous example could have been simplified
         
     | 
| 
      
 58 
     | 
    
         
            +
              to this:
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  App.Power = SC.Record.extend({
         
     | 
| 
      
 61 
     | 
    
         
            +
                    person: SC.Record.toOne('App.Person', {
         
     | 
| 
      
 62 
     | 
    
         
            +
                      isMaster: YES,
         
     | 
| 
      
 63 
     | 
    
         
            +
                      lazilyInstantiate: YES,
         
     | 
| 
      
 64 
     | 
    
         
            +
                      inverse: 'power'
         
     | 
| 
      
 65 
     | 
    
         
            +
                    })
         
     | 
| 
      
 66 
     | 
    
         
            +
                  });
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  // Wondertwins activate!
         
     | 
| 
      
 69 
     | 
    
         
            +
                  var glacier = App.store.loadRecords(App.Power, [{
         
     | 
| 
      
 70 
     | 
    
         
            +
                    guid: 'petunia',  // Shape of...
         
     | 
| 
      
 71 
     | 
    
         
            +
                    person: 'Jayna'
         
     | 
| 
      
 72 
     | 
    
         
            +
                  }, {
         
     | 
| 
      
 73 
     | 
    
         
            +
                    guid: 'drizzle',  // Form of...
         
     | 
| 
      
 74 
     | 
    
         
            +
                    person: 'Zan'
         
     | 
| 
      
 75 
     | 
    
         
            +
                  }]);
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
              When the `loadRecords` call is done, there will be four unmaterialized
         
     | 
| 
      
 79 
     | 
    
         
            +
              records in the store, giving the exact same result as the former
         
     | 
| 
      
 80 
     | 
    
         
            +
              example.
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
              As a side note, this mixin was developed primarily for use
         
     | 
| 
      
 83 
     | 
    
         
            +
              in a real-time backend that provides data to SproutCore
         
     | 
| 
      
 84 
     | 
    
         
            +
              as soon as it gets it (no transactions). This means streaming
         
     | 
| 
      
 85 
     | 
    
         
            +
              APIs / protocols like the Twitter streaming API or XMPP (an IM
         
     | 
| 
      
 86 
     | 
    
         
            +
              protocol) can be codified easier.
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
              @since SproutCore 1.6
         
     | 
| 
      
 89 
     | 
    
         
            +
             */
         
     | 
| 
      
 90 
     | 
    
         
            +
            SC.RelationshipSupport = {
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
              /** @private
         
     | 
| 
      
 93 
     | 
    
         
            +
                Relinquish many records.
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                This happens when a master record (`isMaster` = `YES`) removes a reference
         
     | 
| 
      
 96 
     | 
    
         
            +
                to related records, either through `pushRetrieve` or `pushDestroy`.
         
     | 
| 
      
 97 
     | 
    
         
            +
               */
         
     | 
| 
      
 98 
     | 
    
         
            +
              _srs_inverseDidRelinquishRelationships: function (recordType, ids, attr, inverseId) {
         
     | 
| 
      
 99 
     | 
    
         
            +
                ids.forEach(function (id) {
         
     | 
| 
      
 100 
     | 
    
         
            +
                  this._srs_inverseDidRelinquishRelationship(recordType, id, attr, inverseId);
         
     | 
| 
      
 101 
     | 
    
         
            +
                },this);
         
     | 
| 
      
 102 
     | 
    
         
            +
              },
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
              /** @private
         
     | 
| 
      
 105 
     | 
    
         
            +
                Relinquish the record, removing the reference of the record being
         
     | 
| 
      
 106 
     | 
    
         
            +
                destroyed on any related records.
         
     | 
| 
      
 107 
     | 
    
         
            +
               */
         
     | 
| 
      
 108 
     | 
    
         
            +
              _srs_inverseDidRelinquishRelationship: function (recordType, id, toAttr, relativeID) {
         
     | 
| 
      
 109 
     | 
    
         
            +
                var storeKey = recordType.storeKeyFor(id),
         
     | 
| 
      
 110 
     | 
    
         
            +
                  dataHash = this.readDataHash(storeKey),
         
     | 
| 
      
 111 
     | 
    
         
            +
                  key = toAttr.inverse,
         
     | 
| 
      
 112 
     | 
    
         
            +
                  proto = recordType.prototype;
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
                if (!dataHash || !key) return;
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
                if (SC.instanceOf(proto[key], SC.SingleAttribute)) {
         
     | 
| 
      
 117 
     | 
    
         
            +
                  delete dataHash[key];
         
     | 
| 
      
 118 
     | 
    
         
            +
                } else if (SC.instanceOf(proto[key], SC.ManyAttribute)
         
     | 
| 
      
 119 
     | 
    
         
            +
                           && SC.typeOf(dataHash[key]) === SC.T_ARRAY) {
         
     | 
| 
      
 120 
     | 
    
         
            +
                  dataHash[key].removeObject(relativeID);
         
     | 
| 
      
 121 
     | 
    
         
            +
                }
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
                this.pushRetrieve(recordType, id, dataHash, undefined, true);
         
     | 
| 
      
 124 
     | 
    
         
            +
              },
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
              /** @private
         
     | 
| 
      
 127 
     | 
    
         
            +
                Add a relationship to many inverse records.
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                This happens when a master record (`isMaster` = `YES`) adds a reference
         
     | 
| 
      
 130 
     | 
    
         
            +
                to another record on a `pushRetrieve`.
         
     | 
| 
      
 131 
     | 
    
         
            +
               */
         
     | 
| 
      
 132 
     | 
    
         
            +
              _srs_inverseDidAddRelationships: function (recordType, ids, attr, inverseId) {
         
     | 
| 
      
 133 
     | 
    
         
            +
                ids.forEach(function (id) {
         
     | 
| 
      
 134 
     | 
    
         
            +
                  this._srs_inverseDidAddRelationship(recordType, id, attr, inverseId);
         
     | 
| 
      
 135 
     | 
    
         
            +
                },this);
         
     | 
| 
      
 136 
     | 
    
         
            +
              },
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
              /** @private
         
     | 
| 
      
 140 
     | 
    
         
            +
                Add a relationship to an inverse record.
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
                If the flag lazilyInstantiate is set to YES, then the inverse record will be
         
     | 
| 
      
 143 
     | 
    
         
            +
                created lazily.
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                @param {SC.Record} recordType The inverse record type.
         
     | 
| 
      
 146 
     | 
    
         
            +
                @param {String} id The id of the recordType to add.
         
     | 
| 
      
 147 
     | 
    
         
            +
                @param {SC.RecordAttribute} toAttr The record attribute that represents
         
     | 
| 
      
 148 
     | 
    
         
            +
                  the relationship being created.
         
     | 
| 
      
 149 
     | 
    
         
            +
                @param {String} relativeID The ID of the model that needs to have it's
         
     | 
| 
      
 150 
     | 
    
         
            +
                  relationship updated.
         
     | 
| 
      
 151 
     | 
    
         
            +
               */
         
     | 
| 
      
 152 
     | 
    
         
            +
              _srs_inverseDidAddRelationship: function (recordType, id, toAttr, relativeID) {
         
     | 
| 
      
 153 
     | 
    
         
            +
                var storeKey = recordType.storeKeyFor(id),
         
     | 
| 
      
 154 
     | 
    
         
            +
                    dataHash = this.readDataHash(storeKey),
         
     | 
| 
      
 155 
     | 
    
         
            +
                    status = this.peekStatus(storeKey),
         
     | 
| 
      
 156 
     | 
    
         
            +
                    proto = recordType.prototype,
         
     | 
| 
      
 157 
     | 
    
         
            +
                    key = toAttr.inverse,
         
     | 
| 
      
 158 
     | 
    
         
            +
                    hashKey = proto[key],
         
     | 
| 
      
 159 
     | 
    
         
            +
                    primaryAttr = proto[proto.primaryKey],
         
     | 
| 
      
 160 
     | 
    
         
            +
                    shouldRecurse = false;
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                // in case the SC.RecordAttribute defines a `key` field, we need to use that
         
     | 
| 
      
 163 
     | 
    
         
            +
                hashKey = (hashKey && hashKey.get && hashKey.get('key') || hashKey.key) || key;
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                if ((status === SC.Record.EMPTY) &&
         
     | 
| 
      
 166 
     | 
    
         
            +
                    (SC.typeOf(toAttr.lazilyInstantiate) === SC.T_FUNCTION && toAttr.lazilyInstantiate() ||
         
     | 
| 
      
 167 
     | 
    
         
            +
                     SC.typeOf(toAttr.lazilyInstantiate) !== SC.T_FUNCTION && toAttr.lazilyInstantiate)) {
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                  if (!SC.none(primaryAttr) && primaryAttr.typeClass &&
         
     | 
| 
      
 170 
     | 
    
         
            +
                      SC.typeOf(primaryAttr.typeClass()) === SC.T_CLASS) {
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                    // Recurse to create the record that this primaryKey points to iff it
         
     | 
| 
      
 173 
     | 
    
         
            +
                    // also should be created if the record is empty.
         
     | 
| 
      
 174 
     | 
    
         
            +
                    // Identifies chained relationships where the object up the chain
         
     | 
| 
      
 175 
     | 
    
         
            +
                    // doesn't exist yet.
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
                    // TODO: this can lead to an infinite recursion if the relationship
         
     | 
| 
      
 178 
     | 
    
         
            +
                    // graph is cyclic
         
     | 
| 
      
 179 
     | 
    
         
            +
                    shouldRecurse = true;
         
     | 
| 
      
 180 
     | 
    
         
            +
                  }
         
     | 
| 
      
 181 
     | 
    
         
            +
                  dataHash = {};
         
     | 
| 
      
 182 
     | 
    
         
            +
                  dataHash[proto.primaryKey] = id;
         
     | 
| 
      
 183 
     | 
    
         
            +
                }
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
                if (!dataHash || !key) return;
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
                if (SC.instanceOf(proto[key], SC.SingleAttribute)) {
         
     | 
| 
      
 188 
     | 
    
         
            +
                  dataHash[hashKey] = relativeID;
         
     | 
| 
      
 189 
     | 
    
         
            +
                } else if (SC.instanceOf(proto[key], SC.ManyAttribute)) {
         
     | 
| 
      
 190 
     | 
    
         
            +
                  dataHash[hashKey] = dataHash[hashKey] || [];
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
                  if (dataHash[key].indexOf(relativeID) < 0) {
         
     | 
| 
      
 193 
     | 
    
         
            +
                    dataHash[hashKey].push(relativeID);
         
     | 
| 
      
 194 
     | 
    
         
            +
                  }
         
     | 
| 
      
 195 
     | 
    
         
            +
                }
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
                this.pushRetrieve(recordType, id, dataHash, undefined, !shouldRecurse);
         
     | 
| 
      
 198 
     | 
    
         
            +
              },
         
     | 
| 
      
 199 
     | 
    
         
            +
             
     | 
| 
      
 200 
     | 
    
         
            +
              // ..........................................................
         
     | 
| 
      
 201 
     | 
    
         
            +
              // ASYNCHRONOUS RECORD RELATIONSHIPS
         
     | 
| 
      
 202 
     | 
    
         
            +
              //
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
              /** @private
         
     | 
| 
      
 205 
     | 
    
         
            +
                Iterates over keys on the recordType prototype, looking for RecordAttributes
         
     | 
| 
      
 206 
     | 
    
         
            +
                that have relationships (toOne or toMany).
         
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                @param {SC.Record} recordType The record type to do introspection on to see
         
     | 
| 
      
 209 
     | 
    
         
            +
                  if it has any RecordAttributes that have relationships to other records.
         
     | 
| 
      
 210 
     | 
    
         
            +
                @param {String} id The id of the record being pushed in.
         
     | 
| 
      
 211 
     | 
    
         
            +
                @param {Number} storeKey The storeKey
         
     | 
| 
      
 212 
     | 
    
         
            +
               */
         
     | 
| 
      
 213 
     | 
    
         
            +
              _srs_pushIterator: function (recordType, id, storeKey, lambda) {
         
     | 
| 
      
 214 
     | 
    
         
            +
                var proto = recordType.prototype,
         
     | 
| 
      
 215 
     | 
    
         
            +
                    attr, currentHash, key, inverseType;
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
                if (typeof storeKey === "undefined") {
         
     | 
| 
      
 218 
     | 
    
         
            +
                  storeKey = recordType.storeKeyFor(id);
         
     | 
| 
      
 219 
     | 
    
         
            +
                }
         
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
      
 221 
     | 
    
         
            +
                currentHash = this.readDataHash(storeKey) || {};
         
     | 
| 
      
 222 
     | 
    
         
            +
             
     | 
| 
      
 223 
     | 
    
         
            +
                for (key in proto) {
         
     | 
| 
      
 224 
     | 
    
         
            +
                  attr = proto[key];
         
     | 
| 
      
 225 
     | 
    
         
            +
                  if (attr && attr.typeClass && attr.inverse && attr.isMaster) {
         
     | 
| 
      
 226 
     | 
    
         
            +
                    inverseType = attr.typeClass();
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
      
 228 
     | 
    
         
            +
                    if (SC.typeOf(inverseType) !== SC.T_CLASS) continue;
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
                    lambda.apply(this, [inverseType, currentHash, attr,
         
     | 
| 
      
 231 
     | 
    
         
            +
                                        attr.get && attr.get('key') || key]);
         
     | 
| 
      
 232 
     | 
    
         
            +
                  }
         
     | 
| 
      
 233 
     | 
    
         
            +
                }
         
     | 
| 
      
 234 
     | 
    
         
            +
              },
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
      
 236 
     | 
    
         
            +
             
     | 
| 
      
 237 
     | 
    
         
            +
              /**
         
     | 
| 
      
 238 
     | 
    
         
            +
                Disassociate records that are related to the one being destroyed iff this
         
     | 
| 
      
 239 
     | 
    
         
            +
                record has `isMaster` set to `YES`.
         
     | 
| 
      
 240 
     | 
    
         
            +
               */
         
     | 
| 
      
 241 
     | 
    
         
            +
              pushDestroy: function (original, recordType, id, storeKey) {
         
     | 
| 
      
 242 
     | 
    
         
            +
                var existingIDs;
         
     | 
| 
      
 243 
     | 
    
         
            +
             
     | 
| 
      
 244 
     | 
    
         
            +
                this._srs_pushIterator(recordType, id, storeKey,
         
     | 
| 
      
 245 
     | 
    
         
            +
                  function (inverseType, currentHash, toAttr, keyValue) {
         
     | 
| 
      
 246 
     | 
    
         
            +
                    // update old relationships
         
     | 
| 
      
 247 
     | 
    
         
            +
                    existingIDs = [currentHash[keyValue] || null].flatten().compact().uniq();
         
     | 
| 
      
 248 
     | 
    
         
            +
                    this._srs_inverseDidRelinquishRelationships(inverseType, existingIDs, toAttr, id);
         
     | 
| 
      
 249 
     | 
    
         
            +
                });
         
     | 
| 
      
 250 
     | 
    
         
            +
             
     | 
| 
      
 251 
     | 
    
         
            +
                return original(recordType, id, storeKey);
         
     | 
| 
      
 252 
     | 
    
         
            +
              }.enhance(),
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
              /**
         
     | 
| 
      
 255 
     | 
    
         
            +
                Associate records that are added via a pushRetrieve, and update subsequent
         
     | 
| 
      
 256 
     | 
    
         
            +
                relationships to ensure that the master-slave relationship is kept intact.
         
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
      
 258 
     | 
    
         
            +
                For use cases, see the test for pushRelationships.
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
                The `ignore` argument is only set to true when adding the inverse
         
     | 
| 
      
 261 
     | 
    
         
            +
                relationship (to prevent recursion).
         
     | 
| 
      
 262 
     | 
    
         
            +
               */
         
     | 
| 
      
 263 
     | 
    
         
            +
              pushRetrieve: function (original, recordType, id, dataHash, storeKey, ignore) {
         
     | 
| 
      
 264 
     | 
    
         
            +
                // avoid infinite recursions when additional changes are propogated
         
     | 
| 
      
 265 
     | 
    
         
            +
                // from `_srs_inverseDidAddRelationship`
         
     | 
| 
      
 266 
     | 
    
         
            +
                if (!ignore) {
         
     | 
| 
      
 267 
     | 
    
         
            +
                  var existingIDs, inverseIDs;
         
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
      
 269 
     | 
    
         
            +
                  this._srs_pushIterator(recordType, id, storeKey,
         
     | 
| 
      
 270 
     | 
    
         
            +
                    /** @ignore
         
     | 
| 
      
 271 
     | 
    
         
            +
                      @param {SC.Record} inverseType - in a Master-Slave
         
     | 
| 
      
 272 
     | 
    
         
            +
                      relationship when pushing master, Slave is the inverse type
         
     | 
| 
      
 273 
     | 
    
         
            +
                      @param {Object} currentHash - the hash in the data store (data to be replaced by `dataHash`)
         
     | 
| 
      
 274 
     | 
    
         
            +
                      @param {SC.RecordAttribute} toAttr - key in `recordType.prototype` that names isMaster and has an inverse
         
     | 
| 
      
 275 
     | 
    
         
            +
                      @param {String} keyValue - the property name in the datahash that defines this foreign key relationship
         
     | 
| 
      
 276 
     | 
    
         
            +
                     */
         
     | 
| 
      
 277 
     | 
    
         
            +
                    function (inverseType, currentHash, toAttr, keyValue) {
         
     | 
| 
      
 278 
     | 
    
         
            +
                      // update old relationships
         
     | 
| 
      
 279 
     | 
    
         
            +
                      existingIDs = [currentHash[keyValue] || null].flatten().compact().uniq();
         
     | 
| 
      
 280 
     | 
    
         
            +
             
     | 
| 
      
 281 
     | 
    
         
            +
                      // update new relationships
         
     | 
| 
      
 282 
     | 
    
         
            +
                      inverseIDs = [dataHash[keyValue] || null].flatten().compact().uniq();
         
     | 
| 
      
 283 
     | 
    
         
            +
             
     | 
| 
      
 284 
     | 
    
         
            +
                      this._srs_inverseDidRelinquishRelationships(inverseType, existingIDs.filter(
         
     | 
| 
      
 285 
     | 
    
         
            +
                        function (el) {
         
     | 
| 
      
 286 
     | 
    
         
            +
                          return inverseIDs.indexOf(el) === -1;
         
     | 
| 
      
 287 
     | 
    
         
            +
                        }), toAttr, id);
         
     | 
| 
      
 288 
     | 
    
         
            +
             
     | 
| 
      
 289 
     | 
    
         
            +
                      this._srs_inverseDidAddRelationships(inverseType, inverseIDs, toAttr, id);
         
     | 
| 
      
 290 
     | 
    
         
            +
                    });
         
     | 
| 
      
 291 
     | 
    
         
            +
                }
         
     | 
| 
      
 292 
     | 
    
         
            +
             
     | 
| 
      
 293 
     | 
    
         
            +
                storeKey = storeKey || recordType.storeKeyFor(id);
         
     | 
| 
      
 294 
     | 
    
         
            +
                return original(recordType, id, dataHash, storeKey);
         
     | 
| 
      
 295 
     | 
    
         
            +
              }.enhance()
         
     | 
| 
      
 296 
     | 
    
         
            +
            };
         
     |