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
@@ -42,6 +42,7 @@ SC.TabView = SC.View.extend(
42
42
  itemIsEnabledKey: null,
43
43
  itemIconKey: null,
44
44
  itemWidthKey: null,
45
+ itemToolTipKey: null,
45
46
 
46
47
  tabLocation: SC.TOP_LOCATION,
47
48
 
@@ -184,4 +185,4 @@ SC.TabView = SC.View.extend(
184
185
 
185
186
  }) ;
186
187
 
187
- SC._TAB_ITEM_KEYS = 'itemTitleKey itemValueKey itemIsEnabledKey itemIconKey itemWidthKey'.w();
188
+ SC._TAB_ITEM_KEYS = 'itemTitleKey itemValueKey itemIsEnabledKey itemIconKey itemWidthKey itemToolTipKey'.w();
@@ -50,7 +50,6 @@ SC.WellView = SC.ContainerView.extend(
50
50
  */
51
51
 
52
52
  render: function(context, firstTime) {
53
- sc_super();
54
53
  if(firstTime){
55
54
  context.push("<div class='top-left-edge'></div>",
56
55
  "<div class='top-edge'></div>",
@@ -62,6 +61,7 @@ SC.WellView = SC.ContainerView.extend(
62
61
  "<div class='left-edge'></div>",
63
62
  "<div class='content-background'></div>");
64
63
  }
64
+ sc_super();
65
65
  },
66
66
 
67
67
  /**
@@ -38,6 +38,12 @@ SC.DROP_AFTER = 0x04 ;
38
38
  */
39
39
  SC.DROP_ANY = 0x07 ;
40
40
 
41
+
42
+ /**
43
+ This variable is here to make the tab focus behavior work like safari's.
44
+ */
45
+ SC.SAFARI_FOCUS_BEHAVIOR = YES;
46
+
41
47
  SC.mixin(/** @lends SC */ {
42
48
 
43
49
  /**
@@ -10,7 +10,7 @@
10
10
  cursor: default;
11
11
  overflow: hidden;
12
12
  position: absolute; /* all views are absolutely positioned. */
13
- -moz-user-select: none;
13
+ -moz-user-select: -moz-none;
14
14
  -khtml-user-select: none;
15
15
  user-select: none;
16
16
  margin: 0px;
@@ -40,6 +40,7 @@
40
40
  }
41
41
 
42
42
  /* This className is useful when aligning buttons to the right */
43
+ .sc-view.text-align-right,
43
44
  .sc-view.textAlignRight {
44
45
  text-align:right;
45
46
  }
@@ -160,43 +160,46 @@ SC.Button = {
160
160
  @returns {SC.RenderContext} the context
161
161
  */
162
162
  renderTitle: function(context, firstTime) {
163
- var icon = this.get('icon') ;
164
- var image = '' ;
165
- var title = this.get('displayTitle') ;
166
- var needsTitle = (!SC.none(title) && title.length>0);
167
- var elem, htmlNode;
163
+ var icon = this.get('icon'),
164
+ image = '' ,
165
+ title = this.get('displayTitle') ,
166
+ needsTitle = (!SC.none(title) && title.length>0),
167
+ elem, htmlNode, imgTitle;
168
168
  // get the icon. If there is an icon, then get the image and update it.
169
169
  // if there is no image element yet, create it and insert it just before
170
170
  // title.
171
171
  if (icon) {
172
172
  var blank = SC.BLANK_IMAGE_URL;
173
173
 
174
- image = '<img src="%@1" alt="" class="%@2" />' ;
175
174
  if (icon.indexOf('/') >= 0) {
176
- image = image.fmt(icon, 'icon');
175
+ image = '<img src="'+icon+'" alt="" class="icon" />';
177
176
  } else {
178
- image = image.fmt(blank, icon);
177
+ image = '<img src="'+blank+'" alt="" class="'+icon+'" />';
179
178
  }
180
179
  needsTitle = YES ;
181
180
  }
182
- elem = this.$('label');
181
+ imgTitle = image + title;
183
182
  if(firstTime){
184
183
  if(this.get('needsEllipsis')){
185
- context.push('<label class="sc-button-label ellipsis">'+image+title+'</label>');
184
+ context.push('<label class="sc-button-label ellipsis">'+imgTitle+'</label>');
186
185
  }else{
187
- context.push('<label class="sc-button-label">'+image+title+'</label>');
186
+ context.push('<label class="sc-button-label">'+imgTitle+'</label>');
188
187
  }
189
- }else if ( (htmlNode = elem[0])){
190
- if(needsTitle) {
191
- if(this.get('needsEllipsis')){
192
- elem.addClass('ellipsis');
193
- htmlNode.innerHTML = image + title;
194
- }else{
195
- elem.removeClass('ellipsis');
196
- htmlNode.innerHTML = image + title;
197
- }
188
+ this._ImageTitleCached = imgTitle;
189
+ }else{
190
+ elem = this.$('label');
191
+ if ( (htmlNode = elem[0])){
192
+ if(needsTitle) {
193
+ if(this.get('needsEllipsis')){
194
+ elem.addClass('ellipsis');
195
+ if(this._ImageTitleCached !== imgTitle) htmlNode.innerHTML = imgTitle;
196
+ }else{
197
+ elem.removeClass('ellipsis');
198
+ if(this._ImageTitleCached !== imgTitle) htmlNode.innerHTML = imgTitle;
199
+ }
200
+ }
201
+ else { htmlNode.innerHTML = ''; }
198
202
  }
199
- else { htmlNode.innerHTML = ''; }
200
203
  }
201
204
  return context ;
202
205
  },
@@ -210,8 +213,8 @@ SC.Button = {
210
213
  @returns {SC.Button} receiver
211
214
  */
212
215
  contentPropertyDidChange: function(target, key) {
213
- var del = this.get('displayDelegate');
214
- var content = this.get('content'), value ;
216
+ var del = this.get('displayDelegate'),
217
+ content = this.get('content'), value ;
215
218
 
216
219
  var valueKey = this.getDelegateProperty('contentValueKey', del) ;
217
220
  if (valueKey && (key === valueKey || key === '*')) {
@@ -291,8 +294,7 @@ SC.Button = {
291
294
  @returns {Boolean} return state
292
295
  */
293
296
  computeIsSelectedForValue: function(value) {
294
- var targetValue = this.get('toggleOnValue') ;
295
- var state, next ;
297
+ var targetValue = this.get('toggleOnValue'), state, next ;
296
298
 
297
299
  if (SC.typeOf(value) === SC.T_ARRAY) {
298
300
 
@@ -314,7 +316,8 @@ SC.Button = {
314
316
 
315
317
  // for single values, just compare to the toggleOnValue...use truthiness
316
318
  } else {
317
- state = (value == targetValue) ;
319
+ if(value === SC.MIXED_STATE) state = SC.MIXED_STATE;
320
+ else state = (value == targetValue) ;
318
321
  }
319
322
  return state ;
320
323
  },
@@ -330,8 +333,8 @@ SC.Button = {
330
333
  Whenever the button value changes, update the selected state to match.
331
334
  */
332
335
  _button_valueDidChange: function() {
333
- var value = this.get('value');
334
- var state = this.computeIsSelectedForValue(value);
336
+ var value = this.get('value'),
337
+ state = this.computeIsSelectedForValue(value);
335
338
  this.set('isSelected', state) ; // set new state...
336
339
  }.observes('value'),
337
340
 
@@ -339,8 +342,8 @@ SC.Button = {
339
342
  Whenever the selected state is changed, make sure the button value is also updated. Note that this may be called because the value has just changed. In that case this should do nothing.
340
343
  */
341
344
  _button_isSelectedDidChange: function() {
342
- var newState = this.get('isSelected');
343
- var curState = this.computeIsSelectedForValue(this.get('value'));
345
+ var newState = this.get('isSelected'),
346
+ curState = this.computeIsSelectedForValue(this.get('value'));
344
347
 
345
348
  // fix up the value, but only if computed state does not match.
346
349
  // never fix up value if isSelected is set to MIXED_STATE since this can
@@ -389,16 +389,20 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(SC.DelegateSupport,
389
389
  insertTab: function(evt) {
390
390
  this.resignFirstResponder();
391
391
  this.commitEditing() ;
392
- var next = this._delegate.nextValidKeyView();
393
- if(next) next.beginEditing();
392
+ if(this._delegate){
393
+ var next = this._delegate.nextValidKeyView();
394
+ if(next) next.beginEditing();
395
+ }
394
396
  return YES ;
395
397
  },
396
398
 
397
399
  /** @private */
398
400
  insertBacktab: function(evt) {
399
- var prev = this._delegate.previousValidKeyView();
400
401
  this.commitEditing() ;
401
- if(prev) prev.beginEditing();
402
+ if(this._delegate){
403
+ var prev = this._delegate.previousValidKeyView();
404
+ if(prev) prev.beginEditing();
405
+ }
402
406
  return YES ;
403
407
  },
404
408
 
@@ -11,6 +11,12 @@ sc_require('system/locale');
11
11
  // SproutCore.
12
12
  /** @private */
13
13
  SC.STRING_TITLEIZE_REGEXP = (/([\s|\-|\_|\n])([^\s|\-|\_|\n]?)/g);
14
+ SC.STRING_DECAMELIZE_REGEXP = (/([a-z])([A-Z])/g);
15
+ SC.STRING_DASHERIZE_REGEXP = (/[ _]/g);
16
+ SC.STRING_HUMANIZE_REGEXP = (/[\-_]/g);
17
+ SC.STRING_TRIM_REGEXP = (/^\s+|\s+$/g);
18
+ SC.STRING_TRIM_LEFT_REGEXP = (/^\s+/g);
19
+ SC.STRING_TRIM_RIGHT_REGEXP = (/\s+$/g);
14
20
 
15
21
  /**
16
22
  @namespace
@@ -111,7 +117,7 @@ SC.String = {
111
117
  @return {String} titleized string.
112
118
  */
113
119
  titleize: function() {
114
- var ret = this.replace(/([a-z])([A-Z])/g,'$1_$2'); // decamelize
120
+ var ret = this.replace(SC.STRING_DECAMELIZE_REGEXP,'$1_$2'); // decamelize
115
121
  return ret.replace(SC.STRING_TITLEIZE_REGEXP,
116
122
  function(str,separater,character) {
117
123
  return (character) ? (' ' + character.toUpperCase()) : ' ';
@@ -178,7 +184,7 @@ SC.String = {
178
184
  @returns {String} the decamelized string.
179
185
  */
180
186
  decamelize: function() {
181
- return this.replace(/([a-z])([A-Z])/g,'$1_$2').toLowerCase();
187
+ return this.replace(SC.STRING_DECAMELIZE_REGEXP,'$1_$2').toLowerCase();
182
188
  },
183
189
 
184
190
  /**
@@ -196,7 +202,7 @@ SC.String = {
196
202
  @returns {String} the dasherized string.
197
203
  */
198
204
  dasherize: function() {
199
- return this.decamelize().replace(/[ _]/g,'-') ;
205
+ return this.decamelize().replace(SC.STRING_DASHERIZE_REGEXP,'-') ;
200
206
  },
201
207
 
202
208
  /**
@@ -214,7 +220,7 @@ SC.String = {
214
220
  @returns {String} the humanized string.
215
221
  */
216
222
  humanize: function() {
217
- return this.decamelize().replace(/[\-_]/g,' ') ;
223
+ return this.decamelize().replace(SC.STRING_HUMANIZE_REGEXP,' ') ;
218
224
  },
219
225
 
220
226
  /**
@@ -295,9 +301,8 @@ SC.String = {
295
301
  diacriticMappingTable = SC.diacriticMappingTable;
296
302
  }
297
303
 
298
- var original, replacement;
299
- var ret = "";
300
- var length = this.length;
304
+ var original, replacement, ret = "",
305
+ length = this.length;
301
306
  for (var i = 0; i <= length; ++i) {
302
307
  original = this.charAt(i);
303
308
  replacement = diacriticMappingTable[original];
@@ -318,7 +323,7 @@ SC.String = {
318
323
  @returns {String} the trimmed string
319
324
  */
320
325
  trim: function () {
321
- return this.replace(/^\s+|\s+$/g,"");
326
+ return this.replace(SC.STRING_TRIM_REGEXP,"");
322
327
  },
323
328
 
324
329
  /**
@@ -327,7 +332,7 @@ SC.String = {
327
332
  @returns {String} the trimmed string
328
333
  */
329
334
  trimLeft: function () {
330
- return this.replace(/^\s+/g,"");
335
+ return this.replace(SC.STRING_TRIM_LEFT_REGEXP,"");
331
336
  },
332
337
 
333
338
  /**
@@ -336,7 +341,7 @@ SC.String = {
336
341
  @returns {String} the trimmed string
337
342
  */
338
343
  trimRight: function () {
339
- return this.replace(/\s+$/g,"");
344
+ return this.replace(SC.STRING_TRIM_RIGHT_REGEXP,"");
340
345
  }
341
346
 
342
347
  };
@@ -117,14 +117,38 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
117
117
 
118
118
  @returns {Rect} current window size
119
119
  */
120
- computeParentDimensions: function() {
121
- var pframe = this.get('currentWindowSize');
122
- return {
123
- width: (pframe) ? pframe.width : 1000,
124
- height: (pframe) ? pframe.height : 1000
125
- } ;
120
+ computeParentDimensions: function(frame) {
121
+ var wframe = this.get('currentWindowSize');
122
+ var wDim = {x: 0, y: 0, width: 1000, height: 1000};
123
+ if (wframe){
124
+ wDim.width = wframe.width;
125
+ wDim.height = wframe.height;
126
+ }
127
+ // Call the RootResponder instance...
128
+ else if (SC.RootResponder.responder) {
129
+ var wSize = SC.RootResponder.responder.get('currentWindowSize');
130
+ if (wSize){
131
+ wDim.width = wSize.width;
132
+ wDim.height = wSize.height;
133
+ }
134
+ }
135
+ // If all else fails then we need to Calculate it from the window size and DOM
136
+ else {
137
+ if (window.innerHeight) {
138
+ wDim.width = window.innerWidth;
139
+ wDim.height = window.innerHeight;
140
+ } else if (document.documentElement && document.documentElement.clientHeight) {
141
+ wDim.width = document.documentElement.clientWidth;
142
+ wDim.height = document.documentElement.clientHeight;
143
+ } else if (document.body) {
144
+ wDim.width = document.body.clientWidth;
145
+ wDim.height = document.body.clientHeight;
146
+ }
147
+ this.windowSizeDidChange(null, wDim);
148
+ }
149
+ return wDim;
126
150
  },
127
-
151
+
128
152
  /** @private Disable caching due to an known bug in SC. */
129
153
  frame: function() {
130
154
  return this.computeFrameWithParentFrame(null) ;
@@ -184,6 +208,27 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
184
208
  return evt.mouseHandler || target ;
185
209
  },
186
210
 
211
+ performKeyEquivalent: function(keystring, evt) {
212
+ var ret = sc_super() ; // try normal view behavior first
213
+ if (!ret) {
214
+ var defaultResponder = this.get('defaultResponder') ;
215
+ if (defaultResponder) {
216
+ // try default responder's own performKeyEquivalent method,
217
+ // if it has one...
218
+ if (defaultResponder.performKeyEquivalent) {
219
+ ret = defaultResponder.performKeyEquivalent(keystring, evt) ;
220
+ }
221
+
222
+ // even if it does have one, if it doesn't handle the event, give
223
+ // methodName-style key equivalent handling a try
224
+ if (!ret) {
225
+ ret = defaultResponder.tryToPerform(keystring, evt) ;
226
+ }
227
+ }
228
+ }
229
+ return ret ;
230
+ },
231
+
187
232
  // .......................................................
188
233
  // HANDLE FIRST RESPONDER AND KEY RESPONDER STATUS
189
234
  //
@@ -457,6 +502,7 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
457
502
  if (!this.get('isPaneAttached')) return this ; // nothing to do
458
503
 
459
504
  // remove layer...
505
+ this.set('isVisibleInWindow', NO);
460
506
  var dom = this.get('layer') ;
461
507
  if (dom.parentNode) dom.parentNode.removeChild(dom) ;
462
508
  dom = null ;
@@ -472,7 +518,6 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
472
518
 
473
519
  // clean up some of my own properties
474
520
  this.set('isPaneAttached', NO) ;
475
- this.parentViewDidChange() ;
476
521
  return this ;
477
522
  },
478
523
 
@@ -596,6 +641,9 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
596
641
  this.set('isPaneAttached', YES) ;
597
642
  this.parentViewDidChange() ;
598
643
 
644
+ //notify that the layers have been appended to the document
645
+ this._notifyDidAppendToDocument();
646
+
599
647
  return this ;
600
648
  },
601
649
 
@@ -616,12 +664,13 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
616
664
  @returns {SC.Pane} receiver
617
665
  */
618
666
  recomputeIsVisibleInWindow: function(parentViewIsVisible) {
619
- var last = this.get('isVisibleInWindow') ;
620
- var cur = this.get('isPaneAttached') && this.get('isVisible') ;
667
+ var last = this.get('isVisibleInWindow'),
668
+ cur = this.get('isVisible') ;
621
669
 
622
670
  // if the state has changed, update it and notify children
623
- if (last !== cur) {
671
+ // if (last !== cur) {
624
672
  this.set('isVisibleInWindow', cur) ;
673
+ this._needsVisibiltyChange = YES ; // update even if we aren't visible
625
674
 
626
675
  // if we just became visible, update layer + layout if needed...
627
676
  if (cur && this.get('layerNeedsUpdate')) this.updateLayerIfNeeded();
@@ -635,7 +684,7 @@ SC.Pane = SC.View.extend( /** @scope SC.Pane.prototype */ {
635
684
  // if we were firstResponder, resign firstResponder also if no longer
636
685
  // visible.
637
686
  if (!cur && this.get('isFirstResponder')) this.resignFirstResponder();
638
- }
687
+ // }
639
688
 
640
689
  // if we just became visible, update layer + layout if needed...
641
690
  if (cur) {
@@ -38,7 +38,8 @@ SC.mixin(/** @scope SC */ {
38
38
  Execute callback function.
39
39
  */
40
40
  _scb_bundleDidLoad: function(bundleName, target, method, args) {
41
- var m, t;
41
+ var m = method, t = target ;
42
+
42
43
  if(SC.typeOf(target) === SC.T_STRING) {
43
44
  t = SC.objectForPropertyPath(target);
44
45
  }
@@ -4,7 +4,7 @@
4
4
  // Portions ©2008-2009 Apple Inc. All rights reserved.
5
5
  // License: Licened under MIT license (see license.js)
6
6
  // ==========================================================================
7
- /*globals CQ*/
7
+ /*globals CQ add*/
8
8
 
9
9
  require('system/builder') ;
10
10
 
@@ -95,8 +95,19 @@ SC.CoreQuery = (function() {
95
95
  // (both of which we optimize for)
96
96
  var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
97
97
  // Is it a simple selector
98
- isSimple = /^.[^:#\[\.]*$/,
99
- undefined ;
98
+ isSimple = /^.[^:#\[\.]*$/;
99
+
100
+ // Regular expressions
101
+ var CQHtmlRegEx =/ CQ\d+="(?:\d+|null)"/g,
102
+ tagSearchRegEx = /(<(\w+)[^>]*?)\/>/g,
103
+ xmlTagsRegEx = /^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i,
104
+ checkforSpaceRegEx = /\s+/,
105
+ trimWhiteSpaceRegEx = /^\s+/,
106
+ bodyHTMLOffsetRegEx = /^body|html$/i,
107
+ specialAttributesRegEx = /href|src|style/,
108
+ tagsWithTabIndexRegEx = /(button|input|object|select|textarea)/i,
109
+ alphaDetectRegEx = /alpha\([^)]*\)/,
110
+ alphaReplaceRegEx = /opacity=([^)]*)/;
100
111
 
101
112
  var styleFloat = SC.browser.msie ? "styleFloat" : "cssFloat";
102
113
 
@@ -116,7 +127,7 @@ SC.CoreQuery = (function() {
116
127
  } ;
117
128
 
118
129
  var getWH = function getWH(elem, name, which) {
119
- var val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
130
+ var val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
120
131
  var padding = 0, border = 0, loc=which.length, dim;
121
132
  while(--loc>=0) {
122
133
  dim = which[loc];
@@ -139,7 +150,7 @@ SC.CoreQuery = (function() {
139
150
 
140
151
  // defaultView is cached
141
152
  var ret = defaultView.getComputedStyle( elem, null );
142
- return !ret || ret.getPropertyValue("color") == "";
153
+ return !ret || ret.getPropertyValue("color") === "";
143
154
  } ;
144
155
 
145
156
 
@@ -147,7 +158,7 @@ SC.CoreQuery = (function() {
147
158
  // Helper function used by the dimensions and offset modules
148
159
  function num(elem, prop) {
149
160
  return elem[0] && parseInt( CQ.curCSS(elem[0], prop, true), 10 ) || 0;
150
- } ;
161
+ }
151
162
 
152
163
  var CoreQuery, CQ ;
153
164
 
@@ -191,9 +202,9 @@ SC.CoreQuery = (function() {
191
202
  if ( match && (match[1] || !context) ) {
192
203
 
193
204
  // HANDLE: $(html) -> $(array)
194
- if ( match[1] )
205
+ if ( match[1] ) {
195
206
  selector = CQ.clean( [ match[1] ], context );
196
-
207
+ }
197
208
  // HANDLE: $("#id")
198
209
  else {
199
210
  var elem = document.getElementById( match[3] );
@@ -283,10 +294,11 @@ SC.CoreQuery = (function() {
283
294
  not: function( selector ) {
284
295
  if ( typeof selector === "string" ) {
285
296
  // test special case where just one selector is passed in
286
- if ( isSimple.test( selector ) )
297
+ if ( isSimple.test( selector ) ) {
287
298
  return this.pushStack( CQ.multiFilter( selector, this, true ) );
288
- else
299
+ }else {
289
300
  selector = CQ.multiFilter( selector, this );
301
+ }
290
302
  }
291
303
 
292
304
  var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
@@ -406,34 +418,32 @@ SC.CoreQuery = (function() {
406
418
  var options = name;
407
419
 
408
420
  // Look for the case where we're accessing a style value
409
- if ( typeof name === "string" )
410
- if ( value === undefined )
421
+ if ( typeof name === "string" ) {
422
+ if ( value === undefined ) {
411
423
  return this[0] && CQ[ type || "attr" ]( this[0], name );
412
-
424
+ }
413
425
  else {
414
426
  options = {};
415
427
  options[ name ] = value;
416
428
  }
417
-
429
+ }
418
430
  // Check to see if we're setting style values
419
431
  return this.each(function(i){
420
432
  // Set all the styles
421
- for ( name in options )
433
+ for ( name in options ) {
422
434
  CQ.attr(
423
435
  (type)?this.style:this,
424
436
  name, CQ.prop( this, options[ name ], type, i, name ));
437
+ }
425
438
  });
426
439
  },
427
440
 
428
441
  html: function( value ) {
429
442
  return value === undefined ?
430
443
  (this[0] ?
431
- this[0].innerHTML.replace(/ CQ\d+="(?:\d+|null)"/g, "") :
444
+ this[0].innerHTML.replace(CQHtmlRegEx, "") :
432
445
  null) :
433
446
  this.empty().append( value );
434
- // return value == undefined ?
435
- // (this[0] ? this[0].innerHTML : null) :
436
- // this.empty().append( value );
437
447
  },
438
448
 
439
449
  andSelf: function() { return this.add( this.prevObject ); },
@@ -459,7 +469,7 @@ SC.CoreQuery = (function() {
459
469
  */
460
470
  hasClass: function( className ) {
461
471
  return Array.prototype.every.call(this, function(elem) {
462
- return (elem.nodeType!=1) || CQ.className.has(elem, className) ;
472
+ return (elem.nodeType===1) && CQ.className.has(elem, className) ;
463
473
  });
464
474
  },
465
475
 
@@ -477,15 +487,16 @@ SC.CoreQuery = (function() {
477
487
  if ( value === undefined ) {
478
488
  var elem = this[0];
479
489
  if (elem) {
480
- if(CQ.nodeName(elem, 'option'))
490
+ if(CQ.nodeName(elem, 'option')) {
481
491
  return (elem.attributes.value || {}).specified ? elem.value : elem.text;
482
-
492
+ }
483
493
  // We need to handle select boxes special
484
494
  if ( CQ.nodeName( elem, "select" ) ) {
485
495
  var index = elem.selectedIndex,
486
496
  values = [],
487
497
  options = elem.options,
488
- one = elem.type == "select-one";
498
+ one = elem.type === "select-one",
499
+ option;
489
500
 
490
501
  // Nothing was selected
491
502
  if ( index < 0 ) return null;
@@ -493,7 +504,7 @@ SC.CoreQuery = (function() {
493
504
  // Loop through all the selected options
494
505
  var i, max = one ? index+1:options.length;
495
506
  for (i = one ? index : 0; i < max; i++ ) {
496
- var option = options[ i ];
507
+ option = options[ i ];
497
508
  if ( option.selected ) {
498
509
  value = CQ(option).val(); // get value
499
510
  if (one) return value; // We don't need an array for one
@@ -513,7 +524,7 @@ SC.CoreQuery = (function() {
513
524
  } else {
514
525
  if( typeof value === "number" ) value += ''; // force to string
515
526
  this.each(function(){
516
- if ( this.nodeType != 1 ) return;
527
+ if ( this.nodeType !== 1 ) return;
517
528
 
518
529
  // handle radio/checkbox. set the checked value
519
530
  if (SC.typeOf(value) === SC.T_ARRAY && (/radio|checkbox/).test(this.type)) {
@@ -566,8 +577,9 @@ SC.CoreQuery = (function() {
566
577
  // this is primarily for IE but the data expando shouldn't be copied
567
578
  // over in any browser
568
579
  var clone = ret.find("*").andSelf().each(function(){
569
- if ( this[ SC.guidKey ] !== undefined )
580
+ if ( this[ SC.guidKey ] !== undefined ) {
570
581
  this[ SC.guidKey ] = null;
582
+ }
571
583
  });
572
584
 
573
585
  // Return the cloned set
@@ -584,7 +596,7 @@ SC.CoreQuery = (function() {
584
596
  */
585
597
  css: function( key, value ) {
586
598
  // ignore negative width and height values
587
- if ((key == 'width' || key == 'height') && parseFloat(value,0) < 0 ) {
599
+ if ((key === 'width' || key === 'height') && parseFloat(value,0) < 0 ) {
588
600
  value = undefined;
589
601
  }
590
602
  return this.attr( key, value, "curCSS" );
@@ -598,16 +610,17 @@ SC.CoreQuery = (function() {
598
610
  @returns {String|CoreQuery}
599
611
  */
600
612
  text: function( text ) {
601
- if ( typeof text !== "object" && text != null )
613
+ if ( text !== undefined && typeof text !== "object" && text != null ) {
602
614
  return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
603
-
615
+ }
604
616
  var ret = "";
605
617
 
606
618
  CQ.each( text || this, function(){
607
619
  CQ.each( this.childNodes, function(){
608
- if ( this.nodeType != 8 )
609
- ret += this.nodeType != 1 ?
620
+ if ( this.nodeType !== 8 ){
621
+ ret += this.nodeType !== 1 ?
610
622
  this.nodeValue : CQ.fn.text( [ this ] );
623
+ }
611
624
  });
612
625
  });
613
626
 
@@ -625,7 +638,7 @@ SC.CoreQuery = (function() {
625
638
 
626
639
  // handle edge case where the CSS style is none so we can't detect
627
640
  // the natural display state.
628
- if (CQ.css(this,'display') == 'none') {
641
+ if (CQ.css(this,'display') === 'none') {
629
642
  var elem = CQ('<' + this.tagName + '/>');
630
643
  CQ('body').append(elem);
631
644
  this.style.display = elem.css('display');
@@ -679,15 +692,13 @@ SC.CoreQuery = (function() {
679
692
 
680
693
  append: function() {
681
694
  return this.domManip(arguments, true, false, function(elem){
682
- if (this.nodeType == 1)
683
- this.appendChild( elem );
695
+ if (this.nodeType === 1) this.appendChild( elem );
684
696
  });
685
697
  },
686
698
 
687
699
  prepend: function() {
688
700
  return this.domManip(arguments, true, true, function(elem){
689
- if (this.nodeType == 1)
690
- this.insertBefore( elem, this.firstChild );
701
+ if (this.nodeType === 1) this.insertBefore( elem, this.firstChild );
691
702
  });
692
703
  },
693
704
 
@@ -717,7 +728,7 @@ SC.CoreQuery = (function() {
717
728
  CoreQuery.mixin(/** @scope SC.CoreQuery */ {
718
729
 
719
730
  nodeName: function( elem, name ) {
720
- return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
731
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
721
732
  },
722
733
 
723
734
  /**
@@ -739,15 +750,14 @@ SC.CoreQuery = (function() {
739
750
  @returns {Array} mapped elements
740
751
  */
741
752
  map: function( elems, callback ) {
742
- var ret = [];
753
+ var ret = [], value, i, length;
743
754
 
744
755
  // Go through the array, translating each of the items to their
745
756
  // new value (or values).
746
- for ( var i = 0, length = elems.length; i < length; i++ ) {
747
- var value = callback( elems[ i ], i );
757
+ for ( i = 0, length = elems.length; i < length; i++ ) {
758
+ value = callback( elems[ i ], i );
748
759
 
749
- if ( value != null )
750
- ret[ ret.length ] = value;
760
+ if ( value != null ) ret[ ret.length ] = value;
751
761
  }
752
762
 
753
763
  return ret.concat.apply([],ret) ;
@@ -768,23 +778,24 @@ SC.CoreQuery = (function() {
768
778
 
769
779
  if ( args ) {
770
780
  if ( length === undefined ) {
771
- for ( name in object )
772
- if ( callback.apply( object[ name ], args ) === false )
773
- break;
774
- } else
775
- for ( ; i < length; )
776
- if ( callback.apply( object[ i++ ], args ) === false )
777
- break;
778
-
781
+ for ( name in object ) {
782
+ if ( callback.apply( object[ name ], args ) === false ) break;
783
+ }
784
+ } else {
785
+ for ( ; i < length; ) {
786
+ if ( callback.apply( object[ i++ ], args ) === false ) break;
787
+ }
788
+ }
779
789
  // A special, fast, case for the most common use of each
780
790
  } else {
781
791
  if ( length === undefined ) {
782
- for ( name in object )
783
- if ( callback.call( object[ name ], name, object[ name ] ) === false )
784
- break;
785
- } else
792
+ for ( name in object ) {
793
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) break;
794
+ }
795
+ } else {
786
796
  for ( var value = object[0];
787
797
  i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
798
+ }
788
799
  }
789
800
 
790
801
  return object;
@@ -810,14 +821,14 @@ SC.CoreQuery = (function() {
810
821
  // Convert html string into DOM nodes
811
822
  if ( typeof elem === "string" ) {
812
823
  // Fix "XHTML"-style tags in all browsers
813
- elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
814
- return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
824
+ elem = elem.replace(tagSearchRegEx, function(all, front, tag){
825
+ return tag.match(xmlTagsRegEx) ?
815
826
  all :
816
827
  front + "></" + tag + ">";
817
828
  });
818
829
 
819
830
  // Trim whitespace, otherwise indexOf won't work as expected
820
- var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(),
831
+ var tags = elem.replace(trimWhiteSpaceRegEx, "").substring(0, 10).toLowerCase(),
821
832
  div = context.createElement("div");
822
833
 
823
834
  var wrap =
@@ -861,18 +872,19 @@ SC.CoreQuery = (function() {
861
872
  div.firstChild && div.firstChild.childNodes :
862
873
 
863
874
  // String was a bare <thead> or <tfoot>
864
- wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
875
+ wrap[1] === "<table>" && tags.indexOf("<tbody") < 0 ?
865
876
  div.childNodes :
866
877
  [];
867
878
 
868
- for ( var j = tbody.length - 1; j >= 0 ; --j )
869
- if ( CQ.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
879
+ for ( var j = tbody.length - 1; j >= 0 ; --j ) {
880
+ if ( CQ.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
870
881
  tbody[ j ].parentNode.removeChild( tbody[ j ] );
871
-
882
+ }
883
+ }
872
884
  // IE completely kills leading whitespace when innerHTML is used
873
- if ( /^\s/.test( elem ) )
885
+ if ( /^\s/.test( elem ) ) {
874
886
  div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
875
-
887
+ }
876
888
  }
877
889
 
878
890
  elem = CQ.makeArray( div.childNodes );
@@ -926,14 +938,15 @@ SC.CoreQuery = (function() {
926
938
  @returns {Array} matched elements
927
939
  */
928
940
  find: function( t, context ) {
941
+ var ret;
929
942
 
930
943
  // Quickly handle non-string expressions
931
- if ( typeof t != "string" ) return [ t ];
944
+ if ( typeof t !== "string" ) return [ t ];
932
945
 
933
946
  // if the selector contains commas, then we actually want to search
934
947
  // multiple selectors.
935
948
  if (t.indexOf(',')>=0) {
936
- var ret = t.split(',').map(function(sel) {
949
+ ret = t.split(',').map(function(sel) {
937
950
  return CQ.find(sel,context);
938
951
  });
939
952
 
@@ -942,7 +955,7 @@ SC.CoreQuery = (function() {
942
955
  }
943
956
 
944
957
  // check to make sure context is a DOM element or a document
945
- if ( context && context.nodeType != 1 && context.nodeType != 9) {
958
+ if ( context && context.nodeType !== 1 && context.nodeType !== 9) {
946
959
  return [];
947
960
  }
948
961
 
@@ -950,8 +963,9 @@ SC.CoreQuery = (function() {
950
963
  context = context || document;
951
964
 
952
965
  // Initialize the search. split the selector into pieces
953
- var ret = [context], nodeName, inFindMode = YES;
954
- var parts = t.match(quickSplit), len = parts.length, m ;
966
+ ret = [context];
967
+ var nodeName, inFindMode = YES,
968
+ parts = t.match(quickSplit), len = parts.length, m ;
955
969
 
956
970
  // loop through each part and either find or filter as needed
957
971
  for(var idx=0;idx<len;idx++) {
@@ -983,7 +997,7 @@ SC.CoreQuery = (function() {
983
997
  case '': // tag
984
998
  if (!val) val = '*';
985
999
  // Handle IE7 being really dumb about <object>s
986
- if ( val == "*" && cur.nodeName.toLowerCase() == "object" ) {
1000
+ if ( val === "*" && cur.nodeName.toLowerCase() === "object" ) {
987
1001
  val = "param";
988
1002
  }
989
1003
 
@@ -1028,7 +1042,8 @@ SC.CoreQuery = (function() {
1028
1042
  // do nothing
1029
1043
  }
1030
1044
  }
1031
- delete ret; ret = next ; // swap array
1045
+ delete ret;
1046
+ ret = next ; // swap array
1032
1047
  inFindMode = NO;
1033
1048
 
1034
1049
  // if we are not in findMode then simply filter the results.
@@ -1042,11 +1057,12 @@ SC.CoreQuery = (function() {
1042
1057
 
1043
1058
  classFilter: function(r,m,not){
1044
1059
  m = " " + m + " ";
1045
- var tmp = [];
1060
+ var tmp = [], pass;
1046
1061
  for ( var i = 0; r[i]; i++ ) {
1047
- var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
1048
- if ( !not && pass || not && !pass )
1062
+ pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
1063
+ if ( !not && pass || not && !pass ) {
1049
1064
  tmp.push( r[i] );
1065
+ }
1050
1066
  }
1051
1067
  return tmp;
1052
1068
  },
@@ -1090,7 +1106,7 @@ SC.CoreQuery = (function() {
1090
1106
 
1091
1107
  /** @private Accepts filters separated by commas. */
1092
1108
  multiFilter: function( expr, elems, not ) {
1093
- expr = (expr.indexOf(',')) ? expr.split(',') : [expr];
1109
+ expr = expr.indexOf(',') ? expr.split(',') : [expr];
1094
1110
  var loc=expr.length,cur,ret=[];
1095
1111
  while(--loc >= 0) { // unit tests expect reverse iteration
1096
1112
  cur = CQ.filter(expr[loc].trim(), elems, not) ;
@@ -1111,7 +1127,7 @@ SC.CoreQuery = (function() {
1111
1127
  // returned (IE returns comment nodes in a '*' query)
1112
1128
  if ( SC.browser.msie ) {
1113
1129
  while ( elem = second[ i++ ] ) {
1114
- if ( elem.nodeType != 8 ) first[ pos++ ] = elem;
1130
+ if ( elem.nodeType !== 8 ) first[ pos++ ] = elem;
1115
1131
  }
1116
1132
 
1117
1133
  } else {
@@ -1125,25 +1141,26 @@ SC.CoreQuery = (function() {
1125
1141
  makeArray: function(array) {
1126
1142
  var ret = [];
1127
1143
 
1128
- if( array != null ){
1144
+ if( array !== undefined || array != null ){
1129
1145
  var i = array.length;
1130
1146
  // The window, strings (and functions) also have 'length'
1131
- if( i == null || typeof array === 'string' || array.setInterval )
1147
+ if( i == null || typeof array === 'string' || array.setInterval ) {
1132
1148
  ret[0] = array;
1133
- else
1134
- while( i )
1135
- ret[--i] = array[i];
1149
+ }
1150
+ else {
1151
+ while( i ) ret[--i] = array[i];
1152
+ }
1136
1153
  }
1137
1154
 
1138
1155
  return ret;
1139
1156
  },
1140
1157
 
1141
1158
  inArray: function(elem,array) {
1142
- return (array.indexOf) ? array.indexOf(elem) : Array.prototype.indexOf.call(array, elem);
1159
+ return array.indexOf ? array.indexOf(elem) : Array.prototype.indexOf.call(array, elem);
1143
1160
  },
1144
1161
 
1145
1162
  // Check to see if the W3C box model is being used
1146
- boxModel: !SC.browser.msie || document.compatMode == "CSS1Compat",
1163
+ boxModel: !SC.browser.msie || document.compatMode === "CSS1Compat",
1147
1164
 
1148
1165
  props: {
1149
1166
  "for": "htmlFor",
@@ -1163,7 +1180,7 @@ SC.CoreQuery = (function() {
1163
1180
  if (SC.typeOf(value) === SC.T_FUNCTION) value = value.call(elem, i);
1164
1181
 
1165
1182
  // Handle passing in a number to a CSS property
1166
- return value && (typeof value === "number") && type == "curCSS" && !exclude.test( name ) ? value + "px" : value;
1183
+ return value && (typeof value === "number") && type === "curCSS" && !exclude.test( name ) ? value + "px" : value;
1167
1184
  },
1168
1185
 
1169
1186
 
@@ -1184,17 +1201,18 @@ SC.CoreQuery = (function() {
1184
1201
  // internal only, use addClass("class")
1185
1202
  add: function( elem, classNames ) {
1186
1203
  var has = CQ.className.has ;
1187
- CQ.each((classNames || "").split(/\s+/), function(i, className){
1188
- if ( elem.nodeType == 1 && !has( elem.className, className ) )
1204
+ CQ.each((classNames || "").split(checkforSpaceRegEx), function(i, className){
1205
+ if ( elem.nodeType === 1 && !has( elem.className, className ) ) {
1189
1206
  elem.className += (elem.className ? " " : "") + className;
1207
+ }
1190
1208
  });
1191
1209
  },
1192
1210
 
1193
1211
  // internal only, use removeClass("class")
1194
1212
  remove: function( elem, classNames ) {
1195
- if (elem.nodeType == 1) {
1213
+ if (elem.nodeType === 1) {
1196
1214
  elem.className = classNames !== undefined ?
1197
- CQ.grep(elem.className.split(/\s+/), function(className){
1215
+ CQ.grep(elem.className.split(checkforSpaceRegEx), function(className){
1198
1216
  return !CQ.className.has( classNames, className );
1199
1217
  }).join(" ") : "";
1200
1218
  }
@@ -1202,16 +1220,16 @@ SC.CoreQuery = (function() {
1202
1220
 
1203
1221
  // internal only, use hasClass("class")
1204
1222
  has: function( elem, className ) {
1205
- return elem && CQ.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
1223
+ return elem && CQ.inArray( className, (elem.className || elem).toString().split(checkforSpaceRegEx) ) > -1;
1206
1224
  }
1207
1225
  },
1208
1226
 
1209
1227
  /** @private A method for quickly swapping in/out CSS properties to get
1210
1228
  correct calculations */
1211
1229
  swap: function( elem, options, callback, direction, arg ) {
1212
- var old = {};
1230
+ var old = {}, name;
1213
1231
  // Remember the old values, and insert the new ones
1214
- for ( var name in options ) {
1232
+ for ( name in options ) {
1215
1233
  old[ name ] = elem.style[ name ];
1216
1234
  elem.style[ name ] = options[ name ];
1217
1235
  }
@@ -1219,15 +1237,15 @@ SC.CoreQuery = (function() {
1219
1237
  var ret = callback(elem, direction, arg );
1220
1238
 
1221
1239
  // Revert the old values
1222
- for ( var name in options ) elem.style[ name ] = old[ name ];
1240
+ for ( name in options ) elem.style[ name ] = old[ name ];
1223
1241
  return ret ;
1224
1242
  },
1225
1243
 
1226
1244
  /** returns a normalized value for the specified style name. */
1227
1245
  css: function( elem, name, force ) {
1228
1246
  // handle special case for width/height
1229
- if ( name == "width" || name == "height" ) {
1230
- var val, which = (name == "width") ? LEFT_RIGHT : TOP_BOTTOM,
1247
+ if ( name === "width" || name === "height" ) {
1248
+ var val, which = (name === "width") ? LEFT_RIGHT : TOP_BOTTOM,
1231
1249
  props = CSS_DISPLAY_PROPS;
1232
1250
 
1233
1251
  val = SC.$.isVisible(elem) ? getWH(elem,name,which) : CQ.swap(elem,props,getWH,name,which) ;
@@ -1243,9 +1261,9 @@ SC.CoreQuery = (function() {
1243
1261
  var ret, style = elem.style;
1244
1262
 
1245
1263
  // We need to handle opacity special in IE
1246
- if ( name == "opacity" && SC.browser.msie ) {
1264
+ if ( name === "opacity" && SC.browser.msie ) {
1247
1265
  ret = CQ.attr( style, "opacity" );
1248
- return ret == "" ? "1" : ret;
1266
+ return ret === "" ? "1" : ret;
1249
1267
  }
1250
1268
 
1251
1269
  // Opera sometimes will give the wrong display answer, this fixes it,
@@ -1297,17 +1315,17 @@ SC.CoreQuery = (function() {
1297
1315
 
1298
1316
  // Since we flip the display style, we have to handle that
1299
1317
  // one special, otherwise get the value
1300
- ret = (name == "display" && swap[stack.length-1]!=null) ? "none" :
1318
+ ret = (name === "display" && swap[stack.length-1]!==null) ? "none" :
1301
1319
  (computedStyle && computedStyle.getPropertyValue(name)) || "";
1302
1320
 
1303
1321
  // Finally, revert the display styles back
1304
1322
  for ( i = 0, swLen = swap.length; i < swLen; i++ ) {
1305
- if (swap[i]!=null) stack[i].style.display = swap[i];
1323
+ if (swap[i]!==null) stack[i].style.display = swap[i];
1306
1324
  }
1307
1325
  }
1308
1326
 
1309
1327
  // We should always get a number back from opacity
1310
- if (name == "opacity" && ret == "") ret = "1";
1328
+ if (name === "opacity" && ret === "") ret = "1";
1311
1329
 
1312
1330
  } else if (elem.currentStyle) {
1313
1331
  // var camelCase = name.camelize();
@@ -1344,7 +1362,7 @@ SC.CoreQuery = (function() {
1344
1362
  dir: function( elem, dir ){
1345
1363
  var matched = [], cur = elem[dir];
1346
1364
  while ( cur && cur != document ) {
1347
- if ( cur.nodeType == 1 ) matched.push( cur );
1365
+ if ( cur.nodeType === 1 ) matched.push( cur );
1348
1366
  cur = cur[dir];
1349
1367
  }
1350
1368
  return matched;
@@ -1358,7 +1376,7 @@ SC.CoreQuery = (function() {
1358
1376
  result = result || 1;
1359
1377
  var num = 0;
1360
1378
  for ( ; cur; cur = cur[dir] ) {
1361
- if ( cur.nodeType == 1 && ++num == result ) break;
1379
+ if ( cur.nodeType === 1 && ++num == result ) break;
1362
1380
  }
1363
1381
  return cur;
1364
1382
  },
@@ -1367,7 +1385,7 @@ SC.CoreQuery = (function() {
1367
1385
  sibling: function( n, elem ) {
1368
1386
  var r = [];
1369
1387
  for ( ; n; n = n.nextSibling ) {
1370
- if ( n.nodeType == 1 && n != elem ) r.push( n );
1388
+ if ( n.nodeType === 1 && n != elem ) r.push( n );
1371
1389
  }
1372
1390
  return r;
1373
1391
  },
@@ -1375,7 +1393,7 @@ SC.CoreQuery = (function() {
1375
1393
  /** Primitive helper can read or update an attribute on an element. */
1376
1394
  attr: function( elem, name, value ) {
1377
1395
  // don't set attributes on text and comment nodes
1378
- if (!elem || elem.nodeType == 3 || elem.nodeType == 8) return undefined;
1396
+ if (!elem || elem.nodeType === 3 || elem.nodeType === 8) return undefined;
1379
1397
 
1380
1398
  var notxml = !CQ.isXMLDoc( elem ),
1381
1399
  set = value !== undefined,
@@ -1389,11 +1407,11 @@ SC.CoreQuery = (function() {
1389
1407
  if ( elem.tagName ) {
1390
1408
 
1391
1409
  // These attributes require special treatment
1392
- var special = /href|src|style/.test( name );
1410
+ var special = specialAttributesRegEx.test( name );
1393
1411
 
1394
1412
  // Safari mis-reports the default selected property of a hidden option
1395
1413
  // Accessing the parent's selectedIndex property fixes it
1396
- if ( name == "selected" && elem.parentNode ) {
1414
+ if ( name === "selected" && elem.parentNode ) {
1397
1415
  elem.parentNode.selectedIndex;
1398
1416
  }
1399
1417
 
@@ -1402,7 +1420,7 @@ SC.CoreQuery = (function() {
1402
1420
  if ( set ){
1403
1421
  // We can't allow the type property to be changed (since it causes
1404
1422
  // problems in IE)
1405
- if ( name == "type" && CQ.nodeName( elem, "input" ) && elem.parentNode ) {
1423
+ if ( name === "type" && CQ.nodeName( elem, "input" ) && elem.parentNode ) {
1406
1424
  throw "type property can't be changed";
1407
1425
  }
1408
1426
 
@@ -1417,11 +1435,11 @@ SC.CoreQuery = (function() {
1417
1435
 
1418
1436
  // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
1419
1437
  // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
1420
- if ( name == "tabIndex" ) {
1438
+ if ( name === "tabIndex" ) {
1421
1439
  var attributeNode = elem.getAttributeNode( "tabIndex" );
1422
1440
  return attributeNode && attributeNode.specified
1423
1441
  ? attributeNode.value
1424
- : elem.nodeName.match(/(button|input|object|select|textarea)/i)
1442
+ : elem.nodeName.match(tagsWithTabIndexRegEx)
1425
1443
  ? 0
1426
1444
  : elem.nodeName.match(/^(a|area)$/i) && elem.href
1427
1445
  ? 0
@@ -1431,9 +1449,9 @@ SC.CoreQuery = (function() {
1431
1449
  return elem[ name ];
1432
1450
  }
1433
1451
 
1434
- if ( msie && notxml && name === "style" )
1452
+ if ( msie && notxml && name === "style" ) {
1435
1453
  return CQ.attr( elem.style, "cssText", value );
1436
-
1454
+ }
1437
1455
  // convert the value to a string (all browsers do this but IE) see
1438
1456
  // #1070 (jQuery)
1439
1457
  if ( set ) elem.setAttribute( name, "" + value );
@@ -1450,19 +1468,19 @@ SC.CoreQuery = (function() {
1450
1468
  // elem is actually elem.style ... set the style
1451
1469
 
1452
1470
  // IE uses filters for opacity
1453
- if ( msie && name == "opacity" ) {
1471
+ if ( msie && name === "opacity" ) {
1454
1472
  if ( set ) {
1455
1473
  // IE has trouble with opacity if it does not have layout
1456
1474
  // Force it by setting the zoom level
1457
1475
  elem.zoom = 1;
1458
1476
 
1459
1477
  // Set the alpha filter to set the opacity
1460
- elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
1478
+ elem.filter = (elem.filter || "").replace( alphaDetectRegEx, "" ) +
1461
1479
  (parseInt(value,0) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
1462
1480
  }
1463
1481
 
1464
1482
  return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
1465
- (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
1483
+ (parseFloat( elem.filter.match(alphaReplaceRegEx)[1] ) / 100) + '':
1466
1484
  "";
1467
1485
  }
1468
1486
 
@@ -1510,9 +1528,9 @@ SC.CoreQuery = (function() {
1510
1528
  CQ.fn[ name ] = function( selector ) {
1511
1529
  var ret = CQ.map( this, fn );
1512
1530
 
1513
- if ( selector && typeof selector == "string" )
1531
+ if ( selector && typeof selector === "string" ) {
1514
1532
  ret = CQ.multiFilter( selector, ret );
1515
-
1533
+ }
1516
1534
  return this.pushStack(ret.uniq());
1517
1535
  };
1518
1536
  });
@@ -1528,8 +1546,9 @@ SC.CoreQuery = (function() {
1528
1546
  var args = arguments;
1529
1547
 
1530
1548
  return this.each(function(){
1531
- for ( var i = 0, length = args.length; i < length; i++ )
1549
+ for ( var i = 0, length = args.length; i < length; i++ ) {
1532
1550
  CQ( args[ i ] )[ original ]( this );
1551
+ }
1533
1552
  });
1534
1553
  };
1535
1554
  });
@@ -1537,7 +1556,7 @@ SC.CoreQuery = (function() {
1537
1556
  CQ.each({
1538
1557
  removeAttr: function( name ) {
1539
1558
  CQ.attr( this, name, "" );
1540
- if (this.nodeType == 1) this.removeAttribute( name );
1559
+ if (this.nodeType === 1) this.removeAttribute( name );
1541
1560
  },
1542
1561
 
1543
1562
  addClass: function( classNames ) {
@@ -1578,7 +1597,7 @@ SC.CoreQuery = (function() {
1578
1597
 
1579
1598
  // Setup width and height functions
1580
1599
  CQ.each([ "Height", "Width" ], function(i, name){
1581
- var type = name.toLowerCase();
1600
+ var type = name.toLowerCase(), ret;
1582
1601
 
1583
1602
  CQ.fn[ type ] = function( size ) {
1584
1603
 
@@ -1611,7 +1630,7 @@ SC.CoreQuery = (function() {
1611
1630
 
1612
1631
  // get/set element width/or height
1613
1632
  } else {
1614
- if (size == undefined) {
1633
+ if (size === undefined) {
1615
1634
  return this.length ? CQ.css(this[0], type) : null ;
1616
1635
 
1617
1636
  // Set the width or height on the element (default to pixels if value is unitless)
@@ -1666,7 +1685,7 @@ SC.CoreQuery = (function() {
1666
1685
  doc = elem.ownerDocument,
1667
1686
  safari2 = br.safari && parseInt(br.version,0) < 522 && !(/adobeair/i).test(br.userAgent),
1668
1687
  css = CQ.curCSS,
1669
- fixed = CQ.css(elem, "position") == "fixed";
1688
+ fixed = CQ.css(elem, "position") === "fixed";
1670
1689
 
1671
1690
  // Use getBoundingClientRect if available
1672
1691
  if (!(br.mozilla && elem==document.body) && elem.getBoundingClientRect){
@@ -1703,7 +1722,7 @@ SC.CoreQuery = (function() {
1703
1722
 
1704
1723
  // Add the document scroll offsets if position is fixed on any
1705
1724
  // offsetParent
1706
- if (!fixed && css(offsetParent, "position") == "fixed") fixed = true;
1725
+ if (!fixed && css(offsetParent, "position") === "fixed") fixed = true;
1707
1726
 
1708
1727
  // Set offsetChild to previous offsetParent unless it is the body
1709
1728
  // element
@@ -1713,7 +1732,7 @@ SC.CoreQuery = (function() {
1713
1732
  }
1714
1733
 
1715
1734
  // Get parent scroll offsets
1716
- while ( parent && parent.tagName && !(/^body|html$/i).test(parent.tagName)) {
1735
+ while ( parent && parent.tagName && !(bodyHTMLOffsetRegEx).test(parent.tagName)) {
1717
1736
 
1718
1737
  // Remove parent scroll UNLESS that parent is inline or a table to
1719
1738
  // work around Opera inline/table scrollLeft/Top bug
@@ -1724,7 +1743,7 @@ SC.CoreQuery = (function() {
1724
1743
 
1725
1744
  // Mozilla does not add the border for a parent that has overflow !=
1726
1745
  // visible
1727
- if ( br.mozilla && css(parent, "overflow") != "visible" ) border(parent);
1746
+ if ( br.mozilla && css(parent, "overflow") !== "visible" ) border(parent);
1728
1747
 
1729
1748
  // Get next parent
1730
1749
  parent = parent.parentNode;
@@ -1734,8 +1753,8 @@ SC.CoreQuery = (function() {
1734
1753
  // element/offsetParent or absolutely positioned offsetChild
1735
1754
  // Mozilla doubles body offsets with a non-absolutely positioned
1736
1755
  // offsetChild
1737
- if ((safari2 && (fixed || css(offsetChild, "position") == "absolute"))||
1738
- (br.mozilla && css(offsetChild, "position") != "absolute") ) {
1756
+ if ((safari2 && (fixed || css(offsetChild, "position") === "absolute"))||
1757
+ (br.mozilla && css(offsetChild, "position") !== "absolute") ) {
1739
1758
  add( -doc.body.offsetLeft, -doc.body.offsetTop );
1740
1759
  }
1741
1760
 
@@ -1762,7 +1781,7 @@ SC.CoreQuery = (function() {
1762
1781
 
1763
1782
  // Get correct offsets
1764
1783
  offset = this.offset(),
1765
- parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
1784
+ parentOffset = bodyHTMLOffsetRegEx.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
1766
1785
 
1767
1786
  // Subtract element margins
1768
1787
  // note: when an element has margin: auto the offsetLeft and marginLeft
@@ -1786,7 +1805,7 @@ SC.CoreQuery = (function() {
1786
1805
 
1787
1806
  offsetParent: function() {
1788
1807
  var offsetParent = this[0].offsetParent || document.body;
1789
- while ( offsetParent && (!(/^body|html$/i).test(offsetParent.tagName) && CQ.css(offsetParent, 'position') == 'static') ) {
1808
+ while ( offsetParent && (!(bodyHTMLOffsetRegEx).test(offsetParent.tagName) && CQ.css(offsetParent, 'position') === 'static') ) {
1790
1809
  offsetParent = offsetParent.offsetParent;
1791
1810
  }
1792
1811
  return CQ(offsetParent);
@@ -1801,7 +1820,7 @@ SC.CoreQuery = (function() {
1801
1820
  CQ.fn[ method ] = function(val) {
1802
1821
  if (!this[0]) return;
1803
1822
 
1804
- return val != undefined ?
1823
+ return val !== undefined ?
1805
1824
 
1806
1825
  // Set the scroll offset
1807
1826
  this.each(function() {
@@ -1839,7 +1858,7 @@ SC.mixin(SC.$.fn, /** @scope SC.CoreQuery.prototype */ {
1839
1858
  var values = [];
1840
1859
  var len = this.length, idx=0;
1841
1860
  for(idx=0;idx<len;idx++) {
1842
- values[idx] = '%@: %@'.fmt(idx,(this[idx]) ? this[idx].toString() : '(null)');
1861
+ values[idx] = '%@: %@'.fmt(idx, this[idx] ? this[idx].toString() : '(null)');
1843
1862
  }
1844
1863
  return "<$:%@>(%@)".fmt(SC.guidFor(this),values.join(' , '));
1845
1864
  },
@@ -2002,11 +2021,12 @@ SC.mixin(SC.$.fn, /** @scope SC.CoreQuery.prototype */ {
2002
2021
  // loop through an update some enumerable methods. If this is CoreQuery,
2003
2022
  // we just need to patch up the wrapped methods. If this is jQuery, we
2004
2023
  // need to go through the entire set of SC.Enumerable.
2005
- var isCoreQuery = SC.$.jquery === 'SC.CoreQuery';
2006
- var fn = SC.$.fn, enumerable = isCoreQuery ? wrappers : SC.Enumerable ;
2024
+ var isCoreQuery = SC.$.jquery === 'SC.CoreQuery',
2025
+ fn = SC.$.fn, enumerable = isCoreQuery ? wrappers : SC.Enumerable ,
2026
+ value;
2007
2027
  for(var key in enumerable) {
2008
2028
  if (!enumerable.hasOwnProperty(key)) continue ;
2009
- var value = enumerable[key];
2029
+ value = enumerable[key];
2010
2030
  if (key in wrappers) {
2011
2031
  original[key] = fn[key]; value = wrappers[key];
2012
2032
  }