sproutcore 1.4.2-java → 1.4.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG +11 -0
  2. data/Rakefile +27 -436
  3. data/VERSION.yml +1 -1
  4. data/lib/frameworks/sproutcore/CHANGELOG +32 -2
  5. data/lib/frameworks/sproutcore/frameworks/animation/core.js +1 -1
  6. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +8 -2
  7. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +42 -2
  8. data/lib/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +7 -12
  9. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +22 -1
  10. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +1 -1
  11. data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +6 -2
  12. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +1 -1
  13. data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +38 -10
  14. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +8 -8
  15. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +1 -1
  16. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +12 -5
  17. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +3 -3
  18. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +14 -9
  19. data/lib/frameworks/sproutcore/frameworks/foundation/system/datetime.js +3 -1
  20. data/lib/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +25 -17
  21. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +46 -36
  22. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/validatable/ui.js +1 -1
  23. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +5 -0
  24. data/lib/frameworks/sproutcore/frameworks/foundation/tests/validators/not_empty.js +56 -0
  25. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
  26. data/lib/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js +7 -3
  27. data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
  28. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +1 -1
  29. data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +1 -1
  30. data/lib/frameworks/sproutcore/frameworks/media/views/media_slider.js +1 -1
  31. data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +1 -1
  32. data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +1 -1
  33. data/lib/frameworks/sproutcore/frameworks/media/views/video.js +1 -1
  34. data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +1 -1
  35. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +18 -23
  36. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +13 -0
  37. data/lib/sproutcore/builders/base.rb +4 -4
  38. data/lib/sproutcore/builders/javascript.rb +0 -7
  39. data/lib/sproutcore/builders/stylesheet.rb +0 -7
  40. data/lib/sproutcore/rack/proxy.rb +28 -13
  41. metadata +4 -4
  42. data/DISTRIBUTION.yml +0 -20
@@ -219,17 +219,17 @@ SC.Button = {
219
219
 
220
220
  var valueKey = this.getDelegateProperty('contentValueKey', del) ;
221
221
  if (valueKey && (key === valueKey || key === '*')) {
222
- this.set('value', content ? content.get(valueKey) : null) ;
222
+ this.set('value', content ? (content.get ? content.get(valueKey) : content[valueKey]) : null) ;
223
223
  }
224
224
 
225
225
  var titleKey = this.getDelegateProperty('contentTitleKey', del) ;
226
226
  if (titleKey && (key === titleKey || key === '*')) {
227
- this.set('title', content ? content.get(titleKey) : null) ;
227
+ this.set('title', content ? (content.get ? content.get(titleKey) : content[titleKey]) : null) ;
228
228
  }
229
229
 
230
230
  var iconKey = this.getDelegateProperty('contentIconKey', del);
231
231
  if (iconKey && (key === iconKey || key === '*')) {
232
- this.set('icon', content ? content.get(iconKey) : null) ;
232
+ this.set('icon', content ? (content.get ? content.get(iconKey) : content[iconKey]) : null) ;
233
233
  }
234
234
 
235
235
  return this ;
@@ -54,7 +54,7 @@ sc_require('views/text_field') ;
54
54
  editor expects your source view to implement the InlineTextFieldViewDelegate
55
55
  protocol.
56
56
 
57
- h2. Commiting or Discarding Changes
57
+ h2. Committing or Discarding Changes
58
58
 
59
59
  Normally the editor will automatically commit or discard its changes
60
60
  whenever the user exits the edit mode. If you need to force the editor to
@@ -66,13 +66,13 @@ sc_require('views/text_field') ;
66
66
  }}}
67
67
 
68
68
  Both methods will try to end the editing context and will call the
69
- relevent delegate methods on the delegate you passed to beginEditing().
69
+ relevant delegate methods on the delegate you passed to beginEditing().
70
70
 
71
71
  Note that it is possible an editor may not be able to commit editing
72
72
  changes because either the delegate disallowed it or because its validator
73
73
  failed. In this case commitEditing() will return NO. If you want to
74
74
  end editing anyway, you can discard the editing changes instead by calling
75
- discardEditing(). This method will generally suceed unless your delegate
75
+ discardEditing(). This method will generally succeed unless your delegate
76
76
  refuses it as well.
77
77
 
78
78
  @extends SC.TextFieldView
@@ -133,7 +133,9 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
133
133
  throw "At least frame and delegate options are required for inline editor";
134
134
  }
135
135
 
136
- this._originalValue = options.value || '' ;
136
+ this._originalValue = options.value;
137
+ if (SC.none(this._originalValue))
138
+ this._originalValue = "";
137
139
  this._multiline = (options.multiline !== undefined) ? options.multiline : NO ;
138
140
  if (this._multiline) {
139
141
  this.set('isTextArea', YES);
@@ -420,10 +422,11 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
420
422
  // editable, begins editing.
421
423
  /** @private */
422
424
  insertTab: function(evt) {
425
+ var delegate = this._delegate; // removed by commitEditing()
423
426
  this.resignFirstResponder();
424
427
  this.commitEditing() ;
425
- if(this._delegate){
426
- var next = this._delegate.nextValidKeyView();
428
+ if(delegate){
429
+ var next = delegate.get('nextValidKeyView');
427
430
  if(next && next.beginEditing) next.beginEditing();
428
431
  }
429
432
  return YES ;
@@ -431,10 +434,12 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
431
434
 
432
435
  /** @private */
433
436
  insertBacktab: function(evt) {
437
+ var delegate = this._delegate; // removed by commitEditing()
438
+ this.resignFirstResponder();
434
439
  this.commitEditing() ;
435
- if(this._delegate){
436
- var prev = this._delegate.previousValidKeyView();
437
- if(prev) prev.beginEditing();
440
+ if(delegate){
441
+ var prev = delegate.get('previousValidKeyView');
442
+ if(prev && prev.beginEditing) prev.beginEditing();
438
443
  }
439
444
  return YES ;
440
445
  },
@@ -893,7 +893,9 @@ SC.DateTime.mixin(SC.Comparable,
893
893
  @returns {DateTime} the DateTime corresponding to the string parameter
894
894
  */
895
895
  parse: function(str, fmt) {
896
- var re = /(?:\%([aAbBcdHIjmMpSUWwxXyYZ\%])|(.))/g;
896
+ // Declared as an object not a literal since in some browsers the literal
897
+ // retains state across function calls
898
+ var re = new RegExp('(?:%([aAbBcdHIjmMpSUWwxXyYZ%])|(.))', "g");
897
899
  var d, parts, opts = {}, check = {}, scanner = SC.Scanner.create({string: str});
898
900
 
899
901
  if (SC.none(fmt)) fmt = SC.DATETIME_ISO8601;
@@ -1808,29 +1808,37 @@ SC.RootResponder = SC.Object.extend({
1808
1808
  } else {
1809
1809
  var lh = this._lastHovered || [] , nh = [] , exited, loc, len,
1810
1810
  view = this.targetViewForEvent(evt) ;
1811
-
1812
- // work up the view chain. Notify of mouse entered and
1813
- // mouseMoved if implemented.
1814
- while(view && (view !== this)) {
1811
+
1812
+ // first collect all the responding view starting with the
1813
+ // target view from the given mouse move event
1814
+ while (view && (view !== this)) {
1815
+ nh.push(view);
1816
+ view = view.get('nextResponder');
1817
+ }
1818
+
1819
+ // next exit views that are no longer part of the
1820
+ // responding chain
1821
+ for (loc=0, len=lh.length; loc < len; loc++) {
1822
+ view = lh[loc] ;
1823
+ exited = view.respondsTo('mouseExited');
1824
+ if (exited && nh.indexOf(view) === -1) {
1825
+ view.tryToPerform('mouseExited', evt);
1826
+ }
1827
+ }
1828
+
1829
+ // finally, either perform mouse moved or mouse entered depending on
1830
+ // whether a responding view was or was not part of the last
1831
+ // hovered views
1832
+ for (loc=0, len=nh.length; loc < len; loc++) {
1833
+ view = nh[loc];
1815
1834
  if (lh.indexOf(view) !== -1) {
1816
1835
  view.tryToPerform('mouseMoved', evt);
1817
- nh.push(view) ;
1818
1836
  } else {
1819
1837
  view.tryToPerform('mouseEntered', evt);
1820
- nh.push(view) ;
1821
- }
1822
-
1823
- view = view.get('nextResponder');
1824
- }
1825
- // now find those views last hovered over that were no longer found
1826
- // in this chain and notify of mouseExited.
1827
- for(loc=0, len=lh.length; loc < len; loc++) {
1828
- view = lh[loc] ;
1829
- exited = view.respondsTo('mouseExited') ;
1830
- if (exited && !(nh.indexOf(view) !== -1)) {
1831
- view.tryToPerform('mouseExited',evt);
1832
1838
  }
1833
1839
  }
1840
+
1841
+ // Keep track of the view that were last hovered
1834
1842
  this._lastHovered = nh;
1835
1843
 
1836
1844
  // also, if a mouseDownView exists, call the mouseDragged action, if
@@ -6,7 +6,7 @@
6
6
  // ==========================================================================
7
7
  /*global module test htmlbody ok equals same stop start Q$ */
8
8
 
9
- var pane, optionsForLabel1, optionsForLabel2, delegate;
9
+ var pane, optionsForLabel1, optionsForLabel2, delegate, optionsForLabelFromView;
10
10
 
11
11
  pane = SC.ControlTestPane.design().add("label1", SC.LabelView, {
12
12
  value: 'Some Text',
@@ -50,6 +50,30 @@ pane.resetView = function(view) {
50
50
  view.set('notifiedDidBegin', NO);
51
51
  };
52
52
 
53
+
54
+ optionsForLabelFromView = function(view) {
55
+ var el = view.$(),
56
+ f = SC.viewportOffset(el[0]),
57
+ frameTemp = view.convertFrameFromView(view.get('frame'), null);
58
+
59
+ f.width = frameTemp.width;
60
+ f.height = frameTemp.height;
61
+
62
+ var optionsForLabel = {
63
+ frame: f,
64
+ delegate: view,
65
+ exampleElement: view.$(),
66
+ value: view.get('value'),
67
+ multiline: view.get('isInlineEditorMultiline'),
68
+ isCollection: NO,
69
+ validator: view.get('validator'),
70
+ exampleInlineTextFieldView: view.get('exampleInlineTextFieldView')
71
+ };
72
+
73
+ return optionsForLabel;
74
+ };
75
+
76
+
53
77
  /**
54
78
 
55
79
  */
@@ -64,41 +88,8 @@ module("Test the beginEditing() function of SC.InlineTextFieldView", {
64
88
  // Reset view1 delegate functions
65
89
  pane.resetView(view1);
66
90
 
67
- var el = view1.$(),
68
- f = SC.viewportOffset(el[0]),
69
- frameTemp = view1.convertFrameFromView(view1.get('frame'), null);
70
-
71
- f.width = frameTemp.width;
72
- f.height = frameTemp.height;
73
-
74
- optionsForLabel1 = {
75
- frame: f,
76
- delegate: view1,
77
- exampleElement: view1.$(),
78
- value: view1.get('value'),
79
- multiline: view1.get('isInlineEditorMultiline'),
80
- isCollection: NO,
81
- validator: view1.get('validator'),
82
- exampleInlineTextFieldView: view1.get('exampleInlineTextFieldView')
83
- };
84
-
85
- el = view2.$();
86
- f = SC.viewportOffset(el[0]);
87
- frameTemp = view2.convertFrameFromView(view2.get('frame'), null);
88
-
89
- f.width = frameTemp.width;
90
- f.height = frameTemp.height;
91
-
92
- optionsForLabel2 = {
93
- frame: f,
94
- delegate: view2,
95
- exampleElement: view2.$(),
96
- value: view2.get('value'),
97
- multiline: view2.get('isInlineEditorMultiline'),
98
- isCollection: NO,
99
- validator: view2.get('validator'),
100
- exampleInlineTextFieldView: view2.get('exampleInlineTextFieldView')
101
- };
91
+ optionsForLabel1 = optionsForLabelFromView(view1);
92
+ optionsForLabel2 = optionsForLabelFromView(view2);
102
93
  },
103
94
 
104
95
  teardown: function() {
@@ -225,3 +216,22 @@ function() {
225
216
 
226
217
  ok(view1.get('notifiedDidBegin'), "the delegate should have been notified of begin editing at this point");
227
218
  });
219
+
220
+ test("inline editor does not display the defaultValue if the label's value is the number 0",
221
+ function() {
222
+ var view1 = pane.view('label1');;
223
+ view1.set('value', 0);
224
+ optionsForLabel1 = optionsForLabelFromView(view1);
225
+
226
+ SC.RunLoop.begin();
227
+ SC.InlineTextFieldView.beginEditing(optionsForLabel1);
228
+ SC.RunLoop.end();
229
+
230
+ // The inline editor is the last view appended to the pane
231
+ var length = pane._pane.childViews.length,
232
+ editor = pane._pane.childViews[length - 1];
233
+ same(editor.get('value'), 0, "editor should have number 0 as value");
234
+ editor.blurEditor();
235
+
236
+ same(view1.get('value'), 0, "view should still have number 0 as value");
237
+ });
@@ -2,7 +2,7 @@
2
2
  // Project: SproutCore - JavaScript Application Framework
3
3
  // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
4
4
  // portions copyright @2009 Apple Inc.
5
- // License: Licened under MIT license (see license.js)
5
+ // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
8
  /*global module test htmlbody ok equals same stop start */
@@ -302,6 +302,11 @@ test('parse without a format uses default ISO8601', function() {
302
302
  equals(SC.DateTime.parse("2010-09-17T18:35:08Z").toISO8601(), "2010-09-17T18:35:08+00:00");
303
303
  });
304
304
 
305
+ test('bad parsing', function() {
306
+ equals(SC.DateTime.parse(SC.DateTime.parse("foo")), null);
307
+ equals(SC.DateTime.parse("2010-09-17T18:35:08Z", SC.DATETIME_ISO8601).toISO8601(), "2010-09-17T18:35:08+00:00");
308
+ });
309
+
305
310
  test('binding', function() {
306
311
  var fromObject = SC.Object.create({value: dt});
307
312
  var toObject = SC.Object.create({value: ''});
@@ -0,0 +1,56 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2010 Apple Inc. and contributors.
4
+ // License: Licensed under MIT license (see license.js)
5
+ // ==========================================================================
6
+
7
+ /*global module test equals context ok same */
8
+ var notEmptyValidator, field;
9
+
10
+ module("SC.Validator.NotEmpty", {
11
+ setup: function () {
12
+ notEmptyValidator = SC.Validator.NotEmpty.create();
13
+ field = SC.Object.create();
14
+ },
15
+ teardown: function () {
16
+ notEmptyValidator.destroy();
17
+ notEmptyValidator = null;
18
+ }
19
+ });
20
+
21
+ test("Recognizes a non-empty string as valid",function(){
22
+ field.set('fieldValue', "fnord");
23
+ var isValid = notEmptyValidator.validate(undefined, field);
24
+ ok(isValid, "Not empty string is valid");
25
+ });
26
+
27
+ test("Recognizes empty string as invalid",function(){
28
+ field.set('fieldValue', "");
29
+ var isValid = notEmptyValidator.validate(undefined, field);
30
+ ok( ! isValid, "Empty string is not valid");
31
+ });
32
+
33
+ test("Recognizes null as empty",function(){
34
+ field.set('fieldValue', null);
35
+ var isValid = notEmptyValidator.validate(undefined, field);
36
+ ok( ! isValid, "null string is not valid");
37
+ });
38
+
39
+ test("Recognizes undefined as empty",function(){
40
+ field.set('fieldValue', undefined);
41
+ var isValid = notEmptyValidator.validate(undefined, field);
42
+ ok( ! isValid, "null string is not valid");
43
+ });
44
+
45
+ test("Recognizes some number as non-empty",function(){
46
+ field.set('fieldValue', 42);
47
+ var isValid = notEmptyValidator.validate(undefined, field);
48
+ ok(isValid, "42 string is not empty");
49
+ });
50
+
51
+ test("Recognizes zero as non-empty",function(){
52
+ field.set('fieldValue', 0);
53
+ var isValid = notEmptyValidator.validate(undefined, field);
54
+ ok(isValid, "0 string is not empty");
55
+ });
56
+
@@ -2,7 +2,7 @@
2
2
  // Project: SproutCore - JavaScript Application Framework
3
3
  // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
4
4
  // Portions ©2008-2010 Apple Inc. All rights reserved.
5
- // License: Licened under MIT license (see license.js)
5
+ // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
8
  require('validators/validator');
@@ -20,9 +20,13 @@ SC.Validator.NotEmpty = SC.Validator.extend(
20
20
 
21
21
  validate: function(form, field) {
22
22
  var value = field.get('fieldValue');
23
- var ret = !!value ;
24
- if (ret && value.length) ret = value.length > 0 ;
25
- return ret ;
23
+ if (SC.none(value))
24
+ return NO;
25
+
26
+ if (! SC.none(value.length))
27
+ return value.length > 0;
28
+
29
+ return YES;
26
30
  },
27
31
 
28
32
  validateError: function(form, field) {
@@ -208,7 +208,7 @@ SC.LabelView = SC.View.extend(SC.Control,
208
208
  if (!this.get('isEditable')) return NO ;
209
209
 
210
210
  var el = this.$(),
211
- value = this.get('value') || '',
211
+ value = this.get('value'),
212
212
  f = SC.viewportOffset(el[0]),
213
213
  frameTemp = this.convertFrameFromView(this.get('frame'), null) ;
214
214
  f.width=frameTemp.width;
@@ -2,7 +2,7 @@
2
2
  // Project: SproutCore - JavaScript Application Framework
3
3
  // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
4
4
  // Portions ©2008-2010 Apple Inc. All rights reserved.
5
- // License: Licened under MIT license (see license.js)
5
+ // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
8
  sc_require('views/controls');
@@ -2,7 +2,7 @@
2
2
  // Project: SproutCore - JavaScript Application Framework
3
3
  // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
4
4
  // Portions ©2008-2010 Apple Inc. All rights reserved.
5
- // License: Licened under MIT license (see license.js)
5
+ // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
  /*globals SC */
8
8
 
@@ -2,7 +2,7 @@
2
2
  // Project: SproutCore - JavaScript Application Framework
3
3
  // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
4
4
  // Portions ©2008-2010 Apple Inc. All rights reserved.
5
- // License: Licened under MIT license (see license.js)
5
+ // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
  /*globals SC */
8
8
 
@@ -2,7 +2,7 @@
2
2
  // Project: SproutCore - JavaScript Application Framework
3
3
  // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
4
4
  // Portions ©2008-2010 Apple Inc. All rights reserved.
5
- // License: Licened under MIT license (see license.js)
5
+ // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
  /*globals SC */
8
8
 
@@ -2,7 +2,7 @@
2
2
  // Project: SproutCore - JavaScript Application Framework
3
3
  // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
4
4
  // Portions ©2008-2010 Apple Inc. All rights reserved.
5
- // License: Licened under MIT license (see license.js)
5
+ // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
  /*globals SC */
8
8
 
@@ -2,7 +2,7 @@
2
2
  // Project: SproutCore - JavaScript Application Framework
3
3
  // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
4
4
  // Portions ©2008-2010 Apple Inc. All rights reserved.
5
- // License: Licened under MIT license (see license.js)
5
+ // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
8
 
@@ -51,7 +51,7 @@ SC.ObserverSet = {
51
51
  // context is really useful sometimes but not used that often so this
52
52
  // implementation is intentionally lazy.
53
53
  if (context !== undefined) {
54
- if (!methods.contexts) context = methods.contexts = {} ;
54
+ if (!methods.contexts) methods.contexts = {} ;
55
55
  methods.contexts[SC.guidFor(method)] = context ;
56
56
  }
57
57
 
@@ -782,6 +782,7 @@ function findClassNames() {
782
782
  SC._object_foundObjectClassNames = true ;
783
783
 
784
784
  var seen = [] ;
785
+ var detectedSC = false;
785
786
  var searchObject = function(root, object, levels) {
786
787
  levels-- ;
787
788
 
@@ -792,7 +793,12 @@ function findClassNames() {
792
793
  for(var key in object) {
793
794
  if (key == '__scope__') continue ;
794
795
  if (key == 'superclass') continue ;
796
+ if (key == '__SC__') key = 'SC' ;
795
797
  if (!key.match(/^[A-Z0-9]/)) continue ;
798
+ if (key == 'SC') {
799
+ if (detectedSC) continue;
800
+ detectedSC = true;
801
+ }
796
802
 
797
803
  var path = (root) ? [root,key].join('.') : key ;
798
804
  var value = object[key] ;
@@ -818,29 +824,18 @@ function findClassNames() {
818
824
  }
819
825
  } ;
820
826
 
827
+ // Fix for IE 7 and 8 in order to detect the SC global variable. When you create
828
+ // a global variable in IE, it is not added to the window object like in other
829
+ // browsers. Therefore the searchObject method will not pick it up. So we have to
830
+ // update the window object to have a reference to the global variable. And
831
+ // doing window['SC'] does not work since the global variable already exists. For
832
+ // any object that you create that is used act as a namespace, be sure to create it
833
+ // like so:
834
+ //
835
+ // window.MyApp = window.MyApp || SC.Object.create({ ... })
836
+ //
837
+ window['__SC__'] = SC;
821
838
  searchObject(null, window, 2) ;
822
-
823
- // Internet Explorer doesn't loop over global variables...
824
- /*if ( SC.browser.isIE ) {
825
- searchObject('SC', SC, 2) ; // get names for the SC classes
826
-
827
- // get names for the model classes, including nested namespaces (untested)
828
- for ( var i = 0; i < SC.Server.servers.length; i++ ) {
829
- var server = SC.Server.servers[i];
830
- if (server.prefix) {
831
- for (var prefixLoc = 0; prefixLoc < server.prefix.length; prefixLoc++) {
832
- var prefixParts = server.prefix[prefixLoc].split('.');
833
- var namespace = window;
834
- var namespaceName;
835
- for (var prefixPartsLoc = 0; prefixPartsLoc < prefixParts.length; prefixPartsLoc++) {
836
- namespace = namespace[prefixParts[prefixPartsLoc]] ;
837
- namespaceName = prefixParts[prefixPartsLoc];
838
- }
839
- searchObject(namespaceName, namespace, 2) ;
840
- }
841
- }
842
- }
843
- }*/
844
839
  }
845
840
 
846
841
  /**
@@ -875,7 +870,7 @@ SC.kindOf = function(scObject, scClass) {
875
870
  This method is used to allow classes to determine their own name.
876
871
  */
877
872
  SC._object_className = function(obj) {
878
- if (!SC.isReady) return ''; // class names are not available until ready
873
+ if (SC.isReady === NO) return ''; // class names are not available until ready
879
874
  if (!obj._object_className) findClassNames() ;
880
875
  if (obj._object_className) return obj._object_className ;
881
876