sproutcore 1.0.1037 → 1.0.1042

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. data/History.txt +31 -0
  2. data/README.txt +3 -1
  3. data/Rakefile +11 -4
  4. data/VERSION.yml +3 -3
  5. data/buildtasks/build.rake +5 -0
  6. data/frameworks/sproutcore/Buildfile +3 -1
  7. data/frameworks/sproutcore/frameworks/animation/Buildfile +3 -0
  8. data/frameworks/sproutcore/frameworks/animation/LICENSE +25 -0
  9. data/frameworks/sproutcore/frameworks/animation/README.md +102 -0
  10. data/frameworks/sproutcore/frameworks/animation/core.js +934 -0
  11. data/frameworks/sproutcore/frameworks/animation/tests/core.js +65 -0
  12. data/frameworks/sproutcore/frameworks/datastore/models/record.js +28 -16
  13. data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +5 -2
  14. data/frameworks/sproutcore/frameworks/datastore/system/many_array.js +4 -0
  15. data/frameworks/sproutcore/frameworks/datastore/system/query.js +27 -13
  16. data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +36 -6
  17. data/frameworks/sproutcore/frameworks/datastore/system/store.js +7 -7
  18. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/storeDidChangeProperties.js +2 -1
  19. data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +13 -0
  20. data/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +250 -0
  21. data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -12
  22. data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +3 -6
  23. data/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +0 -8
  24. data/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +0 -4
  25. data/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +1 -0
  26. data/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +0 -1
  27. data/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
  28. data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -1
  29. data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +11 -4
  30. data/frameworks/sproutcore/frameworks/desktop/panes/palette.js +2 -0
  31. data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -5
  32. data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +24 -23
  33. data/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +91 -60
  34. data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +124 -24
  35. data/frameworks/sproutcore/frameworks/desktop/system/drag.js +5 -5
  36. data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +33 -25
  37. data/frameworks/sproutcore/frameworks/desktop/tests/panes/pane_page.js +41 -0
  38. data/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/methods.js +30 -1
  39. data/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/ui.js +13 -0
  40. data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +27 -21
  41. data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +81 -1
  42. data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +3 -4
  43. data/frameworks/sproutcore/frameworks/desktop/views/button.js +65 -36
  44. data/frameworks/sproutcore/frameworks/desktop/views/collection.js +4 -7
  45. data/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +8 -4
  46. data/frameworks/sproutcore/frameworks/desktop/views/list.js +1 -1
  47. data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +38 -5
  48. data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +5 -1
  49. data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +4 -1
  50. data/frameworks/sproutcore/frameworks/desktop/views/progress.js +19 -13
  51. data/frameworks/sproutcore/frameworks/desktop/views/radio.js +30 -2
  52. data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +2 -3
  53. data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +14 -17
  54. data/frameworks/sproutcore/frameworks/desktop/views/select_field.js +5 -3
  55. data/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -2
  56. data/frameworks/sproutcore/frameworks/desktop/views/split.js +58 -59
  57. data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -1
  58. data/frameworks/sproutcore/frameworks/desktop/views/well.js +1 -1
  59. data/frameworks/sproutcore/frameworks/foundation/core.js +6 -0
  60. data/frameworks/sproutcore/frameworks/foundation/english.lproj/view.css +2 -1
  61. data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +33 -30
  62. data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +8 -4
  63. data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +15 -10
  64. data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +61 -12
  65. data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +2 -1
  66. data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +151 -131
  67. data/frameworks/sproutcore/frameworks/foundation/system/datetime.js +29 -23
  68. data/frameworks/sproutcore/frameworks/foundation/system/event.js +18 -10
  69. data/frameworks/sproutcore/frameworks/foundation/system/page.js +7 -5
  70. data/frameworks/sproutcore/frameworks/foundation/system/ready.js +1 -0
  71. data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +9 -6
  72. data/frameworks/sproutcore/frameworks/foundation/system/request.js +41 -6
  73. data/frameworks/sproutcore/frameworks/foundation/system/response.js +89 -24
  74. data/frameworks/sproutcore/frameworks/foundation/system/routes.js +1 -1
  75. data/frameworks/sproutcore/frameworks/foundation/system/utils.js +0 -1
  76. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +27 -8
  77. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +6 -6
  78. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_style.js +2 -2
  79. data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +65 -3
  80. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +1 -1
  81. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/convertLayouts.js +145 -0
  82. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js +48 -0
  83. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/nextValidKeyView.js +91 -0
  84. data/frameworks/sproutcore/frameworks/foundation/validators/number.js +9 -5
  85. data/frameworks/sproutcore/frameworks/foundation/views/field.js +16 -14
  86. data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +89 -67
  87. data/frameworks/sproutcore/frameworks/foundation/views/view.js +221 -73
  88. data/frameworks/sproutcore/frameworks/runtime/core.js +43 -22
  89. data/frameworks/sproutcore/frameworks/runtime/mixins/array.js +6 -0
  90. data/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +1 -1
  91. data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +53 -34
  92. data/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +7 -3
  93. data/frameworks/sproutcore/frameworks/runtime/system/binding.js +19 -19
  94. data/frameworks/sproutcore/frameworks/runtime/system/logger.js +132 -88
  95. data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -9
  96. data/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +6 -0
  97. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +69 -0
  98. data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +14 -2
  99. data/frameworks/sproutcore/license.js +3 -1
  100. data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
  101. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_222222.png +0 -0
  102. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_454545.png +0 -0
  103. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_888888.png +0 -0
  104. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_ffffff.png +0 -0
  105. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/panels/sprite-x.png +0 -0
  106. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/panels/sprite-y.png +0 -0
  107. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
  108. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-ysprite.png +0 -0
  109. data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +15 -1
  110. data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu_item_view.css +9 -0
  111. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panel.css +33 -0
  112. data/frameworks/sproutcore/themes/standard_theme/english.lproj/picker.css +17 -0
  113. data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +9 -6
  114. data/frameworks/sproutcore/themes/standard_theme/english.lproj/tab.css +0 -4
  115. data/frameworks/sproutcore/themes/standard_theme/english.lproj/well.css +36 -0
  116. data/gen/controller/templates/controllers/@filename@.js +1 -1
  117. data/lib/sproutcore/builders/minify.rb +45 -13
  118. data/lib/sproutcore/helpers/static_helper.rb +2 -2
  119. data/lib/sproutcore/models/manifest_entry.rb +42 -1
  120. data/lib/sproutcore/tools/build.rb +18 -2
  121. data/spec/lib/models/manifest_entry/hyperdomain_prefix.rb +34 -0
  122. data/vendor/yui-compressor/SCyuicompressor-2.4.2.jar +0 -0
  123. metadata +28 -22
  124. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-fat.jpg +0 -0
  125. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-thin.jpg +0 -0
  126. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-edge.png +0 -0
  127. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-left-corner.png +0 -0
  128. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-right-corner.png +0 -0
  129. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/left-edge.png +0 -0
  130. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/overlay.png +0 -0
  131. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/right-edge.png +0 -0
  132. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-edge.png +0 -0
  133. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-left-corner.png +0 -0
  134. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-right-corner.png +0 -0
@@ -3,7 +3,7 @@
3
3
  // Copyright: ©2006-2009 Apple Inc. and contributors.
4
4
  // License: Licened under MIT license (see license.js)
5
5
  // ==========================================================================
6
- var b;
6
+ var b, counter;
7
7
 
8
8
  module("SC.ButtonView#actions", {
9
9
  setup: function() {
@@ -43,3 +43,83 @@ test("Test different moused states", function() {
43
43
  });
44
44
 
45
45
 
46
+ module("SC.ButtonView#actions - SC.HOLD_BEHAVIOR", {
47
+ setup: function() {
48
+ counter = SC.Object.create({
49
+ value: 0,
50
+ increment: function(){
51
+ this.set('value', this.get('value') + 1);
52
+ }
53
+ });
54
+
55
+ b = SC.ButtonView.create({
56
+ buttonBehavior: SC.HOLD_BEHAVIOR,
57
+ holdInterval: 5,
58
+ target: counter,
59
+ action: 'increment',
60
+
61
+ // Is it a bad idea to stub like this? If we don't do it this way, we need to set up a Pane
62
+ _runAction: function(evt) {
63
+ var action = this.get('action'),
64
+ target = this.get('target') || null;
65
+
66
+ target[action]();
67
+ }
68
+ });
69
+ }
70
+ });
71
+
72
+ test('Test triggerAction only happens once', function(){
73
+ b.triggerAction();
74
+
75
+ var assertions = function(){
76
+ equals(counter.get('value'), 1, "should only run action once");
77
+ start();
78
+ };
79
+
80
+ stop();
81
+ setTimeout(assertions, 10);
82
+ });
83
+
84
+ // This test is not nearly reliable enough
85
+ test("Test action repeats while active", function(){
86
+ b.set('isActive', YES);
87
+ b._action();
88
+
89
+ var assertions = function(){
90
+ // The actual number of times in not entirely predictable since there can be delays beyond the holdInterval
91
+ console.log('counter', counter.get('value'));
92
+ ok(counter.get('value') > 2, "should have run more than 2 times");
93
+ b.set('isActive', NO); // Stops triggering
94
+ start();
95
+ };
96
+
97
+ stop();
98
+ setTimeout(assertions, 100);
99
+ });
100
+
101
+ test("Test action happens on mouseDown", function(){
102
+ b.mouseDown();
103
+ equals(counter.get('value'), 1, "should have run once");
104
+ b.set('isActive', NO); // Stops triggering
105
+ });
106
+
107
+ test("Test action does not happen on mouseUp", function(){
108
+ b._isMouseDown = YES;
109
+ b.mouseUp();
110
+ equals(counter.get('value'), 0, "should not have run");
111
+ });
112
+
113
+ test("Should stop when inactive", function(){
114
+ b.set('isActive', YES);
115
+ b._action();
116
+ b.set('isActive', NO);
117
+
118
+ var assertions = function(){
119
+ equals(counter.get('value'), 1, "should only run action once");
120
+ start();
121
+ };
122
+
123
+ stop();
124
+ setTimeout(assertions, 10);
125
+ });
@@ -83,9 +83,8 @@ test("clicking on a radio button will change toggle the value", function() {
83
83
 
84
84
  test("pressing mouseDown and then mouseUp anywhere in a radio button should toggle the selection", function() {
85
85
  var elem = view.get('layer'), input = SC.$('input', elem);
86
-
87
- SC.Event.trigger(elem, 'mousedown');
88
- ok(view.get('isActive'), 'view should be active');
86
+ SC.Event.trigger(input[0], 'mousedown');
87
+ ok(view.$('label').first().hasClass('active'), 'radio button should be active');
89
88
  equals(view.get('value'), 'Red', 'value should not change yet');
90
89
 
91
90
  // simulate mouseUp and browser-native change to control
@@ -94,7 +93,7 @@ test("pressing mouseDown and then mouseUp anywhere in a radio button should togg
94
93
  // loose focus of the element since it was changed
95
94
  SC.Event.trigger(input.get(1),'click');
96
95
 
97
- ok(!view.get('isActive'), 'view should no longer be active');
96
+ ok(!view.$('label').first().hasClass('active'), 'radio button should no longer be active');
98
97
  equals(view.get('value'), undefined, 'value should be undefined (none checked)');
99
98
 
100
99
  input = elem = null ;
@@ -11,7 +11,8 @@
11
11
  SC.TOGGLE_BEHAVIOR = 'toggle';
12
12
  SC.PUSH_BEHAVIOR = 'push';
13
13
  SC.TOGGLE_ON_BEHAVIOR = "on";
14
- SC.TOGGLE_OFF_BEHAVIOR = "off" ;
14
+ SC.TOGGLE_OFF_BEHAVIOR = "off" ;
15
+ SC.HOLD_BEHAVIOR = 'hold' ;
15
16
 
16
17
  /** @class
17
18
 
@@ -56,6 +57,13 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
56
57
  */
57
58
  buttonBehavior: SC.PUSH_BEHAVIOR,
58
59
 
60
+ /*
61
+ If buttonBehavior is SC.HOLD_BEHAVIOR, this specifies, in miliseconds, how often to trigger the action.
62
+ Ignored for other behaviors.
63
+ */
64
+
65
+ holdInterval: 100,
66
+
59
67
  /**
60
68
  If YES, then this button will be triggered when you hit return.
61
69
 
@@ -122,7 +130,7 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
122
130
  triggerAction: function(evt) {
123
131
  if (!this.get('isEnabled')) return NO;
124
132
  this.set('isActive', YES);
125
- this._action(evt);
133
+ this._action(evt, YES);
126
134
  this.didTriggerAction();
127
135
  this.invokeLater('set', 200, 'isActive', NO);
128
136
  return true;
@@ -228,11 +236,15 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
228
236
  On mouse down, set active only if enabled.
229
237
  */
230
238
  mouseDown: function(evt) {
239
+ var buttonBehavior = this.get('buttonBehavior');
240
+
231
241
  if (!this.get('isEnabled')) return YES ; // handled event, but do nothing
232
242
  this.set('isActive', YES);
233
243
  this._isMouseDown = YES;
234
244
 
235
- if (!this._isFocused && (this.get('buttonBehavior')!==SC.PUSH_BEHAVIOR)) {
245
+ if (buttonBehavior === SC.HOLD_BEHAVIOR) {
246
+ this._action(evt);
247
+ } else if (!this._isFocused && (buttonBehavior!==SC.PUSH_BEHAVIOR)) {
236
248
  this._isFocused = YES ;
237
249
  this.becomeFirstResponder();
238
250
  if (this.get('isVisibleInWindow')) {
@@ -265,9 +277,13 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
265
277
  mouseUp: function(evt) {
266
278
  if (this._isMouseDown) this.set('isActive', NO); // track independently in case isEnabled has changed
267
279
  this._isMouseDown = false;
268
- var inside = this.$().within(evt.target) ;
269
- if (inside && this.get('isEnabled')) this._action(evt) ;
270
- return true ;
280
+
281
+ if (this.get('buttonBehavior') !== SC.HOLD_BEHAVIOR) {
282
+ var inside = this.$().within(evt.target) ;
283
+ if (inside && this.get('isEnabled')) this._action(evt) ;
284
+ }
285
+
286
+ return YES ;
271
287
  },
272
288
 
273
289
 
@@ -275,7 +291,8 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
275
291
  // handle tab key
276
292
  if (evt.which === 9) {
277
293
  var view = evt.shiftKey ? this.get('previousValidKeyView') : this.get('nextValidKeyView');
278
- view.becomeFirstResponder();
294
+ if(view) view.becomeFirstResponder();
295
+ else evt.allowDefault();
279
296
  return YES ; // handled
280
297
  }
281
298
  if (evt.which === 13) {
@@ -292,7 +309,7 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
292
309
  - off behavior: turn off.
293
310
  - otherwise: invoke target/action
294
311
  */
295
- _action: function(evt) {
312
+ _action: function(evt, skipHoldRepeat) {
296
313
  switch(this.get('buttonBehavior')) {
297
314
 
298
315
  // When toggling, try to invert like values. i.e. 1 => 0, etc.
@@ -314,20 +331,42 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
314
331
  case SC.TOGGLE_OFF_BEHAVIOR:
315
332
  this.set('value', this.get('toggleOffValue')) ;
316
333
  break ;
317
-
334
+
335
+ case SC.HOLD_BEHAVIOR:
336
+ this._runHoldAction(evt, skipHoldRepeat);
337
+ break ;
338
+
318
339
  // otherwise, just trigger an action if there is one.
319
340
  default:
320
341
  //if (this.action) this.action(evt);
321
- var action = this.get('action'),
322
- target = this.get('target') || null;
323
- if (action) {
324
- if (this._hasLegacyActionHandler()) {
325
- // old school...
326
- this._triggerLegacyActionHandler(evt);
327
- } else {
328
- // newer action method + optional target syntax...
329
- this.getPath('pane.rootResponder').sendAction(action, target, this, this.get('pane'));
330
- }
342
+ this._runAction(evt);
343
+ }
344
+ },
345
+
346
+ _runAction: function(evt) {
347
+ var action = this.get('action'),
348
+ target = this.get('target') || null;
349
+
350
+ if (action) {
351
+ if (this._hasLegacyActionHandler()) {
352
+ // old school...
353
+ this._triggerLegacyActionHandler(evt);
354
+ } else {
355
+ // newer action method + optional target syntax...
356
+ this.getPath('pane.rootResponder').sendAction(action, target, this, this.get('pane'));
357
+ }
358
+ }
359
+ },
360
+
361
+ _runHoldAction: function(evt, skipRepeat) {
362
+ if (this.get('isActive')) {
363
+ this._runAction();
364
+
365
+ if (!skipRepeat) {
366
+ // This run loop appears to only be necessary for testing
367
+ SC.RunLoop.begin();
368
+ this.invokeLater('_runHoldAction', this.get('holdInterval'), evt);
369
+ SC.RunLoop.end();
331
370
  }
332
371
  }
333
372
  },
@@ -336,8 +375,8 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
336
375
  _hasLegacyActionHandler: function()
337
376
  {
338
377
  var action = this.get('action');
339
- if (action && (SC.typeOf(action) == SC.T_FUNCTION)) return true;
340
- if (action && (SC.typeOf(action) == SC.T_STRING) && (action.indexOf('.') != -1)) return true;
378
+ if (action && (SC.typeOf(action) === SC.T_FUNCTION)) return true;
379
+ if (action && (SC.typeOf(action) === SC.T_STRING) && (action.indexOf('.') != -1)) return true;
341
380
  return false;
342
381
  },
343
382
 
@@ -347,8 +386,8 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
347
386
  if (!this._hasLegacyActionHandler()) return false;
348
387
 
349
388
  var action = this.get('action');
350
- if (SC.typeOf(action) == SC.T_FUNCTION) this.action(evt);
351
- if (SC.typeOf(action) == SC.T_STRING) {
389
+ if (SC.typeOf(action) === SC.T_FUNCTION) this.action(evt);
390
+ if (SC.typeOf(action) === SC.T_STRING) {
352
391
  eval("this.action = function(e) { return "+ action +"(this, e); };");
353
392
  this.action(evt);
354
393
  }
@@ -356,8 +395,9 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
356
395
 
357
396
  /** tied to the isEnabled state */
358
397
  acceptsFirstResponder: function() {
359
- return this.get('isEnabled');
360
- }.property('isEnabled'),
398
+ if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
399
+ else return NO;
400
+ }.property('isEnabled'),
361
401
 
362
402
  willBecomeKeyResponderFrom: function(keyView) {
363
403
  // focus the text field.
@@ -372,17 +412,6 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
372
412
 
373
413
  willLoseKeyResponderTo: function(responder) {
374
414
  if (this._isFocused) this._isFocused = NO ;
375
- },
376
-
377
- didCreateLayer: function() {
378
- //Fix for IE7 min-with bug
379
- if(SC.browser.msie<8) {
380
- var buttonInner = this.$('.sc-button-inner')[0];
381
- if (buttonInner){
382
- var mL = buttonInner.style.marginLeft;
383
- this.$('.sc-button-label')[0].style.minWidth=this.get('titleMinWidth')-mL;
384
- }
385
- }
386
415
  }
387
416
 
388
417
  }) ;
@@ -803,7 +803,7 @@ SC.CollectionView = SC.View.extend(
803
803
  nowShowing = this.get('nowShowing'),
804
804
  itemViews = this._sc_itemViews,
805
805
  containerView = this.get('containerView') || this,
806
- views, idx, cvlen, view, childViews, layer ;
806
+ views, idx, view, layer ;
807
807
 
808
808
  // if the set is defined but it contains the entire nowShowing range, just
809
809
  // replace
@@ -812,15 +812,12 @@ SC.CollectionView = SC.View.extend(
812
812
 
813
813
  // if an index set, just update indexes
814
814
  if (invalid.isIndexSet) {
815
- childViews = containerView.get('childViews');
816
- cvlen = childViews.get('length');
817
815
 
818
816
  if (bench) {
819
817
  SC.Benchmark.start(bench="%@#reloadIfNeeded (Partial)".fmt(this),YES);
820
818
  }
821
819
 
822
820
  invalid.forEach(function(idx) {
823
-
824
821
  // get the existing item view, if there is one
825
822
  var existing = itemViews ? itemViews[idx] : null;
826
823
 
@@ -904,7 +901,7 @@ SC.CollectionView = SC.View.extend(
904
901
  child views still need to be added, go ahead and add them.
905
902
  */
906
903
  render: function(context, firstTime) {
907
- if (firstTime && this._needsReload) this.reloadIfNeeded ;
904
+ if (firstTime && this._needsReload) this.reloadIfNeeded() ;
908
905
 
909
906
  // add classes for other state.
910
907
  context.setClass('focus', this.get('isFirstResponder'));
@@ -1224,8 +1221,8 @@ SC.CollectionView = SC.View.extend(
1224
1221
  reloadSelectionIndexes: function(indexes) {
1225
1222
  var invalid = this._invalidSelection ;
1226
1223
  if (indexes && (invalid !== YES)) {
1227
- if (invalid) invalid.add(indexes)
1228
- else invalid = this._invalidSelection = indexes.copy();
1224
+ if (invalid) { invalid.add(indexes) ; }
1225
+ else { invalid = this._invalidSelection = indexes.copy(); }
1229
1226
 
1230
1227
  } else this._invalidSelection = YES ; // force a total reload
1231
1228
 
@@ -37,11 +37,15 @@ SC.DisclosureView = SC.ButtonView.extend(
37
37
 
38
38
  /** @private */
39
39
  render: function(context, firstTime) {
40
- context.push('<img src="', SC.BLANK_IMAGE_URL, '" class="button" alt="" />');
41
- if(this.get('needsEllipsis')){
42
- context.push('<label class="ellipsis">',this.get('displayTitle'),'</label>');
43
- }else{
40
+ if(firstTime){
41
+ context.push('<img src="', SC.BLANK_IMAGE_URL, '" class="button" alt="" />');
42
+ if(this.get('needsEllipsis')){
43
+ context.push('<label class="ellipsis">',this.get('displayTitle'),'</label>');
44
+ }else{
44
45
  context.push('<label>',this.get('displayTitle'),'</label>');
46
+ }
47
+ }else{
48
+ this.$('label')[0].text = this.get('displayTitle');
45
49
  }
46
50
  },
47
51
 
@@ -308,7 +308,7 @@ SC.ListView = SC.CollectionView.extend(
308
308
  var ret = this._sclv_layout;
309
309
  if (!ret) ret = this._sclv_layout = {};
310
310
  ret.minHeight = this.rowOffsetForContentIndex(this.get('length'))+4;
311
- this.calculatedHeight = ret.minHeight;
311
+ this.set('calculatedHeight',ret.minHeight);
312
312
  return ret ;
313
313
  },
314
314
 
@@ -241,7 +241,7 @@ SC.ListItemView = SC.View.extend(
241
241
  this.renderCount(working, value) ;
242
242
  var digits = ['zero', 'one', 'two', 'three', 'four', 'five'];
243
243
  var digit = (value.toString().length < digits.length) ? digits[value.toString().length] : digits[digits.length-1];
244
- context.addClass('has-count %@-digit'.fmt(digit));
244
+ context.addClass('has-count '+digit+'-digit');
245
245
  }
246
246
 
247
247
  // handle action
@@ -281,7 +281,7 @@ SC.ListItemView = SC.View.extend(
281
281
  html = cache[key];
282
282
 
283
283
  if (!html) {
284
- html = cache[key] = '<img src="%@" class="disclosure button %@" />'.fmt(SC.BLANK_IMAGE_URL, key);
284
+ html = cache[key] = '<img src="'+SC.BLANK_IMAGE_URL+'" class="disclosure button '+key+'" />';
285
285
  }
286
286
 
287
287
  context.push(html);
@@ -453,7 +453,7 @@ SC.ListItemView = SC.View.extend(
453
453
 
454
454
  var el = SC.$(evt.target) ;
455
455
  var ret = NO, classNames ;
456
- while(!ret && el.length>0 && (el.get(0) !== layer)) {
456
+ while(!ret && el.length>0 && (el[0] !== layer)) {
457
457
  if (el.hasClass(className)) ret = YES ;
458
458
  el = el.parent() ;
459
459
  }
@@ -480,6 +480,15 @@ SC.ListItemView = SC.View.extend(
480
480
  return this._isInsideElementWithClassName('disclosure', evt);
481
481
  },
482
482
 
483
+ /** @private
484
+ Returns YES if the list item has a right icon and the event
485
+ occurred inside of it.
486
+ */
487
+ _isInsideRightIcon: function(evt) {
488
+ var del = this.displayDelegate ;
489
+ var rightIconKey = this.getDelegateProperty('hasContentRightIcon', del) ;
490
+ return rightIconKey && this._isInsideElementWithClassName('right-icon', evt);
491
+ },
483
492
 
484
493
  /** @private
485
494
  mouseDown is handled only for clicks on the checkbox view or or action
@@ -503,7 +512,11 @@ SC.ListItemView = SC.View.extend(
503
512
  this._isMouseDownOnDisclosure = YES;
504
513
  this._isMouseInsideDisclosure = YES ;
505
514
  return YES;
506
-
515
+ } else if (this._isInsideRightIcon(evt)) {
516
+ this._addRightIconActiveState();
517
+ this._isMouseDownOnRightIcon = YES;
518
+ this._isMouseInsideRightIcon = YES ;
519
+ return YES;
507
520
  }
508
521
 
509
522
  return NO ; // let the collection view handle this event
@@ -555,11 +568,17 @@ SC.ListItemView = SC.View.extend(
555
568
 
556
569
  this._removeDisclosureActiveState();
557
570
  ret = YES ;
571
+ // if mouse was down in right icon -- then handle mouse up, otherwise
572
+ // allow parent view to handle event.
573
+ } else if (this._isMouseDownOnRightIcon) {
574
+ this._removeRightIconActiveState() ;
575
+ ret = YES ;
558
576
  }
559
577
 
560
578
  // clear cached info
561
579
  this._isMouseInsideCheckbox = this._isMouseDownOnCheckbox = NO ;
562
580
  this._isMouseDownOnDisclosure = this._isMouseInsideDisclosure = NO ;
581
+ this._isMouseInsideRightIcon = this._isMouseDownOnRightIcon = NO ;
563
582
  return ret ;
564
583
  },
565
584
 
@@ -571,6 +590,9 @@ SC.ListItemView = SC.View.extend(
571
590
  } else if (this._isMouseDownOnDisclosure) {
572
591
  this._removeDisclosureActiveState();
573
592
  this._isMouseInsideDisclosure = NO ;
593
+ } else if (this._isMouseDownOnRightIcon) {
594
+ this._removeRightIconActiveState();
595
+ this._isMouseInsideRightIcon = NO ;
574
596
  }
575
597
  return NO ;
576
598
  },
@@ -583,6 +605,9 @@ SC.ListItemView = SC.View.extend(
583
605
  } else if (this._isMouseDownOnDisclosure) {
584
606
  this._addDisclosureActiveState();
585
607
  this._isMouseInsideDisclosure = YES;
608
+ } else if (this._isMouseDownOnRightIcon) {
609
+ this._addRightIconActiveState();
610
+ this._isMouseInsideRightIcon = YES;
586
611
  }
587
612
  return NO ;
588
613
  },
@@ -604,6 +629,14 @@ SC.ListItemView = SC.View.extend(
604
629
  _removeDisclosureActiveState: function() {
605
630
  this.$('img.disclosure').removeClass('active');
606
631
  },
632
+
633
+ _addRightIconActiveState: function() {
634
+ this.$('img.right-icon').setClass('active', YES);
635
+ },
636
+
637
+ _removeRightIconActiveState: function() {
638
+ this.$('img.right-icon').removeClass('active');
639
+ },
607
640
 
608
641
  /**
609
642
  Returns true if a click is on the label text itself to enable editing.
@@ -622,7 +655,7 @@ SC.ListItemView = SC.View.extend(
622
655
  if (!labelKey) return NO ;
623
656
 
624
657
  // get the element to check for.
625
- var el = this.$label().get(0) ;
658
+ var el = this.$label()[0] ;
626
659
  if (!el) return NO ; // no label to check for.
627
660
 
628
661
  var cur = evt.target, layer = this.get('layer') ;