sproutcore 1.6.0.beta.3-x86-mingw32 → 1.6.0.rc.1-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. data/CHANGELOG +33 -0
  2. data/Rakefile +213 -10
  3. data/VERSION.yml +1 -1
  4. data/lib/Buildfile +5 -1
  5. data/lib/buildtasks/manifest.rake +7 -1
  6. data/lib/frameworks/sproutcore/Buildfile +3 -2
  7. data/lib/frameworks/sproutcore/CHANGELOG.md +154 -1
  8. data/lib/frameworks/sproutcore/README.md +1 -1
  9. data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.css +9 -0
  10. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +254 -207
  11. data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +243 -172
  12. data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +29 -0
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +5 -0
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +6 -2
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +36 -14
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +3 -3
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +14 -15
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +14 -14
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +2 -7
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +3 -3
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +2 -2
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/responder.js +1 -1
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +20 -12
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +61 -0
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +20 -6
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +42 -0
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controls/button.js +39 -57
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +5 -3
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +32 -0
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +25 -0
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +28 -17
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +396 -0
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +1 -1
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/{system → views}/bindable_span.js +2 -1
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +78 -51
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +4 -3
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +2 -1
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +233 -67
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +3 -1
  40. data/lib/frameworks/sproutcore/frameworks/core_tools/core.js +8 -2
  41. data/lib/frameworks/sproutcore/frameworks/core_tools/data_source.js +1 -1
  42. data/lib/frameworks/sproutcore/frameworks/core_tools/models/target.js +1 -1
  43. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +15 -8
  44. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +2 -2
  45. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -0
  46. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +3 -2
  47. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +66 -55
  48. data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +190 -0
  49. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +21 -0
  50. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +15 -1
  51. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +0 -1
  52. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +212 -182
  53. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +14 -16
  54. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +1 -1
  55. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +23 -11
  56. data/lib/frameworks/sproutcore/frameworks/desktop/resources/alert.css +49 -0
  57. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/a_sample_image.jpg +0 -0
  58. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/apple-logo1.jpeg +0 -0
  59. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/iframe.html +0 -0
  60. data/lib/frameworks/sproutcore/frameworks/desktop/resources/disclosure.css +20 -0
  61. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/drag.css +1 -1
  62. data/lib/frameworks/sproutcore/frameworks/desktop/resources/icons.css +214 -0
  63. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/cap.png +0 -0
  64. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/downbutton.png +0 -0
  65. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-16.png +0 -0
  66. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-24.png +0 -0
  67. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-48.png +0 -0
  68. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-16.png +0 -0
  69. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-24.png +0 -0
  70. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-cancel-24.png +0 -0
  71. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-16.png +0 -0
  72. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-24.png +0 -0
  73. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-down-24.png +0 -0
  74. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-error-48.png +0 -0
  75. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-16.png +0 -0
  76. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-24.png +0 -0
  77. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-16.png +0 -0
  78. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-24.png +0 -0
  79. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-16.png +0 -0
  80. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-24.png +0 -0
  81. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-16.png +0 -0
  82. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-24.png +0 -0
  83. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-16.png +0 -0
  84. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-24.png +0 -0
  85. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-48.png +0 -0
  86. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-left-24.png +0 -0
  87. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-16.png +0 -0
  88. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-24.png +0 -0
  89. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-redo-24.png +0 -0
  90. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-right-24.png +0 -0
  91. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-tools-24.png +0 -0
  92. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-16.png +0 -0
  93. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-24.png +0 -0
  94. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-undo-24.png +0 -0
  95. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-up-24.png +0 -0
  96. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-16.png +0 -0
  97. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-24.png +0 -0
  98. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-bottom.png +0 -0
  99. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-center.png +0 -0
  100. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-top.png +0 -0
  101. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/track.png +0 -0
  102. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/upbutton.png +0 -0
  103. data/lib/frameworks/sproutcore/frameworks/desktop/resources/list_item.css +145 -0
  104. data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu.css +10 -0
  105. data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu_item_view.css +88 -0
  106. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/modal.css +3 -4
  107. data/lib/frameworks/sproutcore/frameworks/desktop/resources/panel.css +91 -0
  108. data/lib/frameworks/sproutcore/frameworks/desktop/resources/picker.css +37 -0
  109. data/lib/frameworks/sproutcore/frameworks/desktop/resources/progress.css +29 -0
  110. data/lib/frameworks/sproutcore/frameworks/desktop/resources/radio.css +11 -0
  111. data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +121 -0
  112. data/lib/frameworks/sproutcore/frameworks/desktop/resources/separator.css +20 -0
  113. data/lib/frameworks/sproutcore/frameworks/desktop/resources/slider.css +34 -0
  114. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split.css +0 -0
  115. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split_divider.css +0 -0
  116. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/tab.css +0 -0
  117. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/toolbar.css +0 -0
  118. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/touch-scroller.css +13 -13
  119. data/lib/frameworks/sproutcore/frameworks/desktop/resources/well.css +65 -0
  120. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +114 -103
  121. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +3 -2
  122. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +7 -6
  123. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +18 -0
  124. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +4 -7
  125. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +9 -2
  126. data/lib/frameworks/sproutcore/frameworks/desktop/{panes → views}/select_button.js +43 -0
  127. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +35 -33
  128. data/lib/frameworks/sproutcore/frameworks/foundation/core.js +2 -2
  129. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +15 -8
  130. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +4 -7
  131. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +55 -13
  132. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +3 -1
  133. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +7 -7
  134. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/benchmark.css +0 -0
  135. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/blank.gif +0 -0
  136. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/bootstrap.rhtml +0 -0
  137. data/lib/frameworks/sproutcore/frameworks/foundation/resources/button_view.css +36 -0
  138. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/checkbox_view.css +0 -0
  139. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/debug/control-test-pane.css +0 -0
  140. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/favicon.ico +0 -0
  141. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-logo.png +0 -0
  142. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.jpg +0 -0
  143. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.png +0 -0
  144. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.jpg +0 -0
  145. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.png +0 -0
  146. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup.png +0 -0
  147. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore.png +0 -0
  148. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/inline_editor.css +0 -0
  149. data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +47 -0
  150. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/radio_view.css +0 -0
  151. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/static_layout.css +1 -1
  152. data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +130 -0
  153. data/lib/frameworks/sproutcore/frameworks/foundation/system/chance.js +5 -1
  154. data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +0 -43
  155. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +5 -2
  156. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date.js +4 -4
  157. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +4 -5
  158. data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
  159. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +5 -5
  160. data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +6 -3
  161. data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +11 -0
  162. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  163. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +2 -2
  164. data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -2
  165. data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +1 -1
  166. data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
  167. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
  168. data/lib/frameworks/sproutcore/frameworks/statechart/debug/monitor.js +4 -73
  169. data/lib/frameworks/sproutcore/frameworks/statechart/debug/sequence_matcher.js +189 -0
  170. data/lib/frameworks/sproutcore/frameworks/statechart/ext/function.js +122 -0
  171. data/lib/frameworks/sproutcore/frameworks/statechart/system/async.js +88 -0
  172. data/lib/frameworks/sproutcore/frameworks/statechart/system/empty_state.js +34 -0
  173. data/lib/frameworks/sproutcore/frameworks/statechart/system/history_state.js +97 -0
  174. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +7 -189
  175. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +14 -78
  176. data/lib/frameworks/sproutcore/frameworks/statechart/tests/debug/sequence_matcher.js +464 -0
  177. data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/basic/with_concurrent_states.js +31 -11
  178. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/async/with_concurrent_states.js +6 -4
  179. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/advanced.js +40 -6
  180. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/basic.js +22 -2
  181. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/intermediate.js +44 -3
  182. data/lib/frameworks/sproutcore/frameworks/testing/core.js +61 -9
  183. data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/additions.css +0 -0
  184. data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/runner.css +11 -2
  185. data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/testsuite.css +0 -0
  186. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +66 -27
  187. data/lib/frameworks/sproutcore/frameworks/testing/tests/spy_on.js +41 -0
  188. data/lib/frameworks/sproutcore/frameworks/testing/tests/stub_method.js +9 -0
  189. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +24 -0
  190. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/fonts.css +39 -0
  191. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/reset.css +126 -0
  192. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/view.css +57 -0
  193. data/lib/frameworks/sproutcore/lib/index.rhtml +7 -4
  194. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked.png +0 -0
  195. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked_active.png +0 -0
  196. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed.png +0 -0
  197. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed_active.png +0 -0
  198. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked.png +0 -0
  199. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked_active.png +0 -0
  200. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked.png +0 -0
  201. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked_active.png +0 -0
  202. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed.png +0 -0
  203. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed_active.png +0 -0
  204. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked.png +0 -0
  205. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked_active.png +0 -0
  206. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +13 -4
  207. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +16 -14
  208. data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu_item.png +0 -0
  209. data/lib/gen/app/templates/apps/@target_name@/Buildfile +1 -4
  210. data/lib/gen/app/templates/apps/@target_name@/core.js +1 -4
  211. data/lib/gen/app/templates/apps/@target_name@/main.js +1 -4
  212. data/lib/gen/app/templates/apps/@target_name@/resources/main_page.js +1 -4
  213. data/lib/gen/app/templates/apps/@target_name@/theme.js +1 -4
  214. data/lib/gen/controller/templates/controllers/{@filename@.js → @filename@_controller.js} +1 -4
  215. data/lib/gen/controller/templates/tests/controllers/{@filename@.js → @filename@_test.js} +1 -4
  216. data/lib/gen/data-source/templates/data_sources/{@filename@.js → @filename@_data_source.js} +1 -4
  217. data/lib/gen/design/templates/resources/@filename@.js +1 -4
  218. data/lib/gen/framework/templates/frameworks/@target_name@/core.js +1 -4
  219. data/lib/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +1 -4
  220. data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -4
  221. data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +2 -0
  222. data/lib/gen/html_project/templates/@filename@/Buildfile +1 -4
  223. data/lib/gen/html_project/templates/@filename@/README +1 -4
  224. data/lib/gen/language/templates/@filename@/strings.js +1 -4
  225. data/lib/gen/model/templates/fixtures/{@filename@.js → @filename@_fixtures.js} +2 -5
  226. data/lib/gen/model/templates/models/{@filename@.js → @filename@_model.js} +1 -4
  227. data/lib/gen/model/templates/tests/models/{@filename@.js → @filename@_test.js} +1 -4
  228. data/lib/gen/page/templates/pages/@target_name@/Buildfile +1 -4
  229. data/lib/gen/page/templates/pages/@target_name@/core.js +1 -4
  230. data/lib/gen/page/templates/pages/@target_name@/en.lproj/strings.js +1 -4
  231. data/lib/gen/page/templates/pages/@target_name@/resources/body.css +3 -1
  232. data/lib/gen/project/templates/@filename@/Buildfile +1 -4
  233. data/lib/gen/project/templates/@filename@/README +1 -5
  234. data/lib/gen/responder/templates/states/{@filename@.js → @filename@_state.js} +1 -4
  235. data/lib/gen/test/templates/tests/{@filename@.js → @filename@_test.js} +1 -4
  236. data/lib/gen/theme/templates/themes/@target_name@/resources/theme_styles.css +1 -5
  237. data/lib/gen/theme/templates/themes/@target_name@/theme.js +1 -4
  238. data/lib/gen/view/templates/tests/views/{@filename@.js → @filename@_test.js} +1 -4
  239. data/lib/gen/view/templates/views/{@filename@.js → @filename@_view.js} +1 -4
  240. data/lib/sproutcore.rb +4 -1
  241. data/lib/sproutcore/builders/handlebars.rb +1 -1
  242. data/lib/sproutcore/builders/module.rb +2 -2
  243. data/lib/sproutcore/helpers/static_helper.rb +4 -2
  244. data/lib/sproutcore/models/generator.rb +22 -0
  245. data/lib/sproutcore/models/manifest_entry.rb +1 -0
  246. data/lib/sproutcore/models/target.rb +4 -1
  247. data/lib/sproutcore/rack/builder.rb +3 -0
  248. data/lib/sproutcore/tools.rb +11 -11
  249. data/lib/sproutcore/tools/init.rb +10 -22
  250. data/lib/sproutcore/tools/manifest.rb +21 -22
  251. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +21 -1
  252. data/spec/fixtures/ordered_entries/apps/template_style/a.js +0 -0
  253. data/spec/fixtures/ordered_entries/apps/template_style/template_style.js +0 -0
  254. data/spec/lib/buildfile_commands/build_task_spec.rb +1 -1
  255. data/spec/lib/tools/manifest_spec.rb +11 -0
  256. data/sproutcore.gemspec +2 -2
  257. data/vendor/chance/lib/chance/instance.rb +3 -1
  258. metadata +150 -106
  259. data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/core.css +0 -378
  260. data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/view.css +0 -57
  261. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +0 -56
  262. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +0 -73
  263. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +0 -916
  264. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
  265. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -185
  266. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +0 -12
  267. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +0 -101
  268. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +0 -91
  269. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +0 -35
  270. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +0 -33
  271. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +0 -10
  272. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +0 -132
  273. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +0 -19
  274. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +0 -69
  275. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +0 -14
  276. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +0 -71
  277. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +0 -40
  278. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +0 -47
  279. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +0 -146
  280. data/lib/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +0 -69
@@ -6,49 +6,58 @@
6
6
  // ==========================================================================
7
7
  /*global ActiveXObject */
8
8
 
9
+ /*
10
+ TODO Document SC.Response and SC.XHRResponse
11
+ */
12
+
9
13
  /**
14
+ @class
15
+
10
16
  A response represents a single response from a server request. An instance
11
17
  of this class is returned whenever you call SC.Request.send().
12
-
13
- TODO: Add more info
14
-
18
+
15
19
  @extend SC.Object
16
20
  @since SproutCore 1.0
17
21
  */
18
22
  SC.Response = SC.Object.extend(
19
23
  /** @scope SC.Response.prototype */ {
20
-
24
+
21
25
  /**
22
26
  Becomes true if there was a failure. Makes this into an error object.
23
27
 
24
- @property {Boolean}
28
+ @type Boolean
29
+ @default NO
25
30
  */
26
31
  isError: NO,
27
-
32
+
28
33
  /**
29
34
  Always the current response
30
-
31
- @property {SC.Response}
35
+
36
+ @field
37
+ @type SC.Response
38
+ @default `this`
32
39
  */
33
40
  errorValue: function() {
34
41
  return this;
35
42
  }.property().cacheable(),
36
-
43
+
37
44
  /**
38
45
  The error object generated when this becomes an error
39
-
40
- @property {SC.Error}
46
+
47
+ @type SC.Error
48
+ @default null
41
49
  */
42
50
  errorObject: null,
43
-
44
- /**
51
+
52
+ /**
45
53
  Request used to generate this response. This is a copy of the original
46
54
  request object as you may have modified the original request object since
47
55
  then.
48
-
56
+
49
57
  To retrieve the original request object use originalRequest.
50
-
51
- @property {SC.Request}
58
+
59
+ @type SC.Request
60
+ @default null
52
61
  */
53
62
  request: null,
54
63
 
@@ -56,38 +65,47 @@ SC.Response = SC.Object.extend(
56
65
  The request object that originated this request series. Mostly this is
57
66
  useful if you are looking for a reference to the original request. To
58
67
  inspect actual properties you should use request instead.
59
-
60
- @property {SC.Request}
68
+
69
+ @field
70
+ @type SC.Request
71
+ @observes request
61
72
  */
62
73
  originalRequest: function() {
63
74
  var ret = this.get('request');
64
- while (ret.get('source')) ret = ret.get('source');
75
+ while (ret.get('source')) { ret = ret.get('source'); }
65
76
  return ret ;
66
77
  }.property('request').cacheable(),
67
78
 
68
79
  /**
69
- Type of request. Must be an HTTP method. Based on the request
70
-
71
- @property {String}
80
+ Type of request. Must be an HTTP method. Based on the request.
81
+
82
+ @field
83
+ @type String
84
+ @observes request
72
85
  */
73
86
  type: function() {
74
87
  return this.getPath('request.type');
75
88
  }.property('request').cacheable(),
76
-
89
+
77
90
  /**
78
- URL of request.
79
-
80
- @property {String}
91
+ URL of request.
92
+
93
+ @field
94
+ @type String
95
+ @observes request
81
96
  */
82
97
  address: function() {
83
98
  return this.getPath('request.address');
84
99
  }.property('request').cacheable(),
85
-
100
+
86
101
  /**
87
102
  If set then will attempt to automatically parse response as JSON
88
103
  regardless of headers.
89
-
90
- @property {Boolean}
104
+
105
+ @field
106
+ @type Boolean
107
+ @default NO
108
+ @observes request
91
109
  */
92
110
  isJSON: function() {
93
111
  return this.getPath('request.isJSON') || NO;
@@ -96,41 +114,50 @@ SC.Response = SC.Object.extend(
96
114
  /**
97
115
  If set, then will attempt to automatically parse response as XML
98
116
  regarldess of headers.
99
-
100
- @property {Boolean}
117
+
118
+ @field
119
+ @type Boolean
120
+ @default NO
121
+ @observes request
101
122
  */
102
123
  isXML: function() {
103
124
  return this.getPath('request.isXML') || NO ;
104
125
  }.property('request').cacheable(),
105
-
106
- /**
126
+
127
+ /**
107
128
  Returns the hash of listeners set on the request.
108
-
109
- @property {Hash}
129
+
130
+ @field
131
+ @type Hash
132
+ @observes request
110
133
  */
111
134
  listeners: function() {
112
135
  return this.getPath('request.listeners');
113
136
  }.property('request').cacheable(),
114
-
137
+
115
138
  /**
116
139
  The response status code.
117
-
118
- @property {Number}
140
+
141
+ @type Number
142
+ @default -100
119
143
  */
120
144
  status: -100, // READY
121
145
 
122
146
  /**
123
- Headers from the response. Computed on-demand
124
-
125
- @property {Hash}
147
+ Headers from the response. Computed on-demand
148
+
149
+ @type Hash
150
+ @default null
126
151
  */
127
152
  headers: null,
128
-
153
+
129
154
  /**
130
- Response body. If isJSON was set, will be parsed automatically.
131
-
132
- @response {Hash|String|SC.Error} the response body or the parsed JSON.
133
- Returns a SC.Error instance if there is a JSON parsing error.
155
+ The response body or the parsed JSON. Returns a SC.Error instance
156
+ if there is a JSON parsing error. If isJSON was set, will be parsed
157
+ automatically.
158
+
159
+ @field
160
+ @type {Hash|String|SC.Error}
134
161
  */
135
162
  body: function() {
136
163
  // TODO: support XML
@@ -147,74 +174,82 @@ SC.Response = SC.Object.extend(
147
174
  }
148
175
  return ret;
149
176
  }.property('encodedBody').cacheable(),
150
-
151
- /**
177
+
178
+ /**
152
179
  @private
153
180
  @deprecated
154
-
155
- Alias for body. Provides compatibility with older code.
156
-
157
- @property {Hash|String}
181
+
182
+ Alias for body. Provides compatibility with older code.
183
+
184
+ @type Hash|String
185
+ @see #body
158
186
  */
159
187
  response: function() {
160
188
  return this.get('body');
161
189
  }.property('body').cacheable(),
162
-
190
+
163
191
  /**
164
192
  Set to YES if response is cancelled
193
+
194
+ @type Boolean
195
+ @default NO
165
196
  */
166
197
  isCancelled: NO,
167
-
198
+
168
199
  /**
169
- Set to YES if the request timed out. Set to NO if the request has
170
- completed before the timeout value. Set to null if the timeout timer is
200
+ Set to YES if the request timed out. Set to NO if the request has
201
+ completed before the timeout value. Set to null if the timeout timer is
171
202
  still ticking.
203
+
204
+ @type Boolean
205
+ @default null
172
206
  */
173
207
  timedOut: null,
174
208
 
175
209
  /**
176
210
  The timer tracking the timeout
211
+
212
+ @type Number
213
+ @default null
177
214
  */
178
215
  timeoutTimer: null,
179
-
216
+
217
+
180
218
  // ..........................................................
181
219
  // METHODS
182
220
  //
183
221
 
184
222
  /**
185
- Called by the request manager when its time to actually run. This will
186
- invoke any callbacks on the source request then invoke transport() to
223
+ Called by the request manager when its time to actually run. This will
224
+ invoke any callbacks on the source request then invoke transport() to
187
225
  begin the actual request.
188
226
  */
189
227
  fire: function() {
190
228
  var req = this.get('request'),
191
229
  source = req ? req.get('source') : null;
192
-
193
-
230
+
194
231
  // first give the source a chance to fixup the request and response
195
232
  // then freeze req so no more changes can happen.
196
- if (source && source.willSend) source.willSend(req, this);
233
+ if (source && source.willSend) { source.willSend(req, this); }
197
234
  req.freeze();
198
235
 
199
236
  // if the source did not cancel the request, then invoke the transport
200
237
  // to actually trigger the request. This might receive a response
201
238
  // immediately if it is synchronous.
202
- if (!this.get('isCancelled')) this.invokeTransport();
203
-
239
+ if (!this.get('isCancelled')) { this.invokeTransport(); }
204
240
 
205
241
  // If the request specified a timeout value, then set a timer for it now.
206
242
  var timeout = req.get('timeout');
207
243
  if (timeout) {
208
244
  var timer = SC.Timer.schedule({
209
- target: this,
210
- action: 'timeoutReached',
245
+ target: this,
246
+ action: 'timeoutReached',
211
247
  interval: timeout,
212
- repeats: NO
248
+ repeats: NO
213
249
  });
214
250
  this.set('timeoutTimer', timer);
215
251
  }
216
252
 
217
-
218
253
  // if the transport did not cancel the request for some reason, let the
219
254
  // source know that the request was sent
220
255
  if (!this.get('isCancelled') && source && source.didSend) {
@@ -222,17 +257,21 @@ SC.Response = SC.Object.extend(
222
257
  }
223
258
  },
224
259
 
260
+ /**
261
+ Called by `SC.Response#fire()`. Starts the transport by invoking the
262
+ `SC.Response#receive()` function.
263
+ */
225
264
  invokeTransport: function() {
226
265
  this.receive(function(proceed) { this.set('status', 200); }, this);
227
266
  },
228
-
267
+
229
268
  /**
230
- Invoked by the transport when it receives a response. The passed-in
231
- callback will be invoked to actually process the response. If cancelled
232
- we will pass NO. You should clean up instead.
233
-
269
+ Invoked by the transport when it receives a response. The passed-in
270
+ callback will be invoked to actually process the response. If cancelled
271
+ we will pass NO. You should clean up instead.
272
+
234
273
  Invokes callbacks on the source request also.
235
-
274
+
236
275
  @param {Function} callback the function to receive
237
276
  @param {Object} context context to execute the callback in
238
277
  @returns {SC.Response} receiver
@@ -241,7 +280,7 @@ SC.Response = SC.Object.extend(
241
280
  if (!this.get('timedOut')) {
242
281
  // If we had a timeout timer scheduled, invalidate it now.
243
282
  var timer = this.get('timeoutTimer');
244
- if (timer) timer.invalidate();
283
+ if (timer) { timer.invalidate(); }
245
284
  this.set('timedOut', NO);
246
285
  }
247
286
 
@@ -251,7 +290,7 @@ SC.Response = SC.Object.extend(
251
290
  SC.run(function() {
252
291
  // invoke the source, giving a chance to fixup the response or (more
253
292
  // likely) cancel the request.
254
- if (source && source.willReceive) source.willReceive(req, this);
293
+ if (source && source.willReceive) { source.willReceive(req, this); }
255
294
 
256
295
  // invoke the callback. note if the response was cancelled or not
257
296
  callback.call(context, !this.get('isCancelled'));
@@ -264,16 +303,16 @@ SC.Response = SC.Object.extend(
264
303
  }
265
304
 
266
305
  // notify listeners if we weren't cancelled.
267
- if (!this.get('isCancelled')) this.notify();
306
+ if (!this.get('isCancelled')) { this.notify(); }
268
307
  }, this);
269
308
 
270
309
  // no matter what, remove from inflight queue
271
- SC.Request.manager.transportDidClose(this) ;
310
+ SC.Request.manager.transportDidClose(this);
272
311
  return this;
273
312
  },
274
-
313
+
275
314
  /**
276
- Default method just closes the connection. It will also mark the request
315
+ Default method just closes the connection. It will also mark the request
277
316
  as cancelled, which will not call any listeners.
278
317
  */
279
318
  cancel: function() {
@@ -283,9 +322,11 @@ SC.Response = SC.Object.extend(
283
322
  SC.Request.manager.transportDidClose(this) ;
284
323
  }
285
324
  },
286
-
325
+
287
326
  /**
288
327
  Default method just closes the connection.
328
+
329
+ @returns {Boolean} YES if this response has not timed out yet, NO otherwise
289
330
  */
290
331
  timeoutReached: function() {
291
332
  // If we already received a response yet the timer still fired for some
@@ -298,7 +339,7 @@ SC.Response = SC.Object.extend(
298
339
  // any. In the event of a timeout, we set the status to 0 since we
299
340
  // didn't actually get a response from the server.
300
341
  this.receive(function(proceed) {
301
- if (!proceed) return;
342
+ if (!proceed) { return; }
302
343
 
303
344
  // Set our value to an error.
304
345
  var error = SC.$error("HTTP Request timed out", "Request", 0) ;
@@ -313,67 +354,82 @@ SC.Response = SC.Object.extend(
313
354
 
314
355
  return NO;
315
356
  },
316
-
357
+
317
358
  /**
318
359
  Override with concrete implementation to actually cancel the transport.
319
360
  */
320
361
  cancelTransport: function() {},
321
-
322
- /** @private
323
- Will notify each listener.
362
+
363
+ /**
364
+ @private
365
+
366
+ Will notify each listener. Returns true if any of the listeners handle.
324
367
  */
325
- _notifyListener: function(listeners, status) {
326
- var info = listeners[status], params, target, action;
327
- if (!info) return NO ;
328
-
329
- params = (info.params || []).copy();
330
- params.unshift(this);
331
-
332
- target = info.target;
333
- action = info.action;
334
- if (SC.typeOf(action) === SC.T_STRING) action = target[action];
335
-
336
- return action.apply(target, params);
368
+ _notifyListeners: function(listeners, status) {
369
+ var notifiers = listeners[status], params, target, action;
370
+ if (!notifiers) { return NO; }
371
+
372
+ var handled = NO;
373
+ var len = notifiers.length;
374
+
375
+ for (var i = 0; i < len; i++) {
376
+ var notifier = notifiers[i];
377
+ params = (notifier.params || []).copy();
378
+ params.unshift(this);
379
+
380
+ target = notifier.target;
381
+ action = notifier.action;
382
+ if (SC.typeOf(action) === SC.T_STRING) { action = target[action]; }
383
+
384
+ handled = action.apply(target, params);
385
+ }
386
+
387
+ return handled;
337
388
  },
338
-
389
+
339
390
  /**
340
- Notifies any saved target/action. Call whenever you cancel, or end.
341
-
391
+ Notifies any saved target/action. Call whenever you cancel, or end.
392
+
342
393
  @returns {SC.Response} receiver
343
394
  */
344
395
  notify: function() {
345
- var listeners = this.get('listeners'),
346
- status = this.get('status'),
347
- baseStat = Math.floor(status / 100) * 100,
348
- handled = NO ;
349
-
350
- if (!listeners) return this ; // nothing to do
351
-
352
- handled = this._notifyListener(listeners, status);
353
- if (!handled) handled = this._notifyListener(listeners, baseStat);
354
- if (!handled) handled = this._notifyListener(listeners, 0);
396
+ var listeners = this.get('listeners'),
397
+ status = this.get('status'),
398
+ baseStat = Math.floor(status / 100) * 100,
399
+ handled = NO;
400
+
401
+ if (!listeners) { return this; }
402
+
403
+ handled = this._notifyListeners(listeners, status);
404
+ if (!handled && baseStat !== status) { handled = this._notifyListeners(listeners, baseStat); }
405
+ if (!handled && status !== 0) { handled = this._notifyListeners(listeners, 0); }
355
406
 
356
407
  return this ;
357
408
  },
358
409
 
359
410
  /**
360
411
  String representation of the response object
412
+
413
+ @returns {String}
361
414
  */
362
415
  toString: function() {
363
416
  var ret = sc_super();
364
417
  return "%@<%@ %@, status=%@".fmt(ret, this.get('type'), this.get('address'), this.get('status'));
365
418
  }
366
-
419
+
367
420
  });
368
421
 
369
422
  /**
370
- Concrete implementation of SC.Response that implements support for using
423
+ @class
424
+
425
+ Concrete implementation of SC.Response that implements support for using
371
426
  XHR requests.
372
-
427
+
373
428
  @extends SC.Response
374
429
  @since SproutCore 1.0
375
430
  */
376
- SC.XHRResponse = SC.Response.extend({
431
+ SC.XHRResponse = SC.Response.extend(
432
+ /** @scope SC.XHRResponse.prototype */{
377
433
 
378
434
  /**
379
435
  Implement transport-specific support for fetching all headers
@@ -382,77 +438,94 @@ SC.XHRResponse = SC.Response.extend({
382
438
  var xhr = this.get('rawRequest'),
383
439
  str = xhr ? xhr.getAllResponseHeaders() : null,
384
440
  ret = {};
385
-
386
- if (!str) return ret;
387
-
441
+
442
+ if (!str) { return ret; }
443
+
388
444
  str.split("\n").forEach(function(header) {
389
445
  var idx = header.indexOf(':'),
390
446
  key, value;
391
- if (idx>=0) {
447
+
448
+ if (idx >= 0) {
392
449
  key = header.slice(0,idx);
393
- value = header.slice(idx+1).trim();
394
- ret[key] = value ;
450
+ value = header.slice(idx + 1).trim();
451
+ ret[key] = value;
395
452
  }
396
453
  }, this);
397
-
398
- return ret ;
454
+
455
+ return ret;
399
456
  }.property('status').cacheable(),
400
-
401
- // returns a header value if found...
457
+
458
+ /**
459
+ Returns a header value if found.
460
+
461
+ @param {String} key The header key
462
+ @returns {String}
463
+ */
402
464
  header: function(key) {
403
465
  var xhr = this.get('rawRequest');
404
- return xhr ? xhr.getResponseHeader(key) : null;
466
+ return xhr ? xhr.getResponseHeader(key) : null;
405
467
  },
406
-
468
+
407
469
  /**
408
470
  Implement transport-specific support for fetching tasks
471
+
472
+ @field
473
+ @type String
474
+ @default #rawRequest
409
475
  */
410
476
  encodedBody: function() {
411
- var xhr = this.get('rawRequest'), ret ;
412
- if (!xhr) ret = null;
413
- else if (this.get('isXML')) ret = xhr.responseXML;
414
- else ret = xhr.responseText;
415
- return ret ;
477
+ var xhr = this.get('rawRequest');
478
+
479
+ if (!xhr) { return null; }
480
+ if (this.get('isXML')) { return xhr.responseXML; }
481
+
482
+ return xhr.responseText;
416
483
  }.property('status').cacheable(),
417
-
418
484
 
485
+ /**
486
+ Cancels the request.
487
+ */
419
488
  cancelTransport: function() {
420
489
  var rawRequest = this.get('rawRequest');
421
- if (rawRequest) rawRequest.abort();
490
+ if (rawRequest) { rawRequest.abort(); }
422
491
  this.set('rawRequest', null);
423
492
  },
424
493
 
494
+ /**
495
+ Starts the transport of the request
496
+
497
+ @returns {XMLHttpRequest|ActiveXObject}
498
+ */
425
499
  invokeTransport: function() {
426
500
  var rawRequest, transport, handleReadyStateChange, async, headers;
427
-
428
- rawRequest = this.createRequest();
429
501
 
430
- // save it
502
+ rawRequest = this.createRequest();
431
503
  this.set('rawRequest', rawRequest);
432
-
504
+
433
505
  // configure async callback - differs per browser...
434
- async = !!this.getPath('request.isAsynchronous') ;
506
+ async = !!this.getPath('request.isAsynchronous');
507
+
435
508
  if (async) {
436
- if (!SC.browser.msie && !SC.browser.opera ) {
437
- SC.Event.add(rawRequest, 'readystatechange', this,
438
- this.finishRequest, rawRequest) ;
509
+ if (!SC.browser.msie && !SC.browser.opera) {
510
+ SC.Event.add(rawRequest, 'readystatechange', this,
511
+ this.finishRequest, rawRequest);
439
512
  } else {
440
- transport=this;
513
+ transport = this;
441
514
  handleReadyStateChange = function() {
442
- if (!transport) return null ;
515
+ if (!transport) { return null; }
443
516
  var ret = transport.finishRequest();
444
- if (ret) transport = null ; // cleanup memory
445
- return ret ;
517
+ if (ret) { transport = null; }
518
+ return ret;
446
519
  };
447
520
  rawRequest.onreadystatechange = handleReadyStateChange;
448
521
  }
449
522
  }
450
-
451
- // initiate request.
452
- rawRequest.open(this.get('type'), this.get('address'), async ) ;
453
-
523
+
524
+ // initiate request.
525
+ rawRequest.open(this.get('type'), this.get('address'), async);
526
+
454
527
  // headers need to be set *after* the open call.
455
- headers = this.getPath('request.headers') ;
528
+ headers = this.getPath('request.headers');
456
529
  for (var headerKey in headers) {
457
530
  rawRequest.setRequestHeader(headerKey, headers[headerKey]) ;
458
531
  }
@@ -460,11 +533,11 @@ SC.XHRResponse = SC.Response.extend({
460
533
  // now send the actual request body - for sync requests browser will
461
534
  // block here
462
535
  rawRequest.send(this.getPath('request.encodedBody')) ;
463
- if (!async) this.finishRequest() ; // not async
464
-
465
- return rawRequest ;
536
+ if (!async) { this.finishRequest(); }
537
+
538
+ return rawRequest;
466
539
  },
467
-
540
+
468
541
  /**
469
542
  Creates the correct XMLHttpRequest object for this browser.
470
543
 
@@ -474,12 +547,11 @@ SC.XHRResponse = SC.Response.extend({
474
547
  @returns {XMLHttpRequest|ActiveXObject}
475
548
  */
476
549
  createRequest: function() {
477
- // Get an XHR object
478
550
  function tryThese() {
479
551
  for (var i=0; i < arguments.length; i++) {
480
552
  try {
481
- var item = arguments[i]() ;
482
- return item ;
553
+ var item = arguments[i]();
554
+ return item;
483
555
  } catch (e) {}
484
556
  }
485
557
  return NO;
@@ -492,12 +564,13 @@ SC.XHRResponse = SC.Response.extend({
492
564
  );
493
565
  },
494
566
 
495
- /** @private
496
-
567
+ /**
568
+ @private
569
+
497
570
  Called by the XHR when it responds with some final results.
498
-
571
+
499
572
  @param {XMLHttpRequest} rawRequest the actual request
500
- @returns {SC.XHRRequestTransport} receiver
573
+ @returns {Boolean} YES if completed, NO otherwise
501
574
  */
502
575
  finishRequest: function(evt) {
503
576
  var rawRequest = this.get('rawRequest'),
@@ -506,24 +579,24 @@ SC.XHRResponse = SC.Response.extend({
506
579
 
507
580
  if (readyState === 4 && !this.get('timedOut')) {
508
581
  this.receive(function(proceed) {
509
- if (!proceed) return ; // skip receiving...
510
-
582
+ if (!proceed) { return; }
583
+
511
584
  // collect the status and decide if we're in an error state or not
512
- status = -1 ;
585
+ status = -1;
513
586
  try {
514
587
  status = rawRequest.status || 0;
515
588
  } catch (e) {}
516
589
 
517
590
  // if there was an error - setup error and save it
518
591
  if ((status < 200) || (status >= 300)) {
519
-
592
+
520
593
  try {
521
594
  msg = rawRequest.statusText || '';
522
595
  } catch(e2) {
523
596
  msg = '';
524
597
  }
525
-
526
- error = SC.$error(msg || "HTTP Request failed", "Request", status) ;
598
+
599
+ error = SC.$error(msg || "HTTP Request failed", "Request", status);
527
600
  error.set("errorValue", this) ;
528
601
  this.set('isError', YES);
529
602
  this.set('errorObject', error);
@@ -531,20 +604,18 @@ SC.XHRResponse = SC.Response.extend({
531
604
 
532
605
  // set the status - this will trigger changes on relatedp properties
533
606
  this.set('status', status);
534
-
535
607
  }, this);
536
608
 
537
609
  // Avoid memory leaks
538
610
  if (!SC.browser.msie && !SC.browser.opera) {
539
- SC.Event.remove(rawRequest, 'readystatechange', this, this.finishRequest);
611
+ SC.Event.remove(rawRequest, 'readystatechange', this, this.finishRequest);
540
612
  } else {
541
613
  rawRequest.onreadystatechange = null;
542
614
  }
543
615
 
544
616
  return YES;
545
617
  }
546
- return NO;
618
+ return NO;
547
619
  }
548
620
 
549
-
550
621
  });