sproutcore 1.10.1 → 1.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG +13 -0
  3. data/VERSION.yml +1 -1
  4. data/lib/frameworks/sproutcore/CHANGELOG.md +69 -31
  5. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +14 -0
  6. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js +14 -0
  7. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +7 -2
  8. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +13 -9
  9. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +57 -23
  10. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/enabled_states_test.js +24 -6
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +2 -2
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +63 -13
  13. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +3 -3
  14. data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +7 -1
  15. data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +28 -5
  16. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +15 -0
  17. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +30 -3
  18. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +23 -1
  19. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +135 -89
  20. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +12 -0
  21. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +18 -6
  22. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +58 -20
  23. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +1 -1
  24. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/methods.js +15 -1
  25. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +1 -1
  26. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +10 -0
  27. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
  28. data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +24 -23
  29. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +4 -0
  30. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +10 -0
  31. data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +4 -4
  32. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +33 -16
  33. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +14 -6
  34. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +23 -18
  35. data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +4 -4
  36. data/lib/frameworks/sproutcore/frameworks/foundation/tests/delegates/inline_text_field/inline_text_field.js +1 -0
  37. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_mixin_tests.js +78 -0
  38. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +45 -1
  39. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/content_value_support/content.js +112 -58
  40. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/image_queue.js +2 -2
  41. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +141 -0
  42. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +27 -2
  43. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +631 -593
  44. data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_fade_color_transition.js +5 -0
  45. data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_move_in_transition.js +5 -0
  46. data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_reveal_transition.js +68 -1
  47. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +128 -49
  48. data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +33 -8
  49. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +209 -187
  50. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  51. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +7 -0
  52. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +34 -4
  53. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -2
  54. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +68 -9
  55. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +2 -1
  56. data/lib/sproutcore/rack/builder.rb +45 -25
  57. data/sproutcore.gemspec +1 -0
  58. metadata +17 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzI3MjhhNWFhOGZkMDQ0NmY2OWRkMjIwZTYwNGZjYjUyODA2MjhhOA==
4
+ MmM2OWQzMTljMWNmN2U5OTczMWNkYjBlNTdkNGY1NjdiMjYyMjM0Mw==
5
5
  data.tar.gz: !binary |-
6
- ZjQ2ZjFiMWMxZTM5YWJiNDBlMTcxNzQ3NzNjYTljNmZlYWVkNTM4Yg==
6
+ N2NkMmVhOGVlOTg1MjFjNDM0MTUwNzcyOTY3Mzg2MTY5ZmVkOTQyMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MjI5MGY5MWJmYWI5Njg1MDM2ZThjMDEwMjM1NTlmMzc3MTI4YjlkYWE3NzI5
10
- YzFhNzc1NGQyZWYxYzcxNzZkZjExZDMxNDk4ZWYyMWU5OTQ0ZjA4NjYzNGE2
11
- OTU5NDg3Yzc2ODhiY2FhOGM4ODYzYzU5NjQxYmM1MGFmOGNkNDE=
9
+ NjBjNDc3NTczZjlkNmZmZTE2ZDI0OTM0YWY2MTkzZTUyNzM1YWU4MDBlMjg5
10
+ ZmUzNzM5ZmZmOGMwMTkxZGU1NjU1MWUzZTVkNzM0M2JiZmRlNTczYzNlYWM1
11
+ MjZmZjE1YTY4NzU2ODhhMjg2ODA2N2ZkZTBkMjE5ZjkwODM0MjQ=
12
12
  data.tar.gz: !binary |-
13
- OWQ4NDNjMGE0MzY5MGIxOTY5NWNiMTczNWMzMTQ5Yzk2ZTY1NTM2MTMyNDFl
14
- MjcxNzg0ZGE4N2QzMWZlMTg5ODc2YTZlYmNiOGE4M2YxNDNiYmE4MjM3NTFh
15
- MTk1ZDAyYTQ1ZTlkYTM1ZTc1MDkxODAxZDUzYWZlYjNiMWNjMWE=
13
+ NzMxNDA0ZWI5OGM4YmMxZGRmZjU2ZGI4NDg0NTg1MWZmOTdiMmQyYTFhMjVh
14
+ YWIxNzg5NmRhNjMwODI1NGNkM2IxYmUzOGI2Y2NlM2M2Yzc2ODY1MWFkMWE3
15
+ YzRkZjBmNTA4N2QyM2EyMTM1MGVkN2JmYThkMGQ0ZDMxZTM0ZTA=
data/CHANGELOG CHANGED
@@ -1,3 +1,16 @@
1
+ SproutCore 1.10.2
2
+ -----------------
3
+
4
+ * Uses a file system change listener rather than polling.
5
+
6
+ SproutCore 1.10.0
7
+ -----------------
8
+
9
+ * Added a :css_charset option to set the value of `@charset` inserted at the top of compiled stylesheets. NOTE: this does not solve the problem of concatenated stylesheets.
10
+ * Added a new :exclude option that can be used to tell Abbot to exclude directories from a build.
11
+ * Added default values to :whitelist/:blacklist/:accept help strings.
12
+ * Added sc-phantom command for running PhantomJS.
13
+
1
14
  *SproutCore 1.8.0 (March 06, 2012)*
2
15
 
3
16
  * Bumped the gem version to 1.8.0
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 10
4
- :patch: 1
4
+ :patch: 2
@@ -1,27 +1,77 @@
1
1
  CHANGE LOG
2
2
  ==========
3
3
 
4
+ 1.11.0
5
+ -----------
6
+
7
+ ### CHANGES & FEATURES
8
+
9
+ * Refactors SC.SceneView to support the new SC.ContainerView HW accelerate-able transitions.
10
+ * Add ie10 class to body element when detected (legacy).
11
+ * Improves the performance and code structure of SC.TreeItemObserver and SC.TreeController. Previously, the tree observer process was extremely inefficient. For one, the tree controller constantly destroyed and recreated item observer instances whenever its content changed. For another, the item observer observed all properties of its items so any property change (even those not associated with tree item content) would cause the item observer to check for changes to the item’s expanded state or children.
12
+ * Adds new SC.WebSocket class.
13
+
14
+ ### DEPRECATIONS & REMOVALS
15
+
16
+ ### BUG FIXES
17
+
18
+ * Some fixes for deprecated template view framework.
19
+
20
+ 1.10.2
21
+ -----------
22
+
23
+ ### INTERNAL CHANGES
24
+
25
+ * Added a Developer Error when attempting to add records without id's to relationships.
26
+ * Added a debug-mode only developer error to prevent double calls to materializeRecord from within materializeRecord. The result is duplicated objects that appear to be the same record instance but are in fact not, which can be very time-consuming to debug. Hopefully this saves developers a lot of grief.
27
+ * Added several *debug-mode only* `toString` methods for easy debugging.
28
+ * Added a tiny bit of debug mode only developer support. If manually connecting/disconnecting bindings it's possible to accidentally try to bind to a missing object. The normal stack trace this would produce is hard to follow so we present a more traceable error message with the stack.
29
+
30
+ ### BUG FIXES
31
+
32
+ * Fixed keypress handling in IE8 and Opera.
33
+ * Fixed the reveal swap transition plugin, SC.ContainerView.REVEAL, to properly reset the content view layout after transitioning out.
34
+ * Fixed a problem with SC.View.prototype.cancelAnimation(SC.LayoutState.CURRENT) that failed to stop at the proper top or left positions when using transform (HW accelerated) animations and the top or left values were negative.
35
+ * Fixed SC.ContentValueSupport to notify a change to each of the dependent content keys when the content changes entirely (i.e. the '*' property changed).
36
+ * Fixed SC.SelectView to render correctly when its items collection is replaced or the content changes.
37
+ * Fixed SC.AutoMixin to prevent the attributes from the former child views being applied to the latter child views.
38
+ * Fixed locally-scoped 'and' & 'or' bindings.
39
+ * Fixed a problem when the initial isEnabled value of a view is false that failed to update the isEnabledInPane value of that view and its child views.
40
+ * Fixed the problem that changing the isEnabled value of a view which had disabled ancestors could change the value of isEnabledInPane for the view to an improper value.
41
+ * Fixed SC.TextFieldView able to still be edited if it had focus while an ancestor view is disabled.
42
+ * Fixed the `defaultTabbingEnabled` property of SC.TextFieldView to actually prevent tabbing when the property is set to false. Also added insertBacktab handler support to interpretKeyEvents in order to prevent tabbing on shift-tab in SC.TextFieldView.
43
+ * Added missing support for touch events to SC.PopupButtonView.
44
+ * Fixed a bug that caused SC.TextFieldView hints to have a 0 line-height at times.
45
+ * Fixed regression in collection views so that they properly re-render when inside nested scroll views.
46
+ * Removes a duplicate listener on ‘selectstart’ events in SC.RootResponder.
47
+ * Removes the jQuery ready hold in SC.platform that was used to delay launching of the app until the transition and animation event names tests completed. Several browsers will not run the transition/animations in hidden tabs, which slows and possibly blocks an app from launching. Since the results of these tests are used only to optimize the event listeners set up in SC.RootResponder, the code has been changed to setup the root responder at whatever point the tests successfully finish.
48
+ * Fixed picker panes failing to popup in the wrong place if they have some form of resizing. Added an observer to SC.PickerPane border frames so that the pane will re-position itself if it changes size.
49
+ * Removes the appearance of an `undefined` attribute in SC.TextFieldView.
50
+ * Fixed internal identification of IE7 to prevent a possible future version of Trident from being mistaken for IE7.
51
+ * Fixed a minor memory leak when manually removing event listeners from an element.
52
+ * Fixed a memory leak when using SC.InlineTextField.
53
+
4
54
  1.10.1
5
55
  -----------
6
56
 
7
57
  ### BUG FIXES
8
58
 
9
59
  * Clean ups for http://docs.sproutcore.com.
10
- * Fixes memory leak in SC.ContentValueSupport.
11
- * Fixes layout bug with inline label view editor when used with child view layout plugins.
12
- * Fixes SC.Module loading on IE11+.
13
- * Fixes SC.Drag to fire `dragEnded` when cancelling a drag and drop operation
60
+ * Fixed memory leak in SC.ContentValueSupport.
61
+ * Fixed layout bug with inline label view editor when used with child view layout plugins.
62
+ * Fixed SC.Module loading on IE11+.
63
+ * Fixed SC.Drag to fire `dragEnded` when cancelling a drag and drop operation
14
64
  using the escape key.
15
- * Fixes missing non-retina image for SC.MenuPane.
65
+ * Fixed missing non-retina image for SC.MenuPane.
16
66
  * CollectionView: fix the selection on touchEnd. Previously when an item was touched two times, after the second touch it was no longer marked as selected even if it was (correctly) part of the collection's selection, its isSelected property was NO when it was supposed to be YES.
17
- * Fixes the code to show an insertion point for SC.GridView using @nicolasbadia's code. Adds a default style for SC.GridView's default insertion point that matches SC.ListView's default. Also improves the positioning of SC.ListView's insertion point so that the insertion view can specify a different height/right/width layout if wanted.
18
- * Fixes misplaced scroll view content when changing the content using touch scrolling. Reapplies the CSS transforms when touch scroll view's content frame changes. Because the CSS transforms are applied directly to the content view, if the content view's layout style changes, the transforms will be erased.
19
- * Fixes warnings when smoothly decelerating scrolling (includes performance improvement). Removes the necessity to trigger run loops while the scroll decelerates and only triggers the run loop when actually doing an update. This also removes an invoke warning if the first time the deceleration code runs (not within run loop) and doesn't have any velocity and so updates immediately.
67
+ * Fixed the code to show an insertion point for SC.GridView using @nicolasbadia's code. Adds a default style for SC.GridView's default insertion point that matches SC.ListView's default. Also improves the positioning of SC.ListView's insertion point so that the insertion view can specify a different height/right/width layout if wanted.
68
+ * Fixed misplaced scroll view content when changing the content using touch scrolling. Reapplies the CSS transforms when touch scroll view's content frame changes. Because the CSS transforms are applied directly to the content view, if the content view's layout style changes, the transforms will be erased.
69
+ * Fixed warnings when smoothly decelerating scrolling (includes performance improvement). Removes the necessity to trigger run loops while the scroll decelerates and only triggers the run loop when actually doing an update. This also removes an invoke warning if the first time the deceleration code runs (not within run loop) and doesn't have any velocity and so updates immediately.
20
70
  * Changes the theme class for SC.EmptyTheme from 'sc-empty' to 'sc-empty-theme'. This fixes the conflict with 'sc-empty' used by SC.ProgressViews that causes all progress views in apps using the empty theme to not have an inner border. This is a potentially conflicting change, but less dangerous than changing the class used by SC.ProgressView, because SC.EmptyTheme doesn't have any styles.
21
71
  * Fix issue with sending statechart events while state transitioning. `sendEvent` had a typo which allowed events to be sent while in the middle of a state transition. Fixing that revealed that now events sent during state transitions would be queued but never sent (at least not until another event was sent).
22
72
  * Resolved Handlebars escaping issue with ampersands.
23
73
  * Fix caching issue with SC.routes.informLocation. Since location and informLocation really just represent a single property, they both need to update the cached value for the opposite property.
24
- * Fixes regression with OS sniffing of Linux and Android in SC.browser.
74
+ * Fixed regression with OS sniffing of Linux and Android in SC.browser.
25
75
 
26
76
 
27
77
  1.10.0
@@ -32,27 +82,6 @@ using the escape key.
32
82
  * Allows adjust to be called after animate in the same run loop. Adjust can occur cleanly, which won't affect the animation or it can clash, in which case it will override the animation.
33
83
  * Improves internal code structure to support optimization by JS engines.
34
84
  * Makes the conditional that attempts to lock all textfields from receiving focus behind a modal pane, fail more quickly (this also prevents getting the pane on views that may not yet have a pane).
35
-
36
- ### DEPRECATIONS & REMOVALS
37
-
38
- * Removes 26.6MB of design files from within the framework. This means that these files are no longer downloaded and duplicated in each clone of the framework nor are any of them included in the gem (although many were stripped out of the gem anyhow). These files are still available at https://github.com/sproutcore/design.
39
-
40
- ### BUG FIXES
41
-
42
- * Removes the blockers that prevented all browsers that support touch events from using mouse events. Note: a browser's support of touch events is no indication of a touch capable device or even that the touch capable device will not need to send mouse events (via a plugged in mouse for example). When implementing touch support in a custom control, you should call evt.preventDefault in touchEnd to prevent additional mouse events from being sent by the browser.
43
- * Prevents extremely bizarre bug where an iPad will fail to detect the os in iOS, in spite of following the correct code path. The correct value is assigned to an array and then re-read from the same array a moment later. For some unknown reason, when the value is re-read from the array it would return the old value. Side effects of this are that all hacks looking for mobile safari would fail (including touch handling in text fields).
44
- * Fixes a regression in SC.ScrollView that threw an exception when beginning a new touch drag while a previous one was still decelerating.
45
- * Prevents successive clicks with two different mouse buttons from being considered a double click.
46
- * Fixes a bad conditional that coerced 0 frame widths to a false value. This caused excessive reloads of SC.GridView.
47
- * Fixes #1093 issue where a view would fail to be hidden if its pane was removed mid-transition.
48
- * Fixes #1087 issue with triggering and canceling animation in same runloop.
49
- * Fixes bug where PanelPane's ModalPane would appear if isModal becomes true while the PanelPane is transitioning out.
50
-
51
- 1.10.0.rc.1, 1.10.0.rc.2, 1.10.0.rc.3
52
- -----------
53
-
54
- ### CHANGES & FEATURES
55
-
56
85
  * Improves and adds hundreds of lines of documentation.
57
86
  * Removes a developer warning when animating with a duration of 0, which can be valid if the duration is calculated. In any case, animating a duration of 0 has always been supported by SC.View.prototype.animate.
58
87
  * Improves the regular expression used by SC.RenderContext to escape strings so that HTML entities like ' or à are preserved.
@@ -89,7 +118,7 @@ This code was essentially unreadable and did not even really work. There were lo
89
118
  * Reworks the isEnabled addition in order to allow for the enabled state to actively cascade to child views. While you could previously use the `isEnabledInPane` property to determine if any ancestor view had been disabled, it was lazily computed and not bindable. With this change, `isEnabledInPane` is updated actively, which means that it can be used to update the child view's display if wanted. For example, a view gets the 'disabled' class if isEnabled is set to false, but it can also add isEnabledInPane as a displayProperty and use it to appear disabled if any ancestor becomes disabled.
90
119
 
91
120
  This cascading can be blocked by any child view by setting `shouldInheritEnabled` to false, which allows you to set isEnabled on the top pane, but keep a section of child views separately enabled.
92
- * [internal] Fixes from the Office for Prevention of Redundancy Office: the 'focus' and 'disabled' classes are set accordingly on all SC.View subclasses. This removes yet one more display observer from SC.CollectionView.
121
+ * [internal] Fixed from the Office for Prevention of Redundancy Office: the 'focus' and 'disabled' classes are set accordingly on all SC.View subclasses. This removes yet one more display observer from SC.CollectionView.
93
122
  * Adds SC.View.POP transition, refactors the transition states of SC.View to handle changes in state in order to flip a transition animation smoothly and adds support for cancelling rotation or scale animations in place.
94
123
  * Removes two display observers from SC.ImageView and drops undocumented support for setting the value of an image as an array (which was parsed out into a single value for some reason.
95
124
  * [internal] Adds support for sprite images based on canvas. This fixes a bug when changing between a sprite and a URL type with the same image that created duplicate elements in the DOM.
@@ -345,6 +374,7 @@ tests that enforce the one-record-array-per-query contract.
345
374
 
346
375
  ### DEPRECATIONS & REMOVALS
347
376
 
377
+ * Removes 26.6MB of design files from within the framework. This means that these files are no longer downloaded and duplicated in each clone of the framework nor are any of them included in the gem (although many were stripped out of the gem anyhow). These files are still available at https://github.com/sproutcore/design.
348
378
  * Removes the long deprecated SC.Border mixin. This capability was brought into SC.View several versions ago.
349
379
  * Fully deprecates SC.InlineTextField class methods, which were labeled as "should no longer be used". This should make inline text field debugging easier to do.
350
380
  * Fully deprecates the fontWeight attribute of SC.LabelView.
@@ -381,6 +411,14 @@ Also added better documentation for using dataSourceDidFetchQuery.
381
411
 
382
412
  ### BUG FIXES
383
413
 
414
+ * Removes the blockers that prevented all browsers that support touch events from using mouse events. Note: a browser's support of touch events is no indication of a touch capable device or even that the touch capable device will not need to send mouse events (via a plugged in mouse for example). When implementing touch support in a custom control, you should call evt.preventDefault in touchEnd to prevent additional mouse events from being sent by the browser.
415
+ * Prevents extremely bizarre bug where an iPad will fail to detect the os in iOS, in spite of following the correct code path. The correct value is assigned to an array and then re-read from the same array a moment later. For some unknown reason, when the value is re-read from the array it would return the old value. Side effects of this are that all hacks looking for mobile safari would fail (including touch handling in text fields).
416
+ * Fixes a regression in SC.ScrollView that threw an exception when beginning a new touch drag while a previous one was still decelerating.
417
+ * Prevents successive clicks with two different mouse buttons from being considered a double click.
418
+ * Fixes a bad conditional that coerced 0 frame widths to a false value. This caused excessive reloads of SC.GridView.
419
+ * Fixes #1093 issue where a view would fail to be hidden if its pane was removed mid-transition.
420
+ * Fixes #1087 issue with triggering and canceling animation in same runloop.
421
+ * Fixes bug where PanelPane's ModalPane would appear if isModal becomes true while the PanelPane is transitioning out.
384
422
  * Fixes a problem which kept firstObject and lastObject referenced from an array controller from updating on replace. Also fixes a problem updating lastObject on an enumerable when replacing the last items and shrinking the collection.
385
423
  * Fixes a problem when using an SC.SplitView as a split child.
386
424
  * Fixes a bug that updating the parent record data hash failed to update the nested record hashes as well.
@@ -30,6 +30,20 @@ sc_require('mixins/selection_support');
30
30
  SC.ArrayController = SC.Controller.extend(SC.Array, SC.SelectionSupport,
31
31
  /** @scope SC.ArrayController.prototype */ {
32
32
 
33
+ //@if(debug)
34
+ /* BEGIN DEBUG ONLY PROPERTIES AND METHODS */
35
+
36
+ /* @private */
37
+ toString: function () {
38
+ var content = this.get('content'),
39
+ ret = sc_super();
40
+
41
+ return content ? "%@:\n ↳ %@".fmt(ret, content) : ret;
42
+ },
43
+
44
+ /* END DEBUG ONLY PROPERTIES AND METHODS */
45
+ //@endif
46
+
33
47
  // ..........................................................
34
48
  // PROPERTIES
35
49
  //
@@ -52,6 +52,20 @@ sc_require('controllers/controller') ;
52
52
  SC.ObjectController = SC.Controller.extend(
53
53
  /** @scope SC.ObjectController.prototype */ {
54
54
 
55
+ //@if(debug)
56
+ /* BEGIN DEBUG ONLY PROPERTIES AND METHODS */
57
+
58
+ /* @private */
59
+ toString: function () {
60
+ var content = this.get('content'),
61
+ ret = sc_super();
62
+
63
+ return content ? "%@:\n ↳ %@".fmt(ret, content) : ret;
64
+ },
65
+
66
+ /* END DEBUG ONLY PROPERTIES AND METHODS */
67
+ //@endif
68
+
55
69
  // ..........................................................
56
70
  // PROPERTIES
57
71
  //
@@ -383,10 +383,13 @@ SC.mixin(SC.Event, /** @scope SC.Event */ {
383
383
  // verify that there are still events registered on this element. If
384
384
  // there aren't, cleanup the element completely to avoid memory leaks.
385
385
  key = null ;
386
- for(key in events) break;
387
- if(!key) {
386
+ for (key in events) break;
387
+ if (!key) {
388
388
  SC.removeData(elem, "sc_events") ;
389
389
  delete this._elements[SC.guidFor(elem)]; // important to avoid leaks
390
+
391
+ // Clean up the cached listener to prevent a memory leak.
392
+ SC.removeData(elem, 'listener');
390
393
  }
391
394
 
392
395
  }
@@ -705,6 +708,7 @@ SC.mixin(SC.Event, /** @scope SC.Event */ {
705
708
  var guid = SC.guidFor(elem) ;
706
709
  this._elements[guid] = elem;
707
710
 
711
+ // Either retrieve the previously cached listener or cache a new one.
708
712
  listener = SC.data(elem, "listener") || SC.data(elem, "listener",
709
713
  function() {
710
714
  return SC.Event.handle.apply(SC.Event._elements[guid], arguments);
@@ -743,6 +747,7 @@ SC.mixin(SC.Event, /** @scope SC.Event */ {
743
747
  _removeEventListener: function(elem, eventType) {
744
748
  var listener, special = SC.Event.special[eventType] ;
745
749
  if (!special || (special.teardown.call(elem)===NO)) {
750
+ // Retrieve the cached listener.
746
751
  listener = SC.data(elem, "listener") ;
747
752
  if (listener) {
748
753
  if (elem.removeEventListener) {
@@ -440,14 +440,16 @@ SC.platform = SC.Object.create({
440
440
 
441
441
  });
442
442
 
443
-
444
443
  /** @private
445
444
  Test the transition and animation event names of this platform. We could hard
446
445
  code event names into the framework, but at some point things would change and
447
446
  we would get it wrong. Instead we perform actual tests to find out the proper
448
447
  names and only add the proper listeners.
448
+
449
+ Once the tests are completed the RootResponder is notified in order to add
450
+ transition and animation event listeners for the appropriate event names.
449
451
  */
450
- (function () {
452
+ SC.ready(function () {
451
453
  // This will add 4 different variations of the named event listener and clean
452
454
  // them up again.
453
455
  // Note: we pass in capitalizedEventName, because we can't just capitalize
@@ -481,7 +483,6 @@ SC.platform = SC.Object.create({
481
483
 
482
484
  // Call the clean up function, pass in success state.
483
485
  if (cleanUpFunc) { cleanUpFunc(!!evt); }
484
- jQuery.holdReady(NO);
485
486
  };
486
487
 
487
488
  // Set the initial value as unsupported.
@@ -493,9 +494,6 @@ SC.platform = SC.Object.create({
493
494
  el.addEventListener(lowerDomPrefix + standardEventName, callback, NO);
494
495
  el.addEventListener(lowerDomPrefix + capitalizedEventName, callback, NO);
495
496
  el.addEventListener(domPrefix + capitalizedEventName, callback, NO);
496
-
497
- // Delay the ready event for the tests to complete.
498
- jQuery.holdReady(YES);
499
497
  };
500
498
 
501
499
  // Set up and execute the transition event test.
@@ -508,12 +506,16 @@ SC.platform = SC.Object.create({
508
506
  // Test transition events.
509
507
  executeTest(transitionEl, 'transitionend', 'TransitionEnd', function (success) {
510
508
  // If an end event never fired, we can't really support CSS transitions in SproutCore.
511
- if (!success) {
509
+ if (success) {
510
+ // Set up the SC transition event listener.
511
+ SC.RootResponder.responder.setupTransitionListener();
512
+ } else {
512
513
  SC.platform.supportsCSSTransitions = NO;
513
514
  }
514
515
 
515
516
  transitionEl.parentNode.removeChild(transitionEl);
516
517
  transitionEl = null;
518
+
517
519
  });
518
520
 
519
521
  // Append the test element.
@@ -568,7 +570,7 @@ SC.platform = SC.Object.create({
568
570
  executeTest(animationEl, 'animationend', 'AnimationEnd', function (success) {
569
571
  // If an end event never fired, we can't really support CSS animations in SproutCore.
570
572
  if (success) {
571
- // Infer the start and iteration event names.
573
+ // Infer the start and iteration event names based on the success of the end event.
572
574
  var domPrefix = SC.browser.domPrefix,
573
575
  lowerDomPrefix = domPrefix.toLowerCase(),
574
576
  endEventName = SC.platform.animationendEventName;
@@ -591,6 +593,8 @@ SC.platform = SC.Object.create({
591
593
  SC.platform.animationiterationEventName = 'animationiteration';
592
594
  }
593
595
 
596
+ // Set up the SC animation event listeners.
597
+ SC.RootResponder.responder.setupAnimationListeners();
594
598
  } else {
595
599
  SC.platform.supportsCSSAnimations = NO;
596
600
  }
@@ -603,4 +607,4 @@ SC.platform = SC.Object.create({
603
607
  // Break execution to allow the browser to update the DOM before altering the style.
604
608
  document.documentElement.appendChild(animationEl);
605
609
  }
606
- })();
610
+ });
@@ -628,28 +628,12 @@ SC.RootResponder = SC.Object.extend(
628
628
  */
629
629
  setup: function () {
630
630
  // handle basic events
631
- this.listenFor(['touchstart', 'touchmove', 'touchend', 'touchcancel', 'keydown', 'keyup', 'beforedeactivate', 'mousedown', 'mouseup', 'click', 'dblclick', 'mousemove', 'selectstart', 'contextmenu'], document)
631
+ this.listenFor(['touchstart', 'touchmove', 'touchend', 'touchcancel', 'keydown', 'keyup', 'beforedeactivate', 'mousedown', 'mouseup', 'click', 'dblclick', 'mousemove', 'contextmenu'], document)
632
632
  .listenFor(['resize'], window);
633
633
 
634
634
  if (SC.browser.isIE8OrLower) this.listenFor(['focusin', 'focusout'], document);
635
635
  else this.listenFor(['focus', 'blur'], window);
636
636
 
637
- // CSS Transitions (tested asynchronously)
638
- if (SC.platform.supportsCSSTransitions) {
639
- // Ensure that the callback name used maps to our implemented function name.
640
- this[SC.platform.transitionendEventName] = this.transitionend;
641
- this.listenFor([SC.platform.transitionendEventName], document);
642
- }
643
-
644
- // CSS Animations (tested asynchronously)
645
- if (SC.platform.supportsCSSAnimations) {
646
- // Ensure that the callback name used maps to our implemented function name.
647
- this[SC.platform.animationstartEventName] = this.animationstart;
648
- this[SC.platform.animationendEventName] = this.animationend;
649
- this[SC.platform.animationiterationEventName] = this.animationiteration;
650
- this.listenFor([SC.platform.animationstartEventName, SC.platform.animationendEventName, SC.platform.animationiterationEventName], document);
651
- }
652
-
653
637
  // handle special case for keypress- you can't use normal listener to block
654
638
  // the backspace key on Mozilla
655
639
  if (this.keypress) {
@@ -778,6 +762,40 @@ SC.RootResponder = SC.Object.extend(
778
762
  }
779
763
  },
780
764
 
765
+ /**
766
+ Sets up the transition end event listener.
767
+
768
+ NOTE: requires that SC.platform.transitionendEventName has been determined.
769
+
770
+ @returns {void}
771
+ */
772
+ setupTransitionListener: function () {
773
+ // CSS Transitions (tested asynchronously)
774
+ if (SC.platform.supportsCSSTransitions) {
775
+ // Ensure that the callback name used maps to our implemented function name.
776
+ this[SC.platform.transitionendEventName] = this.transitionend;
777
+ this.listenFor([SC.platform.transitionendEventName], document);
778
+ }
779
+ },
780
+
781
+ /**
782
+ Sets up the animation event listeners.
783
+
784
+ NOTE: requires that SC.platform.animationstartEventName, SC.platform.animationendEventName & SC.platform.animationiterationEventName has been determined.
785
+
786
+ @returns {void}
787
+ */
788
+ setupAnimationListeners: function () {
789
+ // CSS Animations (tested asynchronously)
790
+ if (SC.platform.supportsCSSAnimations) {
791
+ // Ensure that the callback name used maps to our implemented function name.
792
+ this[SC.platform.animationstartEventName] = this.animationstart;
793
+ this[SC.platform.animationendEventName] = this.animationend;
794
+ this[SC.platform.animationiterationEventName] = this.animationiteration;
795
+ this.listenFor([SC.platform.animationstartEventName, SC.platform.animationendEventName, SC.platform.animationiterationEventName], document);
796
+ }
797
+ },
798
+
781
799
  // ...........................................................................
782
800
  // TOUCH SUPPORT
783
801
  //
@@ -1595,9 +1613,10 @@ SC.RootResponder = SC.Object.extend(
1595
1613
  Determines if the keyDown event is a nonprintable or function key. These
1596
1614
  kinds of events are processed as keyboard shortcuts. If no shortcut
1597
1615
  handles the event, then it will be sent as a regular keyDown event.
1616
+ This function is only valid when called with a keydown event.
1598
1617
  */
1599
- _isFunctionOrNonPrintableKey: function (evt) {
1600
- return !!(evt.altKey || evt.ctrlKey || evt.metaKey || ((evt.charCode !== evt.which) && SC.FUNCTION_KEYS[evt.which]));
1618
+ _isFunctionOrNonPrintableKey: function(evt) {
1619
+ return !!(evt.altKey || evt.ctrlKey || evt.metaKey || SC.FUNCTION_KEYS[evt.which]);
1601
1620
  },
1602
1621
 
1603
1622
  /** @private
@@ -1608,6 +1627,20 @@ SC.RootResponder = SC.Object.extend(
1608
1627
  return !!SC.MODIFIER_KEYS[evt.charCode];
1609
1628
  },
1610
1629
 
1630
+ /**
1631
+ @private
1632
+ Determines if the key is printable (and therefore should be dispatched from keypress).
1633
+ Some browsers send backspace, tab, enter, and escape on keypress, so we want to
1634
+ explicitly ignore those here.
1635
+
1636
+ @param {KeyboardEvent} evt keypress event
1637
+ @returns {Boolean}
1638
+ */
1639
+ _isPrintableKey: function(evt) {
1640
+ return ((evt.originalEvent.which === undefined || evt.originalEvent.which > 0) &&
1641
+ !(evt.which === 8 || evt.which === 9 || evt.which === 13 || evt.which === 27));
1642
+ },
1643
+
1611
1644
  /** @private
1612
1645
  The keydown event occurs whenever the physically depressed key changes.
1613
1646
  This event is used to deliver the flagsChanged event and to with function
@@ -1668,7 +1701,6 @@ SC.RootResponder = SC.Object.extend(
1668
1701
  // Arrow keys are handled in keypress for firefox
1669
1702
  if (keyCode >= 37 && keyCode <= 40 && SC.browser.isMozilla) return YES;
1670
1703
 
1671
-
1672
1704
  ret = this.sendEvent('keyDown', evt);
1673
1705
 
1674
1706
  // attempt key equivalent if key not handled
@@ -1702,6 +1734,7 @@ SC.RootResponder = SC.Object.extend(
1702
1734
  this.keydownCounter++;
1703
1735
  if (this.keydownCounter == 2) return YES;
1704
1736
  }
1737
+
1705
1738
  // delete is handled in keydown() for most browsers
1706
1739
  if (isFirefox && (evt.which === 8)) {
1707
1740
  //get the keycode and set it for which.
@@ -1717,10 +1750,11 @@ SC.RootResponder = SC.Object.extend(
1717
1750
 
1718
1751
  if ((charCode !== undefined && charCode === 0 && evt.keyCode !== 9) && !isFirefoxArrowKeys) return YES;
1719
1752
  if (isFirefoxArrowKeys) evt.which = keyCode;
1720
-
1721
1753
  // we only want to rethrow if this is a printable key so that we don't
1722
- // duplicate the event sent in keydown when a modifier key is pressed
1723
- if (isFirefoxArrowKeys || !this._isFunctionOrNonPrintableKey(evt)) return this.sendEvent('keyDown', evt) ? evt.hasCustomEventHandling:YES;
1754
+ // duplicate the event sent in keydown when a modifier key is pressed.
1755
+ if (isFirefoxArrowKeys || this._isPrintableKey(evt)) {
1756
+ return this.sendEvent('keyDown', evt) ? evt.hasCustomEventHandling : YES;
1757
+ }
1724
1758
  }
1725
1759
  },
1726
1760
 
@@ -4,8 +4,7 @@
4
4
  // ©2008-2011 Apple Inc. All rights reserved.
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
-
8
- /*global module test equals ok */
7
+ /*global module, test, equals, ok */
9
8
 
10
9
  var parent, view, child;
11
10
 
@@ -41,6 +40,25 @@ test("Test initial states.", function () {
41
40
  ok(child.get('isEnabledInPane'), "isEnabledInPane should be true");
42
41
  });
43
42
 
43
+ test("Test initial disabled states.", function () {
44
+ var newChild = SC.View.create({}),
45
+ newView = SC.View.create({ isEnabled: false, childViews: [newChild] }),
46
+ newParent;
47
+
48
+ equals(newView.enabledState, SC.CoreView.DISABLED, "A disabled on creation view should be in the state");
49
+ equals(newChild.enabledState, SC.CoreView.DISABLED_BY_PARENT, "A regular child view of disabled on creation parent should be in the state");
50
+
51
+ newParent = SC.View.create({ isEnabled: false, childViews: [newView] });
52
+
53
+ equals(newParent.enabledState, SC.CoreView.DISABLED, "A disabled on creation parent view should be in the state");
54
+ equals(newView.enabledState, SC.CoreView.DISABLED_AND_BY_PARENT, "A disabled on creation view of disabled on creation parent should be in the state");
55
+ equals(newChild.enabledState, SC.CoreView.DISABLED_BY_PARENT, "A regular child view of disabled on creation parent should be in the state");
56
+
57
+ newParent.destroy();
58
+ newView.destroy();
59
+ newChild.destroy();
60
+ });
61
+
44
62
  /**
45
63
  Test changing isEnabled to false on the child.
46
64
  */
@@ -92,7 +110,7 @@ test("Test toggling isEnabled on view.", function () {
92
110
  SC.run(function () {
93
111
  equals(parent.enabledState, SC.CoreView.ENABLED, "A regular parent view should be in the state");
94
112
  equals(view.enabledState, SC.CoreView.DISABLED, "A disabled view should be in the state");
95
- equals(child.enabledState, SC.CoreView.DISABLED, "A disabled child view with disabled ancestor should be in the state");
113
+ equals(child.enabledState, SC.CoreView.DISABLED_AND_BY_PARENT, "A disabled child view with disabled ancestor should be in the state");
96
114
  ok(parent.get('isEnabled'), "isEnabled should be true");
97
115
  ok(parent.get('isEnabledInPane'), "isEnabledInPane should be true");
98
116
  ok(!view.get('isEnabled'), "isEnabled should be false");
@@ -148,7 +166,7 @@ test("Test toggling isEnabled on parent.", function () {
148
166
  SC.run(function () {
149
167
  equals(parent.enabledState, SC.CoreView.DISABLED, "A disabled parent view should be in the state");
150
168
  equals(view.enabledState, SC.CoreView.DISABLED_BY_PARENT, "A regular view with disabled parent should be in the state");
151
- equals(child.enabledState, SC.CoreView.DISABLED, "A disabled child view with disabled ancestor should be in the state");
169
+ equals(child.enabledState, SC.CoreView.DISABLED_AND_BY_PARENT, "A disabled child view with disabled ancestor should be in the state");
152
170
  ok(!parent.get('isEnabled'), "isEnabled should be false");
153
171
  ok(!parent.get('isEnabledInPane'), "isEnabledInPane should be false");
154
172
  ok(view.get('isEnabled'), "view isEnabled should be true");
@@ -204,7 +222,7 @@ test("Test toggling isEnabled on view.", function () {
204
222
  SC.run(function () {
205
223
  equals(parent.enabledState, SC.CoreView.ENABLED, "A regular parent view should be in the state");
206
224
  equals(view.enabledState, SC.CoreView.DISABLED, "A disabled view should be in the state");
207
- equals(child.enabledState, SC.CoreView.DISABLED, "A disabled child view with disabled ancestor should be in the state");
225
+ equals(child.enabledState, SC.CoreView.DISABLED_AND_BY_PARENT, "A disabled child view with disabled ancestor should be in the state");
208
226
  ok(parent.get('isEnabled'), "isEnabled should be true");
209
227
  ok(parent.get('isEnabledInPane'), "isEnabledInPane should be true");
210
228
  ok(!view.get('isEnabled'), "isEnabled should be false");
@@ -328,7 +346,7 @@ test("Test optimized display update.", function () {
328
346
  parent.destroyLayer();
329
347
  });
330
348
 
331
- test("initializing with isEnabled: false, should still add the proper class on append", function() {
349
+ test("initializing with isEnabled: false, should still add the proper class on append", function () {
332
350
  var newView = SC.View.create({
333
351
  isEnabled: false
334
352
  });
@@ -591,8 +591,8 @@ SC.View.reopen(
591
591
  if (matrix.m11 < 0) ret.scale = ret.scale * -1;
592
592
 
593
593
  // Retrieve translateX & translateY
594
- if (matrix.e > 0) { ret.left = matrix.e; }
595
- if (matrix.f > 0) { ret.top = matrix.f; }
594
+ ret.left = matrix.e;
595
+ ret.top = matrix.f;
596
596
  } else {
597
597
  matrix = matrix.match(/^matrix\((.*)\)$/)[1].split(/,\s*/);
598
598
  if (matrix) {