sproutit-sproutcore 1.0.20090721145236 → 1.0.20090721145251

Sign up to get free protection for your applications and to get access to all the features.
Files changed (933) hide show
  1. data/Rakefile +189 -54
  2. data/VERSION.yml +5 -0
  3. data/frameworks/sproutcore/Buildfile +64 -0
  4. data/frameworks/sproutcore/HISTORY +682 -0
  5. data/frameworks/sproutcore/README +23 -0
  6. data/frameworks/sproutcore/apps/docs/core.js +27 -0
  7. data/frameworks/sproutcore/apps/docs/english.lproj/loading.rhtml +9 -0
  8. data/frameworks/sproutcore/apps/docs/english.lproj/main_page.js +22 -0
  9. data/frameworks/sproutcore/apps/docs/english.lproj/strings.js +15 -0
  10. data/frameworks/sproutcore/apps/docs/main.js +30 -0
  11. data/frameworks/sproutcore/apps/tests/controllers/detail.js +16 -0
  12. data/frameworks/sproutcore/apps/tests/controllers/source.js +29 -0
  13. data/frameworks/sproutcore/apps/tests/controllers/target.js +26 -0
  14. data/frameworks/sproutcore/apps/tests/controllers/targets.js +86 -0
  15. data/frameworks/sproutcore/apps/tests/controllers/tests.js +33 -0
  16. data/frameworks/sproutcore/apps/tests/core.js +133 -0
  17. data/frameworks/sproutcore/apps/tests/data_source.js +96 -0
  18. data/frameworks/sproutcore/apps/tests/english.lproj/loading.rhtml +9 -0
  19. data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +39 -0
  20. data/frameworks/sproutcore/apps/tests/english.lproj/main_page.js +232 -0
  21. data/frameworks/sproutcore/apps/tests/english.lproj/strings.js +26 -0
  22. data/frameworks/sproutcore/apps/tests/fixtures/target.js +87 -0
  23. data/frameworks/sproutcore/apps/tests/fixtures/test.js +44 -0
  24. data/frameworks/sproutcore/apps/tests/main.js +28 -0
  25. data/frameworks/sproutcore/apps/tests/models/target.js +92 -0
  26. data/frameworks/sproutcore/apps/tests/models/test.js +48 -0
  27. data/frameworks/sproutcore/apps/tests/states/no_targets.js +26 -0
  28. data/frameworks/sproutcore/apps/tests/states/ready.js +56 -0
  29. data/frameworks/sproutcore/apps/tests/states/ready_detail.js +41 -0
  30. data/frameworks/sproutcore/apps/tests/states/ready_empty.js +48 -0
  31. data/frameworks/sproutcore/apps/tests/states/ready_list.js +41 -0
  32. data/frameworks/sproutcore/apps/tests/states/ready_loading.js +44 -0
  33. data/frameworks/sproutcore/apps/tests/states/ready_no_tests.js +31 -0
  34. data/frameworks/sproutcore/apps/tests/states/start.js +39 -0
  35. data/frameworks/sproutcore/apps/tests/tests/controllers/detail.js +15 -0
  36. data/frameworks/sproutcore/apps/tests/tests/controllers/source.js +15 -0
  37. data/frameworks/sproutcore/apps/tests/tests/controllers/target.js +15 -0
  38. data/frameworks/sproutcore/apps/tests/tests/controllers/targets.js +15 -0
  39. data/frameworks/sproutcore/apps/tests/tests/controllers/tests.js +15 -0
  40. data/frameworks/sproutcore/apps/tests/tests/models/target.js +15 -0
  41. data/frameworks/sproutcore/apps/tests/tests/models/test.js +15 -0
  42. data/frameworks/sproutcore/apps/tests/tests/views/offset_checkbox.js +15 -0
  43. data/frameworks/sproutcore/apps/tests/views/offset_checkbox.js +26 -0
  44. data/frameworks/sproutcore/apps/welcome/core.js +23 -0
  45. data/frameworks/sproutcore/apps/welcome/english.lproj/loading.rhtml +8 -0
  46. data/frameworks/sproutcore/apps/welcome/english.lproj/main_page.js +43 -0
  47. data/frameworks/sproutcore/apps/welcome/english.lproj/strings.js +15 -0
  48. data/frameworks/sproutcore/apps/welcome/main.js +36 -0
  49. data/frameworks/sproutcore/design/Record State Table.numbers +0 -0
  50. data/frameworks/sproutcore/frameworks/datastore/core.js +14 -0
  51. data/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +113 -0
  52. data/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +273 -0
  53. data/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +311 -0
  54. data/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures_with_queries.js +238 -0
  55. data/frameworks/sproutcore/frameworks/datastore/debug/json.js +71 -0
  56. data/frameworks/sproutcore/frameworks/datastore/debug/standard_setup.js +96 -0
  57. data/frameworks/sproutcore/frameworks/datastore/fixtures/author_fixtures.js +2503 -0
  58. data/frameworks/sproutcore/frameworks/datastore/fixtures/sample.js +17 -0
  59. data/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +92 -0
  60. data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +54 -0
  61. data/frameworks/sproutcore/frameworks/datastore/models/record.js +561 -0
  62. data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +423 -0
  63. data/frameworks/sproutcore/frameworks/datastore/system/many_array.js +158 -0
  64. data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +488 -0
  65. data/frameworks/sproutcore/frameworks/datastore/system/query.js +979 -0
  66. data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +287 -0
  67. data/frameworks/sproutcore/frameworks/datastore/system/store.js +2007 -0
  68. data/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +121 -0
  69. data/frameworks/sproutcore/frameworks/datastore/tests/integration/contact_model.js +114 -0
  70. data/frameworks/sproutcore/frameworks/datastore/tests/integration/mail_model.js +91 -0
  71. data/frameworks/sproutcore/frameworks/datastore/tests/integration/test_runner_model.js +56 -0
  72. data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +94 -0
  73. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +30 -0
  74. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/destroy.js +73 -0
  75. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +238 -0
  76. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/readAttribute.js +48 -0
  77. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js +42 -0
  78. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/storeDidChangeProperties.js +138 -0
  79. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +46 -0
  80. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +71 -0
  81. data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +204 -0
  82. data/frameworks/sproutcore/frameworks/datastore/tests/system/many_array/core_methods.js +178 -0
  83. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +40 -0
  84. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChanges.js +117 -0
  85. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +135 -0
  86. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/dataHashDidChange.js +110 -0
  87. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/discardChanges.js +99 -0
  88. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readDataHash.js +180 -0
  89. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readEditableDataHash.js +126 -0
  90. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/removeDataHash.js +163 -0
  91. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +166 -0
  92. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/compare_records.js +126 -0
  93. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +165 -0
  94. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation_of_records.js +82 -0
  95. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/find_all.js +362 -0
  96. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/parsing.js +170 -0
  97. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js +43 -0
  98. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_comparisons.js +60 -0
  99. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_query_extensions.js +67 -0
  100. data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +164 -0
  101. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js +54 -0
  102. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +126 -0
  103. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +126 -0
  104. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +73 -0
  105. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +72 -0
  106. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +78 -0
  107. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +249 -0
  108. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +106 -0
  109. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +21 -0
  110. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushChanges.js +61 -0
  111. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/readDataHash.js +74 -0
  112. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/readEditableDataHash.js +74 -0
  113. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +74 -0
  114. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/removeDataHash.js +144 -0
  115. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/retrieveRecord.js +137 -0
  116. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/writeDataHash.js +130 -0
  117. data/frameworks/sproutcore/frameworks/debug/core.js +61 -0
  118. data/frameworks/sproutcore/frameworks/deprecated/core.js +59 -0
  119. data/frameworks/sproutcore/frameworks/deprecated/lib/button_views.rb +330 -0
  120. data/frameworks/sproutcore/frameworks/deprecated/lib/collection_view.rb +83 -0
  121. data/frameworks/sproutcore/frameworks/deprecated/lib/core_views.rb +326 -0
  122. data/frameworks/sproutcore/frameworks/deprecated/lib/form_views.rb +253 -0
  123. data/frameworks/sproutcore/frameworks/deprecated/lib/index.rhtml +75 -0
  124. data/frameworks/sproutcore/frameworks/deprecated/lib/menu_views.rb +93 -0
  125. data/frameworks/sproutcore/frameworks/deprecated/server/rails_server.js +80 -0
  126. data/frameworks/sproutcore/frameworks/deprecated/server/rest_server.js +178 -0
  127. data/frameworks/sproutcore/frameworks/deprecated/server/server.js +673 -0
  128. data/frameworks/sproutcore/frameworks/deprecated/system/animator.js +679 -0
  129. data/frameworks/sproutcore/frameworks/deprecated/system/binding.js +36 -0
  130. data/frameworks/sproutcore/frameworks/deprecated/system/browser.js +75 -0
  131. data/frameworks/sproutcore/frameworks/deprecated/system/classic_responder.js +312 -0
  132. data/frameworks/sproutcore/frameworks/deprecated/system/event.js +58 -0
  133. data/frameworks/sproutcore/frameworks/deprecated/system/globals.js +20 -0
  134. data/frameworks/sproutcore/frameworks/deprecated/system/misc.js +58 -0
  135. data/frameworks/sproutcore/frameworks/deprecated/system/node_descriptor.js +72 -0
  136. data/frameworks/sproutcore/frameworks/deprecated/system/object.js +122 -0
  137. data/frameworks/sproutcore/frameworks/deprecated/system/path_module.js +432 -0
  138. data/frameworks/sproutcore/frameworks/deprecated/system/string.js +107 -0
  139. data/frameworks/sproutcore/frameworks/deprecated/tests/application/application.rhtml +125 -0
  140. data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/clippingFrame.rhtml +401 -0
  141. data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/frame.rhtml +357 -0
  142. data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/isVisibleInWindow.rhtml +147 -0
  143. data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/base.rhtml +298 -0
  144. data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/incremental_rendering.rhtml +260 -0
  145. data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/source_list_rendering.rhtml +143 -0
  146. data/frameworks/sproutcore/frameworks/deprecated/tests/views/popup_button.rhtml +128 -0
  147. data/frameworks/sproutcore/frameworks/deprecated/tests/views/text_field.rhtml +37 -0
  148. data/frameworks/sproutcore/frameworks/deprecated/views/collection.js +24 -0
  149. data/frameworks/sproutcore/frameworks/designer/coders/design.js +29 -0
  150. data/frameworks/sproutcore/frameworks/designer/coders/localization.js +27 -0
  151. data/frameworks/sproutcore/frameworks/designer/coders/object.js +347 -0
  152. data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +102 -0
  153. data/frameworks/sproutcore/frameworks/designer/css/css_rule.js +22 -0
  154. data/frameworks/sproutcore/frameworks/designer/css/css_style.js +29 -0
  155. data/frameworks/sproutcore/frameworks/designer/css/css_style_sheet.js +201 -0
  156. data/frameworks/sproutcore/frameworks/designer/ext/page.js +86 -0
  157. data/frameworks/sproutcore/frameworks/designer/ext/view.js +38 -0
  158. data/frameworks/sproutcore/frameworks/designer/views/controls/button.js +17 -0
  159. data/frameworks/sproutcore/frameworks/designer/views/designer.js +569 -0
  160. data/frameworks/sproutcore/frameworks/designer/views/label.js +16 -0
  161. data/frameworks/sproutcore/frameworks/designer/views/mixins/button.js +11 -0
  162. data/frameworks/sproutcore/frameworks/designer/views/tab.js +16 -0
  163. data/frameworks/sproutcore/frameworks/desktop/core.js +6 -0
  164. data/frameworks/sproutcore/frameworks/desktop/debug/drag.js +41 -0
  165. data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +56 -0
  166. data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/a_sample_image.jpg +0 -0
  167. data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/apple-logo1.jpeg +0 -0
  168. data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/iframe.html +23 -0
  169. data/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +71 -0
  170. data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +6 -0
  171. data/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +943 -0
  172. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_222222.png +0 -0
  173. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_454545.png +0 -0
  174. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_888888.png +0 -0
  175. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_ffffff.png +0 -0
  176. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
  177. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
  178. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/panels/sprite-x.png +0 -0
  179. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/panels/sprite-y.png +0 -0
  180. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
  181. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/000000.png +0 -0
  182. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/ffffff.png +0 -0
  183. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
  184. data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +209 -0
  185. data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +100 -0
  186. data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +5 -0
  187. data/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +95 -0
  188. data/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +39 -0
  189. data/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +31 -0
  190. data/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +10 -0
  191. data/frameworks/sproutcore/frameworks/desktop/english.lproj/scroller.css +26 -0
  192. data/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +141 -0
  193. data/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +19 -0
  194. data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +62 -0
  195. data/frameworks/sproutcore/frameworks/desktop/english.lproj/split.css +70 -0
  196. data/frameworks/sproutcore/frameworks/desktop/english.lproj/split_divider.css +9 -0
  197. data/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +14 -0
  198. data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +12 -0
  199. data/frameworks/sproutcore/frameworks/desktop/english.lproj/toolbar.css +6 -0
  200. data/frameworks/sproutcore/frameworks/desktop/mixins/border.js +53 -0
  201. data/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +22 -0
  202. data/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +61 -0
  203. data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +283 -0
  204. data/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +247 -0
  205. data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +408 -0
  206. data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +651 -0
  207. data/frameworks/sproutcore/frameworks/desktop/panes/modal.js +68 -0
  208. data/frameworks/sproutcore/frameworks/desktop/panes/palette.js +63 -0
  209. data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +184 -0
  210. data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +400 -0
  211. data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +46 -0
  212. data/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +39 -0
  213. data/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +81 -0
  214. data/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +175 -0
  215. data/frameworks/sproutcore/frameworks/desktop/protocols/responder.js +280 -0
  216. data/frameworks/sproutcore/frameworks/desktop/system/drag.js +827 -0
  217. data/frameworks/sproutcore/frameworks/desktop/system/key_bindings.js +40 -0
  218. data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +641 -0
  219. data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +187 -0
  220. data/frameworks/sproutcore/frameworks/desktop/tests/integration/dialog.js +43 -0
  221. data/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/methods.js +10 -0
  222. data/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +152 -0
  223. data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +55 -0
  224. data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +59 -0
  225. data/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/methods.js +10 -0
  226. data/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/ui.js +35 -0
  227. data/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +10 -0
  228. data/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +40 -0
  229. data/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +10 -0
  230. data/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +84 -0
  231. data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/methods.js +10 -0
  232. data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +38 -0
  233. data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +45 -0
  234. data/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +159 -0
  235. data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +144 -0
  236. data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +99 -0
  237. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/content.js +249 -0
  238. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +82 -0
  239. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +199 -0
  240. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +288 -0
  241. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/layerIdFor.js +65 -0
  242. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/length.js +88 -0
  243. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +165 -0
  244. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/nowShowing.js +121 -0
  245. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/reload.js +177 -0
  246. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +240 -0
  247. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +191 -0
  248. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +197 -0
  249. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selection.js +141 -0
  250. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/ui_diagram.js +182 -0
  251. data/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/methods.js +10 -0
  252. data/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +64 -0
  253. data/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +10 -0
  254. data/frameworks/sproutcore/frameworks/desktop/tests/views/grid/ui.js +10 -0
  255. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowDelegate.js +183 -0
  256. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +133 -0
  257. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowOffsetForContentIndex.js +132 -0
  258. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_outline.js +56 -0
  259. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +167 -0
  260. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_simple.js +127 -0
  261. data/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +284 -0
  262. data/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/methods.js +10 -0
  263. data/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js +44 -0
  264. data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/methods.js +128 -0
  265. data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +240 -0
  266. data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +113 -0
  267. data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +202 -0
  268. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +139 -0
  269. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +111 -0
  270. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +102 -0
  271. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/ui.js +70 -0
  272. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +95 -0
  273. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +222 -0
  274. data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +81 -0
  275. data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +100 -0
  276. data/frameworks/sproutcore/frameworks/desktop/tests/views/separator.js +37 -0
  277. data/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/methods.js +10 -0
  278. data/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/ui.js +10 -0
  279. data/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +50 -0
  280. data/frameworks/sproutcore/frameworks/desktop/tests/views/split/ui.js +52 -0
  281. data/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +231 -0
  282. data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +54 -0
  283. data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +88 -0
  284. data/frameworks/sproutcore/frameworks/desktop/tests/views/web/methods.js +10 -0
  285. data/frameworks/sproutcore/frameworks/desktop/tests/views/web/ui.js +110 -0
  286. data/frameworks/sproutcore/frameworks/desktop/views/button.js +331 -0
  287. data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +105 -0
  288. data/frameworks/sproutcore/frameworks/desktop/views/collection.js +2757 -0
  289. data/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +44 -0
  290. data/frameworks/sproutcore/frameworks/desktop/views/form.js +594 -0
  291. data/frameworks/sproutcore/frameworks/desktop/views/grid.js +201 -0
  292. data/frameworks/sproutcore/frameworks/desktop/views/list.js +540 -0
  293. data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +660 -0
  294. data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +587 -0
  295. data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +68 -0
  296. data/frameworks/sproutcore/frameworks/desktop/views/progress.js +207 -0
  297. data/frameworks/sproutcore/frameworks/desktop/views/radio.js +332 -0
  298. data/frameworks/sproutcore/frameworks/desktop/views/scene.js +204 -0
  299. data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +690 -0
  300. data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +226 -0
  301. data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +525 -0
  302. data/frameworks/sproutcore/frameworks/desktop/views/select_field.js +331 -0
  303. data/frameworks/sproutcore/frameworks/desktop/views/separator.js +37 -0
  304. data/frameworks/sproutcore/frameworks/desktop/views/slider.js +180 -0
  305. data/frameworks/sproutcore/frameworks/desktop/views/source_list.js +47 -0
  306. data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +169 -0
  307. data/frameworks/sproutcore/frameworks/desktop/views/split.js +677 -0
  308. data/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +55 -0
  309. data/frameworks/sproutcore/frameworks/desktop/views/stacked.js +101 -0
  310. data/frameworks/sproutcore/frameworks/desktop/views/tab.js +191 -0
  311. data/frameworks/sproutcore/frameworks/desktop/views/thumb.js +49 -0
  312. data/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +49 -0
  313. data/frameworks/sproutcore/frameworks/desktop/views/web.js +86 -0
  314. data/frameworks/sproutcore/frameworks/foundation/TESTING +46 -0
  315. data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +509 -0
  316. data/frameworks/sproutcore/frameworks/foundation/controllers/controller.js +45 -0
  317. data/frameworks/sproutcore/frameworks/foundation/controllers/object.js +323 -0
  318. data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +109 -0
  319. data/frameworks/sproutcore/frameworks/foundation/core.js +136 -0
  320. data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +194 -0
  321. data/frameworks/sproutcore/frameworks/foundation/english.lproj/blank.gif +0 -0
  322. data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +68 -0
  323. data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +55 -0
  324. data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +221 -0
  325. data/frameworks/sproutcore/frameworks/foundation/english.lproj/debug/control-test-pane.css +9 -0
  326. data/frameworks/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-logo.png +0 -0
  327. data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +30 -0
  328. data/frameworks/sproutcore/frameworks/foundation/english.lproj/static_layout.css +5 -0
  329. data/frameworks/sproutcore/frameworks/foundation/english.lproj/strings.js +15 -0
  330. data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +45 -0
  331. data/frameworks/sproutcore/frameworks/foundation/english.lproj/view.css +45 -0
  332. data/frameworks/sproutcore/frameworks/foundation/ext/object.js +81 -0
  333. data/frameworks/sproutcore/frameworks/foundation/ext/run_loop.js +158 -0
  334. data/frameworks/sproutcore/frameworks/foundation/fixtures/file_exists.json +1 -0
  335. data/frameworks/sproutcore/frameworks/foundation/license.js +19 -0
  336. data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +299 -0
  337. data/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +171 -0
  338. data/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +88 -0
  339. data/frameworks/sproutcore/frameworks/foundation/mixins/control.js +352 -0
  340. data/frameworks/sproutcore/frameworks/foundation/mixins/editable.js +146 -0
  341. data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +462 -0
  342. data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +232 -0
  343. data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +132 -0
  344. data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +251 -0
  345. data/frameworks/sproutcore/frameworks/foundation/mixins/tree_item_content.js +159 -0
  346. data/frameworks/sproutcore/frameworks/foundation/mixins/validatable.js +176 -0
  347. data/frameworks/sproutcore/frameworks/foundation/panes/main.js +47 -0
  348. data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +584 -0
  349. data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +887 -0
  350. data/frameworks/sproutcore/frameworks/foundation/protocols/inline_editor_delegate.js +84 -0
  351. data/frameworks/sproutcore/frameworks/foundation/system/application.js +36 -0
  352. data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +492 -0
  353. data/frameworks/sproutcore/frameworks/foundation/system/browser.js +64 -0
  354. data/frameworks/sproutcore/frameworks/foundation/system/builder.js +210 -0
  355. data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +2015 -0
  356. data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +129 -0
  357. data/frameworks/sproutcore/frameworks/foundation/system/datetime.js +729 -0
  358. data/frameworks/sproutcore/frameworks/foundation/system/error.js +93 -0
  359. data/frameworks/sproutcore/frameworks/foundation/system/event.js +853 -0
  360. data/frameworks/sproutcore/frameworks/foundation/system/image_cache.js +433 -0
  361. data/frameworks/sproutcore/frameworks/foundation/system/json.js +440 -0
  362. data/frameworks/sproutcore/frameworks/foundation/system/locale.js +288 -0
  363. data/frameworks/sproutcore/frameworks/foundation/system/page.js +106 -0
  364. data/frameworks/sproutcore/frameworks/foundation/system/ready.js +195 -0
  365. data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +904 -0
  366. data/frameworks/sproutcore/frameworks/foundation/system/request.js +380 -0
  367. data/frameworks/sproutcore/frameworks/foundation/system/responder.js +120 -0
  368. data/frameworks/sproutcore/frameworks/foundation/system/responder_context.js +243 -0
  369. data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +391 -0
  370. data/frameworks/sproutcore/frameworks/foundation/system/routes.js +487 -0
  371. data/frameworks/sproutcore/frameworks/foundation/system/time.js +478 -0
  372. data/frameworks/sproutcore/frameworks/foundation/system/timer.js +549 -0
  373. data/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +165 -0
  374. data/frameworks/sproutcore/frameworks/foundation/system/utils.js +425 -0
  375. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +182 -0
  376. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +193 -0
  377. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +64 -0
  378. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/single_case.js +136 -0
  379. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/empty_case.js +82 -0
  380. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/multiple_case.js +111 -0
  381. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/single_case.js +193 -0
  382. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/single_enumerable_case.js +179 -0
  383. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/tree/outline_case.js +108 -0
  384. data/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/methods.js +10 -0
  385. data/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/ui.js +113 -0
  386. data/frameworks/sproutcore/frameworks/foundation/tests/integration/creating_views.js +113 -0
  387. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/content.js +195 -0
  388. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/displayProperties.js +89 -0
  389. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/keyEquivalents.js +35 -0
  390. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/content.js +168 -0
  391. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/displayProperties.js +89 -0
  392. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +128 -0
  393. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +17 -0
  394. data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/flat_case.js +325 -0
  395. data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +718 -0
  396. data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/outline_case.js +484 -0
  397. data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +42 -0
  398. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +1323 -0
  399. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_dimensions.js +387 -0
  400. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_selector.js +405 -0
  401. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js +49 -0
  402. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/within.js +66 -0
  403. data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +151 -0
  404. data/frameworks/sproutcore/frameworks/foundation/tests/system/error.js +41 -0
  405. data/frameworks/sproutcore/frameworks/foundation/tests/system/json.js +14 -0
  406. data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +128 -0
  407. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js +47 -0
  408. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js +44 -0
  409. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/end.js +119 -0
  410. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/get.js +51 -0
  411. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js +50 -0
  412. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_basic.js +28 -0
  413. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_className.js +179 -0
  414. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_style.js +100 -0
  415. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/init.js +55 -0
  416. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/join.js +28 -0
  417. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/push_text.js +74 -0
  418. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +45 -0
  419. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/update.js +205 -0
  420. data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +127 -0
  421. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeKeyPane.js +124 -0
  422. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeMainPane.js +68 -0
  423. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/root_responder.js +101 -0
  424. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +238 -0
  425. data/frameworks/sproutcore/frameworks/foundation/tests/system/routes.js +33 -0
  426. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js +38 -0
  427. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invokeLater.js +201 -0
  428. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +71 -0
  429. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +67 -0
  430. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/schedule.js +170 -0
  431. data/frameworks/sproutcore/frameworks/foundation/tests/system/user_defaults.js +27 -0
  432. data/frameworks/sproutcore/frameworks/foundation/tests/system/utils/normalizeURL.js +18 -0
  433. data/frameworks/sproutcore/frameworks/foundation/tests/system/utils/range.js +62 -0
  434. data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +35 -0
  435. data/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js +23 -0
  436. data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +47 -0
  437. data/frameworks/sproutcore/frameworks/foundation/tests/validators/password.js +13 -0
  438. data/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +10 -0
  439. data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +83 -0
  440. data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +39 -0
  441. data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +148 -0
  442. data/frameworks/sproutcore/frameworks/foundation/tests/views/main_pane.js +31 -0
  443. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +89 -0
  444. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/firstResponder.js +148 -0
  445. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/keyPane.js +133 -0
  446. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/sendEvent.js +165 -0
  447. data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +76 -0
  448. data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +250 -0
  449. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +133 -0
  450. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/convertFrames.js +246 -0
  451. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/createChildViews.js +122 -0
  452. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/createLayer.js +97 -0
  453. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +85 -0
  454. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +52 -0
  455. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/init.js +50 -0
  456. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +200 -0
  457. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js +51 -0
  458. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisibleInWindow.js +113 -0
  459. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layer.js +150 -0
  460. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutChildViews.js +162 -0
  461. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutDidChange.js +127 -0
  462. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +328 -0
  463. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/parentViewDidChange.js +67 -0
  464. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/prepareContext.js +166 -0
  465. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/removeChild.js +189 -0
  466. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/render.js +83 -0
  467. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/replaceChild.js +29 -0
  468. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayer.js +146 -0
  469. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayerLocation.js +194 -0
  470. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/viewDidResize.js +185 -0
  471. data/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +125 -0
  472. data/frameworks/sproutcore/frameworks/foundation/validators/date.js +52 -0
  473. data/frameworks/sproutcore/frameworks/foundation/validators/email.js +45 -0
  474. data/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js +33 -0
  475. data/frameworks/sproutcore/frameworks/foundation/validators/number.js +82 -0
  476. data/frameworks/sproutcore/frameworks/foundation/validators/password.js +86 -0
  477. data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +311 -0
  478. data/frameworks/sproutcore/frameworks/foundation/views/container.js +136 -0
  479. data/frameworks/sproutcore/frameworks/foundation/views/field.js +287 -0
  480. data/frameworks/sproutcore/frameworks/foundation/views/image.js +161 -0
  481. data/frameworks/sproutcore/frameworks/foundation/views/label.js +271 -0
  482. data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +257 -0
  483. data/frameworks/sproutcore/frameworks/foundation/views/view.js +2405 -0
  484. data/frameworks/sproutcore/frameworks/mobile/english.lproj/core.css +12 -0
  485. data/frameworks/sproutcore/frameworks/mobile/lib/index.rhtml +126 -0
  486. data/frameworks/sproutcore/frameworks/mobile/system/root_responder.js +109 -0
  487. data/frameworks/sproutcore/frameworks/mobile/tests/views/button/ui.js +9 -0
  488. data/frameworks/sproutcore/frameworks/mobile/views/button.js +190 -0
  489. data/frameworks/sproutcore/frameworks/runtime/README +12 -0
  490. data/frameworks/sproutcore/frameworks/runtime/core.js +856 -0
  491. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +238 -0
  492. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js +33 -0
  493. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/insertAt.js +121 -0
  494. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/objectAt.js +34 -0
  495. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js +50 -0
  496. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js +46 -0
  497. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/rangeObserver.js +371 -0
  498. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeAt.js +100 -0
  499. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js +49 -0
  500. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +94 -0
  501. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js +50 -0
  502. data/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js +47 -0
  503. data/frameworks/sproutcore/frameworks/runtime/license.js +28 -0
  504. data/frameworks/sproutcore/frameworks/runtime/mixins/array.js +613 -0
  505. data/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +64 -0
  506. data/frameworks/sproutcore/frameworks/runtime/mixins/delegate_support.js +108 -0
  507. data/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1258 -0
  508. data/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +104 -0
  509. data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1305 -0
  510. data/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +141 -0
  511. data/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +148 -0
  512. data/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +152 -0
  513. data/frameworks/sproutcore/frameworks/runtime/protocols/observable_protocol.js +40 -0
  514. data/frameworks/sproutcore/frameworks/runtime/protocols/sparse_array_delegate.js +131 -0
  515. data/frameworks/sproutcore/frameworks/runtime/system/binding.js +915 -0
  516. data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +107 -0
  517. data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +1166 -0
  518. data/frameworks/sproutcore/frameworks/runtime/system/object.js +801 -0
  519. data/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +265 -0
  520. data/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +241 -0
  521. data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +649 -0
  522. data/frameworks/sproutcore/frameworks/runtime/system/set.js +375 -0
  523. data/frameworks/sproutcore/frameworks/runtime/system/sparse_array.js +295 -0
  524. data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +56 -0
  525. data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +23 -0
  526. data/frameworks/sproutcore/frameworks/runtime/tests/core/clone.js +66 -0
  527. data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +44 -0
  528. data/frameworks/sproutcore/frameworks/runtime/tests/core/console.js +16 -0
  529. data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +147 -0
  530. data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +25 -0
  531. data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +38 -0
  532. data/frameworks/sproutcore/frameworks/runtime/tests/core/keys.js +20 -0
  533. data/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +30 -0
  534. data/frameworks/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +19 -0
  535. data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +37 -0
  536. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +57 -0
  537. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable.js +611 -0
  538. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +587 -0
  539. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +132 -0
  540. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +79 -0
  541. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +80 -0
  542. data/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue/isObservingSuspended.js +55 -0
  543. data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +265 -0
  544. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +195 -0
  545. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/clone.js +43 -0
  546. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/contains.js +74 -0
  547. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/create.js +42 -0
  548. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js +38 -0
  549. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js +38 -0
  550. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/intersects.js +74 -0
  551. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js +40 -0
  552. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js +40 -0
  553. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js +36 -0
  554. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +189 -0
  555. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/without.js +89 -0
  556. data/frameworks/sproutcore/frameworks/runtime/tests/system/object/base.js +135 -0
  557. data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +339 -0
  558. data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +59 -0
  559. data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/destroy.js +75 -0
  560. data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/objectPropertyDidChange.js +117 -0
  561. data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/rangeDidChange.js +110 -0
  562. data/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/update.js +65 -0
  563. data/frameworks/sproutcore/frameworks/runtime/tests/system/run_loop.js +120 -0
  564. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/add.js +92 -0
  565. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +17 -0
  566. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +85 -0
  567. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/isEqual.js +60 -0
  568. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +87 -0
  569. data/frameworks/sproutcore/frameworks/runtime/tests/system/set.js +292 -0
  570. data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +122 -0
  571. data/frameworks/sproutcore/frameworks/testing/core.js +196 -0
  572. data/frameworks/sproutcore/frameworks/testing/english.lproj/additions.css +8 -0
  573. data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +126 -0
  574. data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +131 -0
  575. data/frameworks/sproutcore/frameworks/testing/extras.js +17 -0
  576. data/frameworks/sproutcore/frameworks/testing/jquery.js +3559 -0
  577. data/frameworks/sproutcore/frameworks/testing/qunit.js +827 -0
  578. data/frameworks/sproutcore/frameworks/testing/system/dump.js +205 -0
  579. data/frameworks/sproutcore/frameworks/testing/system/equiv.js +201 -0
  580. data/frameworks/sproutcore/frameworks/testing/system/plan.js +691 -0
  581. data/frameworks/sproutcore/frameworks/testing/system/runner.js +209 -0
  582. data/frameworks/sproutcore/frameworks/testing/system/suite.js +228 -0
  583. data/frameworks/sproutcore/frameworks/testing/utils.js +62 -0
  584. data/frameworks/sproutcore/lib/index.rhtml +121 -0
  585. data/frameworks/sproutcore/license.js +28 -0
  586. data/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +69 -0
  587. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/button.css +41 -0
  588. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/core.css +8 -0
  589. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/backButton.png +0 -0
  590. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/blueButton.png +0 -0
  591. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/cancel.png +0 -0
  592. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/grayButton.png +0 -0
  593. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/leftButton.png +0 -0
  594. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrow.png +0 -0
  595. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrowSel.png +0 -0
  596. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listGroup.png +0 -0
  597. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/loading.gif +0 -0
  598. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/pinstripes.png +0 -0
  599. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/rightButton.png +0 -0
  600. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/selection.png +0 -0
  601. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/thumb.png +0 -0
  602. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggle.png +0 -0
  603. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggleOn.png +0 -0
  604. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolButton.png +0 -0
  605. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolbar.png +0 -0
  606. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/whiteButton.png +0 -0
  607. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/strings.js +15 -0
  608. data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +331 -0
  609. data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +91 -0
  610. data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +134 -0
  611. data/frameworks/sproutcore/themes/standard_theme/english.lproj/core.css +60 -0
  612. data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +55 -0
  613. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
  614. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
  615. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-ysprite.png +0 -0
  616. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-toolbar-view.png +0 -0
  617. data/frameworks/sproutcore/themes/standard_theme/english.lproj/label.css +11 -0
  618. data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +30 -0
  619. data/frameworks/sproutcore/themes/standard_theme/english.lproj/pane.css +8 -0
  620. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-fat.jpg +0 -0
  621. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-thin.jpg +0 -0
  622. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-edge.png +0 -0
  623. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-left-corner.png +0 -0
  624. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-right-corner.png +0 -0
  625. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/left-edge.png +0 -0
  626. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/overlay.png +0 -0
  627. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/right-edge.png +0 -0
  628. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-edge.png +0 -0
  629. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-left-corner.png +0 -0
  630. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-right-corner.png +0 -0
  631. data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +26 -0
  632. data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +122 -0
  633. data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +279 -0
  634. data/frameworks/sproutcore/themes/standard_theme/english.lproj/slider.css +94 -0
  635. data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +27 -0
  636. data/frameworks/sproutcore/themes/standard_theme/english.lproj/tab.css +18 -0
  637. data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +10 -0
  638. data/frameworks/sproutcore/themes/standard_theme/english.lproj/toolbar.css +7 -0
  639. data/lib/sproutcore.rb +9 -1
  640. data/lib/sproutcore/tools/build.rb +1 -1
  641. data/lib/thor/CHANGELOG.rdoc +52 -0
  642. data/lib/thor/LICENSE +20 -0
  643. data/lib/thor/README.markdown +76 -0
  644. data/lib/thor/Rakefile +6 -0
  645. data/lib/thor/Thorfile +45 -0
  646. data/lib/thor/bin/rake2thor +83 -0
  647. data/lib/thor/bin/thor +7 -0
  648. data/lib/thor/lib/thor.rb +170 -0
  649. data/lib/thor/lib/thor/error.rb +3 -0
  650. data/lib/thor/lib/thor/options.rb +267 -0
  651. data/lib/thor/lib/thor/ordered_hash.rb +64 -0
  652. data/lib/thor/lib/thor/runner.rb +305 -0
  653. data/lib/thor/lib/thor/task.rb +83 -0
  654. data/lib/thor/lib/thor/task_hash.rb +22 -0
  655. data/lib/thor/lib/thor/tasks.rb +77 -0
  656. data/lib/thor/lib/thor/tasks/package.rb +18 -0
  657. data/lib/thor/lib/thor/util.rb +75 -0
  658. data/lib/thor/script/destroy +14 -0
  659. data/lib/thor/script/generate +14 -0
  660. data/lib/thor/task.thor +15 -0
  661. metadata +664 -351
  662. data/VERSION +0 -1
  663. data/spec/buildtasks/build/copy_spec.rb +0 -60
  664. data/spec/buildtasks/build/spec_helper.rb +0 -36
  665. data/spec/buildtasks/manifest/catalog_spec.rb +0 -48
  666. data/spec/buildtasks/manifest/hide_buildfiles_spec.rb +0 -125
  667. data/spec/buildtasks/manifest/localize_spec.rb +0 -97
  668. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +0 -246
  669. data/spec/buildtasks/manifest/prepare_build_tasks/css_spec.rb +0 -87
  670. data/spec/buildtasks/manifest/prepare_build_tasks/html_spec.rb +0 -175
  671. data/spec/buildtasks/manifest/prepare_build_tasks/javascript_spec.rb +0 -65
  672. data/spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb +0 -70
  673. data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +0 -152
  674. data/spec/buildtasks/manifest/prepare_build_tasks/sass_spec.rb +0 -98
  675. data/spec/buildtasks/manifest/prepare_build_tasks/strings_spec.rb +0 -64
  676. data/spec/buildtasks/manifest/prepare_build_tasks/tests_spec.rb +0 -163
  677. data/spec/buildtasks/manifest/prepare_spec.rb +0 -43
  678. data/spec/buildtasks/manifest/spec_helper.rb +0 -35
  679. data/spec/buildtasks/target_spec.rb +0 -214
  680. data/spec/fixtures/builder_tests/Buildfile +0 -15
  681. data/spec/fixtures/builder_tests/apps/combine_test/a.js +0 -1
  682. data/spec/fixtures/builder_tests/apps/combine_test/b.js +0 -1
  683. data/spec/fixtures/builder_tests/apps/combine_test/c.js +0 -1
  684. data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/a.css +0 -1
  685. data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/b.css +0 -1
  686. data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/c.css +0 -1
  687. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/bar1_sample.rhtml +0 -2
  688. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/erb_sample.html.erb +0 -1
  689. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/icons/image.png +0 -0
  690. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/image.jpg +0 -0
  691. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/rhtml_sample.rhtml +0 -1
  692. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/strings.js +0 -4
  693. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/style.css +0 -0
  694. data/spec/fixtures/builder_tests/apps/html_test/french.lproj/french-icons/fr.png +0 -0
  695. data/spec/fixtures/builder_tests/apps/html_test/french.lproj/strings.js +0 -4
  696. data/spec/fixtures/builder_tests/apps/html_test/lib/layout_template.rhtml +0 -1
  697. data/spec/fixtures/builder_tests/apps/html_test/scripts.js +0 -0
  698. data/spec/fixtures/builder_tests/apps/javascript_test/sc_static.js +0 -15
  699. data/spec/fixtures/builder_tests/apps/javascript_test/sc_super.js +0 -4
  700. data/spec/fixtures/builder_tests/apps/javascript_test/strings.js +0 -7
  701. data/spec/fixtures/builder_tests/apps/sass_test/sample.sass +0 -3
  702. data/spec/fixtures/builder_tests/apps/strings_test/lproj/strings.js +0 -8
  703. data/spec/fixtures/builder_tests/apps/stylesheet_test/build_directives.css +0 -9
  704. data/spec/fixtures/builder_tests/apps/stylesheet_test/sc_static.css +0 -12
  705. data/spec/fixtures/builder_tests/apps/test_test/lib/alt_layout.rhtml +0 -1
  706. data/spec/fixtures/builder_tests/apps/test_test/lib/test_layout.rhtml +0 -3
  707. data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test.js +0 -1
  708. data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test2.js +0 -1
  709. data/spec/fixtures/builder_tests/apps/test_test/tests/rhtml_test.rhtml +0 -4
  710. data/spec/fixtures/builder_tests/frameworks/debug/core.js +0 -0
  711. data/spec/fixtures/builder_tests/frameworks/debug/english.lproj/dummy.css +0 -0
  712. data/spec/fixtures/builder_tests/frameworks/qunit/core.js +0 -0
  713. data/spec/fixtures/builder_tests/frameworks/qunit/english.lproj/dummy.css +0 -0
  714. data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/req_style_1.css +0 -0
  715. data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/strings.js +0 -4
  716. data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/test.rhtml +0 -1
  717. data/spec/fixtures/builder_tests/frameworks/req_target_1/req_js_1.js +0 -0
  718. data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/req_style_2.css +0 -0
  719. data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/test.rhtml +0 -1
  720. data/spec/fixtures/builder_tests/frameworks/req_target_2/javascript.js +0 -1
  721. data/spec/fixtures/builder_tests/frameworks/req_target_2/lib/alt_layout.rhtml +0 -0
  722. data/spec/fixtures/builder_tests/frameworks/req_target_2/req_js_2.js +0 -0
  723. data/spec/fixtures/builder_tests/themes/sample_theme/Buildfile +0 -1
  724. data/spec/fixtures/buildfiles/basic/Buildfile +0 -16
  725. data/spec/fixtures/buildfiles/basic/task_module.rake +0 -6
  726. data/spec/fixtures/buildfiles/installed/Buildfile +0 -7
  727. data/spec/fixtures/buildfiles/installed/Buildfile2 +0 -5
  728. data/spec/fixtures/buildfiles/project_test/Buildfile +0 -4
  729. data/spec/fixtures/buildfiles/project_test/not_project/Buildfile +0 -2
  730. data/spec/fixtures/buildfiles/project_test/not_project/child/PLACEHOLDER +0 -0
  731. data/spec/fixtures/entry_for_project/Buildfile +0 -1
  732. data/spec/fixtures/entry_for_project/apps/test_app/entry.txt +0 -0
  733. data/spec/fixtures/entry_for_project/apps/test_app/frameworks/nested/PLACEHOLDER +0 -0
  734. data/spec/fixtures/entry_for_project/frameworks/shared/PLACEHOLDER +0 -0
  735. data/spec/fixtures/find_targets/custom/Buildfile +0 -8
  736. data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar1/PLACEHOLDER +0 -0
  737. data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar2/PLACEHOLDER +0 -0
  738. data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo1/PLACEHOLDER +0 -0
  739. data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo2/PLACEHOLDER +0 -0
  740. data/spec/fixtures/find_targets/custom/foos/custom_foos/Buildfile +0 -5
  741. data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo1/PLACEHOLDER +0 -0
  742. data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo2/PLACEHOLDER +0 -0
  743. data/spec/fixtures/find_targets/custom/foos/custom_foos/foos/not_foo1/PLACEHOLDER +0 -0
  744. data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar1/PLACEHOLDER +0 -0
  745. data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar2/PLACEHOLDER +0 -0
  746. data/spec/fixtures/find_targets/nested/Buildfile +0 -8
  747. data/spec/fixtures/find_targets/nested/apps/app1/Buildfile +0 -1
  748. data/spec/fixtures/find_targets/nested/apps/app1/apps/nested_app/PLACEHOLDER +0 -0
  749. data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework1/PLACEHOLDER +0 -0
  750. data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework2/PLACEHOLDER +0 -0
  751. data/spec/fixtures/find_targets/standard/clients/client1/PLACEHOLDER +0 -0
  752. data/spec/fixtures/find_targets/standard/frameworks/framework1/frameworks/framework1/PLACEHOLDER +0 -0
  753. data/spec/fixtures/find_targets/standard/frameworks/framework2/PLACEHOLDER +0 -0
  754. data/spec/fixtures/find_targets/standard/themes/theme1/PLACEHOLDER +0 -0
  755. data/spec/fixtures/find_targets/standard/themes/theme2/PLACEHOLDER +0 -0
  756. data/spec/fixtures/languages/apps/caps_long_names/English.lproj/PLACEHOLDER +0 -0
  757. data/spec/fixtures/languages/apps/caps_long_names/FreNCH.lproj/PLACEHOLDER +0 -0
  758. data/spec/fixtures/languages/apps/caps_long_names/UnknOWN.lproj/PLACEHOLDER +0 -0
  759. data/spec/fixtures/languages/apps/long_names/english.lproj/PLACEHOLDER +0 -0
  760. data/spec/fixtures/languages/apps/long_names/french.lproj/PLACEHOLDER +0 -0
  761. data/spec/fixtures/languages/apps/long_names/german.lproj/PLACEHOLDER +0 -0
  762. data/spec/fixtures/languages/apps/long_names/italian.lproj/PLACEHOLDER +0 -0
  763. data/spec/fixtures/languages/apps/long_names/japanese.lproj/PLACEHOLDER +0 -0
  764. data/spec/fixtures/languages/apps/long_names/spanish.lproj/PLACEHOLDER +0 -0
  765. data/spec/fixtures/languages/apps/long_names/unknown.lproj/PLACEHOLDER +0 -0
  766. data/spec/fixtures/languages/apps/no_names/PLACEHOLDER +0 -0
  767. data/spec/fixtures/languages/apps/short_names/de.lproj/PLACEHOLDER +0 -0
  768. data/spec/fixtures/languages/apps/short_names/en-CA.lproj/PLACEHOLDER +0 -0
  769. data/spec/fixtures/languages/apps/short_names/en-GB.lproj/PLACEHOLDER +0 -0
  770. data/spec/fixtures/languages/apps/short_names/en-US.lproj/PLACEHOLDER +0 -0
  771. data/spec/fixtures/languages/apps/short_names/en.lproj/PLACEHOLDER +0 -0
  772. data/spec/fixtures/languages/apps/short_names/es.lproj/PLACEHOLDER +0 -0
  773. data/spec/fixtures/languages/apps/short_names/foo.lproj/PLACEHOLDER +0 -0
  774. data/spec/fixtures/languages/apps/short_names/fr.lproj/PLACEHOLDER +0 -0
  775. data/spec/fixtures/languages/apps/short_names/it.lproj/PLACEHOLDER +0 -0
  776. data/spec/fixtures/languages/apps/short_names/ja.lproj/PLACEHOLDER +0 -0
  777. data/spec/fixtures/ordered_entries/apps/no_requires/1.js +0 -1
  778. data/spec/fixtures/ordered_entries/apps/no_requires/B.js +0 -1
  779. data/spec/fixtures/ordered_entries/apps/no_requires/a.js +0 -1
  780. data/spec/fixtures/ordered_entries/apps/no_requires/a/a.js +0 -1
  781. data/spec/fixtures/ordered_entries/apps/no_requires/a/b.js +0 -1
  782. data/spec/fixtures/ordered_entries/apps/no_requires/b/a.js +0 -1
  783. data/spec/fixtures/ordered_entries/apps/no_requires/c.js +0 -1
  784. data/spec/fixtures/ordered_entries/apps/no_requires/core.js +0 -1
  785. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/B.css +0 -0
  786. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a.css +0 -0
  787. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/a.css +0 -0
  788. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/b.css +0 -0
  789. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/b/a.css +0 -0
  790. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/c.css +0 -0
  791. data/spec/fixtures/ordered_entries/apps/no_requires/lproj/strings.js +0 -1
  792. data/spec/fixtures/ordered_entries/apps/no_requires/utils.js +0 -1
  793. data/spec/fixtures/ordered_entries/apps/with_requires/a.js +0 -2
  794. data/spec/fixtures/ordered_entries/apps/with_requires/b.js +0 -3
  795. data/spec/fixtures/ordered_entries/apps/with_requires/c.js +0 -2
  796. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/a.css +0 -2
  797. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/b.css +0 -2
  798. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/c.css +0 -2
  799. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/d.js +0 -1
  800. data/spec/fixtures/real_world/Buildfile +0 -12
  801. data/spec/fixtures/real_world/apps/account/README +0 -1
  802. data/spec/fixtures/real_world/apps/calendar/README +0 -1
  803. data/spec/fixtures/real_world/apps/contacts/README_BEFORE_EDITING +0 -1
  804. data/spec/fixtures/real_world/apps/files/README +0 -1
  805. data/spec/fixtures/real_world/apps/mail/README +0 -1
  806. data/spec/fixtures/real_world/apps/mobile_photos/README +0 -1
  807. data/spec/fixtures/real_world/apps/photos/README +0 -1
  808. data/spec/fixtures/real_world/apps/uploader/README +0 -1
  809. data/spec/fixtures/real_world/frameworks/core_files/PLACEHOLDER +0 -0
  810. data/spec/fixtures/real_world/frameworks/core_photos/PLACEHOLDER +0 -0
  811. data/spec/fixtures/real_world/frameworks/shared/PLACEHOLDER +0 -0
  812. data/spec/fixtures/real_world/frameworks/sproutcore/Buildfile +0 -26
  813. data/spec/fixtures/real_world/frameworks/sproutcore/README +0 -1
  814. data/spec/fixtures/real_world/frameworks/sproutcore/apps/docs/PLACEHOLDER +0 -0
  815. data/spec/fixtures/real_world/frameworks/sproutcore/apps/test_runner/PLACEHOLDER +0 -0
  816. data/spec/fixtures/real_world/frameworks/sproutcore/core.js +0 -0
  817. data/spec/fixtures/real_world/frameworks/sproutcore/debug/debug-resource.html +0 -0
  818. data/spec/fixtures/real_world/frameworks/sproutcore/debug/sample_debug.js +0 -0
  819. data/spec/fixtures/real_world/frameworks/sproutcore/demo2.js +0 -0
  820. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/debug/sample_debug-loc.js +0 -0
  821. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.css +0 -4
  822. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.html +0 -1
  823. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo2.sass +0 -0
  824. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.haml +0 -0
  825. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.html.erb +0 -1
  826. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.rhtml +0 -0
  827. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/fixtures/sample_fixtures-loc.js +0 -0
  828. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/has_require.css +0 -4
  829. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_require.css +0 -1
  830. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_sc_resource.rhtml +0 -1
  831. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/protocols/sample-loc.js +0 -0
  832. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.css +0 -6
  833. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.rhtml +0 -3
  834. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/strings.js +0 -1
  835. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/tests/sample-loc.js +0 -0
  836. data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample-json-fixture.json +0 -1
  837. data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample_fixtures.js +0 -0
  838. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/application/PLACEHOLDER +0 -0
  839. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/costello/core.js +0 -0
  840. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/data_store/PLACEHOLDER +0 -0
  841. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/debug/PLACEHOLDER +0 -0
  842. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/desktop/PLACEHOLDER +0 -0
  843. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/empty_theme/PLACEHOLDER +0 -0
  844. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/foundation/PLACEHOLDER +0 -0
  845. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/mobile/PLACEHOLDER +0 -0
  846. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/qunit/PLACEHOLDER +0 -0
  847. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/uploader/PLACEHOLDER +0 -0
  848. data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/french-resource.js +0 -0
  849. data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/strings.js +0 -1
  850. data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/german-resource.js +0 -0
  851. data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/strings.js +0 -0
  852. data/spec/fixtures/real_world/frameworks/sproutcore/has_require.js +0 -4
  853. data/spec/fixtures/real_world/frameworks/sproutcore/lib/index.html +0 -1
  854. data/spec/fixtures/real_world/frameworks/sproutcore/no_require.js +0 -1
  855. data/spec/fixtures/real_world/frameworks/sproutcore/protocols/sample.js +0 -0
  856. data/spec/fixtures/real_world/frameworks/sproutcore/sc_resource.js +0 -6
  857. data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample1.js +0 -0
  858. data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample2.js +0 -0
  859. data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.js +0 -0
  860. data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.rhtml +0 -1
  861. data/spec/fixtures/real_world/frameworks/sproutcore/themes/standard_theme/README +0 -0
  862. data/spec/fixtures/real_world/frameworks/sproutcore/views/view.js +0 -1
  863. data/spec/fixtures/real_world/generators/sample_custom/Buildfile +0 -0
  864. data/spec/fixtures/recursive_project/Buildfile +0 -8
  865. data/spec/fixtures/recursive_project/frameworks/sproutcore/frameworks/costello/PLACEHOLDER +0 -0
  866. data/spec/lib/builders/combine_spec.rb +0 -67
  867. data/spec/lib/builders/html_spec.rb +0 -577
  868. data/spec/lib/builders/javascript_spec.rb +0 -81
  869. data/spec/lib/builders/sass_spec.rb +0 -43
  870. data/spec/lib/builders/spec_helper.rb +0 -30
  871. data/spec/lib/builders/strings_spec.rb +0 -52
  872. data/spec/lib/builders/stylesheet_spec.rb +0 -63
  873. data/spec/lib/builders/test_index_spec.rb +0 -44
  874. data/spec/lib/builders/test_spec.rb +0 -135
  875. data/spec/lib/buildfile/config_for_spec.rb +0 -81
  876. data/spec/lib/buildfile/define_spec.rb +0 -59
  877. data/spec/lib/buildfile/dup_spec.rb +0 -65
  878. data/spec/lib/buildfile/invoke_spec.rb +0 -130
  879. data/spec/lib/buildfile/load_spec.rb +0 -49
  880. data/spec/lib/buildfile/task/dup_spec.rb +0 -55
  881. data/spec/lib/buildfile/task_defined_spec.rb +0 -17
  882. data/spec/lib/buildfile_commands/build_task_spec.rb +0 -19
  883. data/spec/lib/buildfile_commands/config_spec.rb +0 -97
  884. data/spec/lib/buildfile_commands/import_spec.rb +0 -17
  885. data/spec/lib/buildfile_commands/namespace_spec.rb +0 -18
  886. data/spec/lib/buildfile_commands/proxies_spec.rb +0 -38
  887. data/spec/lib/buildfile_commands/replace_task_spec.rb +0 -29
  888. data/spec/lib/buildfile_commands/task_spec.rb +0 -36
  889. data/spec/lib/helpers/packing_optimizer/optimize_spec.rb +0 -26
  890. data/spec/lib/models/hash_struct/deep_clone_spec.rb +0 -27
  891. data/spec/lib/models/hash_struct/has_options_spec.rb +0 -32
  892. data/spec/lib/models/hash_struct/hash_spec.rb +0 -64
  893. data/spec/lib/models/hash_struct/merge_spec.rb +0 -26
  894. data/spec/lib/models/hash_struct/method_missing.rb +0 -41
  895. data/spec/lib/models/manifest/add_entry_spec.rb +0 -36
  896. data/spec/lib/models/manifest/add_transform_spec.rb +0 -90
  897. data/spec/lib/models/manifest/build_spec.rb +0 -78
  898. data/spec/lib/models/manifest/entry_for_spec.rb +0 -94
  899. data/spec/lib/models/manifest/find_entry.rb +0 -84
  900. data/spec/lib/models/manifest/prepare_spec.rb +0 -62
  901. data/spec/lib/models/manifest_entry/cacheable_url_spec.rb +0 -31
  902. data/spec/lib/models/manifest_entry/prepare_spec.rb +0 -54
  903. data/spec/lib/models/project/add_target_spec.rb +0 -44
  904. data/spec/lib/models/project/buildfile_spec.rb +0 -35
  905. data/spec/lib/models/project/find_targets_for_spec.rb +0 -77
  906. data/spec/lib/models/project/load_nearest_project_spec.rb +0 -23
  907. data/spec/lib/models/project/target_for_spec.rb +0 -33
  908. data/spec/lib/models/project/targets_spec.rb +0 -62
  909. data/spec/lib/models/target/compute_build_number_spec.rb +0 -125
  910. data/spec/lib/models/target/config_spec.rb +0 -30
  911. data/spec/lib/models/target/expand_required_targets_spec.rb +0 -48
  912. data/spec/lib/models/target/installed_languages_spec.rb +0 -47
  913. data/spec/lib/models/target/lproj_for_spec.rb +0 -38
  914. data/spec/lib/models/target/manifest_for_spec.rb +0 -42
  915. data/spec/lib/models/target/parent_target_spec.rb +0 -21
  916. data/spec/lib/models/target/prepare_spec.rb +0 -53
  917. data/spec/lib/models/target/required_targets_spec.rb +0 -119
  918. data/spec/lib/models/target/target_for_spec.rb +0 -56
  919. data/spec/lib/tools/build_number_spec.rb +0 -28
  920. data/spec/lib/tools/gen_spec.rb +0 -207
  921. data/spec/lib/tools/tools_spec.rb +0 -78
  922. data/spec/spec_helper.rb +0 -138
  923. data/sproutcore-abbot.gemspec +0 -640
  924. data/vendor/jsdoc/templates/jsdoc/allclasses.tmpl +0 -17
  925. data/vendor/jsdoc/templates/jsdoc/allfiles.tmpl +0 -56
  926. data/vendor/jsdoc/templates/jsdoc/class.tmpl +0 -487
  927. data/vendor/jsdoc/templates/jsdoc/index.tmpl +0 -38
  928. data/vendor/jsdoc/templates/jsdoc/symbol.tmpl +0 -35
  929. data/vendor/jsdoc/templates/sproutcore/allclasses.tmpl +0 -0
  930. data/vendor/jsdoc/templates/sproutcore/allfiles.tmpl +0 -56
  931. data/vendor/jsdoc/templates/sproutcore/class.tmpl +0 -674
  932. data/vendor/jsdoc/templates/sproutcore/index.tmpl +0 -55
  933. data/vendor/jsdoc/templates/sproutcore/symbol.tmpl +0 -35
@@ -0,0 +1,64 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
4
+ // Portions ©2008-2009 Apple, Inc. All rights reserved.
5
+ // License: Licened under MIT license (see license.js)
6
+ // ==========================================================================
7
+
8
+ /** Detects the current browser type. Borrowed from jQuery + prototype */
9
+ SC.browser = (function() {
10
+
11
+ var userAgent = navigator.userAgent.toLowerCase();
12
+ var version = (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1] ;
13
+
14
+ var browser = /** @scope SC.browser */ {
15
+
16
+ /** The current browser version */
17
+ version: version,
18
+
19
+ /** non-zero if webkit-based browser */
20
+ safari: (/webkit/).test( userAgent ) ? version : 0,
21
+
22
+ /** non-zero if this is an opera-based browser */
23
+ opera: (/opera/).test( userAgent ) ? version : 0,
24
+
25
+ /** non-zero if this is IE */
26
+ msie: (/msie/).test( userAgent ) && !(/opera/).test( userAgent ) ? version : 0,
27
+
28
+ /** non-zero if this is a miozilla based browser */
29
+ mozilla: (/mozilla/).test( userAgent ) && !(/(compatible|webkit)/).test( userAgent ) ? version : 0,
30
+
31
+ /** non-zero if this is mobile safari */
32
+ mobileSafari: (/apple.*mobile.*safari/).test(userAgent) ? version : 0,
33
+
34
+ /** non-zero if we are on windows */
35
+ windows: !!(/(windows)/).test(userAgent),
36
+
37
+ /** non-zero if we are on a mac */
38
+ mac: !!((/(macintosh)/).test(userAgent) || (/(mac os x)/).test(userAgent)),
39
+
40
+ language: ((navigator.language || navigator.browserLanguage).split('-', 1)[0])
41
+ };
42
+
43
+ // Add more SC-like descriptions...
44
+ SC.extend(browser, /** @scope SC.browser */ {
45
+
46
+ isOpera: !!browser.opera,
47
+ isIe: !!browser.msie,
48
+ isIE: !!browser.msie,
49
+ isSafari: !!browser.safari,
50
+ isMobileSafari: !!browser.mobileSafari,
51
+ isMozilla: !!browser.mozilla,
52
+ isWindows: !!browser.windows,
53
+ isMac: !!browser.mac,
54
+
55
+ /**
56
+ The current browser name. This is useful for switch statements. */
57
+ current: (browser.msie) ? 'msie' : (browser.mozilla) ? 'mozilla' : (browser.safari) ? 'safari' : (browser.opera) ? 'opera' : 'unknown'
58
+
59
+ }) ;
60
+
61
+ return browser ;
62
+
63
+ })();
64
+
@@ -0,0 +1,210 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
4
+ // Portions ©2008-2009 Apple, Inc. All rights reserved.
5
+ // License: Licened under MIT license (see license.js)
6
+ // ==========================================================================
7
+
8
+ /** @class
9
+
10
+ The Builder class makes it easy to create new chained-builder API's such as
11
+ those provided by CoreQuery or jQuery. Usually you will not create a new
12
+ builder yourself, but you will often use instances of the Builder object to
13
+ configure parts of the UI such as menus and views.
14
+
15
+ h1. Anatomy of a Builder
16
+
17
+ You can create a new Builder much like you would any other class in
18
+ SproutCore. For example, you could create a new CoreQuery-type object with
19
+ the following:
20
+
21
+ {{{
22
+ SC.$ = SC.Builder.create({
23
+ // methods you can call go here.
24
+ });
25
+ }}}
26
+
27
+ Unlike most classes in SproutCore, Builder objects are actually functions
28
+ that you can call to create new instances. In the example above, to use
29
+ the builder, you must call it like a function:
30
+
31
+ {{{
32
+ buildit = SC.$();
33
+ }}}
34
+
35
+ If you define an init() method on a builder, it will be invoked wheneve the
36
+ builder is called as a function, including any passed params. Your init()
37
+ method MUST return this, unlike regular SC objects. i.e.
38
+
39
+ {{{
40
+ SC.$ = SC.Builder.create({
41
+ init: function(args) {
42
+ this.args = SC.A(args);
43
+ return this;
44
+ }
45
+ });
46
+
47
+ buildit = SC.$('a', 'b');
48
+ buildit.args => ['a','b']
49
+ }}}
50
+
51
+ In addition to defining a function like this, all builder objects also have
52
+ an 'fn' property that contains a hash of all of the helper methods defined
53
+ on the builder function. Once a builder has been created, you can add
54
+ addition "plugins" for the builder by simply adding new methods to the
55
+ fn property.
56
+
57
+ h1. Writing Builder Functions
58
+
59
+ All builders share a few things in comming:
60
+
61
+ - when a new builder is created, it's init() method will be called. The default version of this method simply copies the passed parameters into the builder as content, but you can override this with anything you want.
62
+
63
+ - the content the builder works on is stored as indexed properties (i.e. 0,1,2,3, like an array). The builder should also have a length property if you want it treated like an array.
64
+
65
+ - Builders also maintain a stack of previous builder instances which you can pop off at any time.
66
+
67
+ To get content back out of a builder once you are ready with it, you can
68
+ call the method done(). This will return an array or a single object, if
69
+ the builder only works on a single item.
70
+
71
+ You should write your methods using the getEach() iterator to work on your
72
+ member objects. All builders implement SC.Enumerable in the fn() method.
73
+
74
+ CoreQuery = SC.Builder.create({
75
+ ...
76
+ }) ;
77
+
78
+ CoreQuery = new SC.Builder(properties) {
79
+
80
+ } ;
81
+
82
+ CoreQuery2 = CoreQuery.extend() {
83
+ }
84
+
85
+ @constructor
86
+ */
87
+ SC.Builder = function (props) { return SC.Builder.create(props); };
88
+
89
+ /**
90
+ Create a new builder object, applying the passed properties to the
91
+ builder's fn property hash.
92
+
93
+ @param {Hash} properties
94
+ @returns {SC.Builder}
95
+ */
96
+ SC.Builder.create = function create(props) {
97
+
98
+ // generate new fn with built-in properties and copy props
99
+ var fn = SC.mixin(SC.beget(this.fn), props||{}) ;
100
+ if (props.hasOwnProperty('toString')) fn.toString = props.toString;
101
+
102
+ // generate new constructor and hook in the fn
103
+ var construct = function() {
104
+ var ret = SC.beget(fn); // NOTE: using closure here...
105
+
106
+ // the defaultClass is usually this for this constructor.
107
+ // e.g. SC.View.build() -> this = SC.View
108
+ ret.defaultClass = this ;
109
+ ret.constructor = construct ;
110
+
111
+ // now init the builder object.
112
+ return ret.init.apply(ret, arguments) ;
113
+ } ;
114
+ construct.fn = construct.prototype = fn ;
115
+
116
+ // the create() method can be used to extend a new builder.
117
+ // eg. SC.View.buildCustom = SC.View.build.extend({ ...props... })
118
+ construct.extend = SC.Builder.create ;
119
+ construct.mixin = SC.Builder.mixin ;
120
+
121
+ return construct; // return new constructor
122
+ } ;
123
+
124
+ SC.Builder.mixin = function() {
125
+ var len = arguments.length, idx;
126
+ for(idx=0;idx<len;idx++) SC.mixin(this, arguments[idx]);
127
+ return this ;
128
+ };
129
+
130
+ /** This is the default set of helper methods defined for new builders. */
131
+ SC.Builder.fn = {
132
+
133
+ /**
134
+ Default init method for builders. This method accepts either a single
135
+ content object or an array of content objects and copies them onto the
136
+ receiver. You can override this to provide any kind of init behavior
137
+ that you want. Any parameters passed to the builder method will be
138
+ forwarded to your init method.
139
+
140
+ @returns {SC.Builder} receiver
141
+ */
142
+ init: function(content) {
143
+ if (content !== undefined) {
144
+ if (SC.typeOf(content) === SC.T_ARRAY) {
145
+ var loc=content.length;
146
+ while(--loc >= 0) {
147
+ this[loc] = content.objectAt ? content.objectAt(loc) : content[loc];
148
+ }
149
+ this.length = content.length ;
150
+ } else {
151
+ this[0] = content; this.length=1;
152
+ }
153
+ }
154
+ return this ;
155
+ },
156
+
157
+ /** Return the number of elements in the matched set. */
158
+ size: function() { return this.length; },
159
+
160
+ /**
161
+ Take an array of elements and push it onto the stack (making it the
162
+ new matched set.) The receiver will be saved so it can be popped later.
163
+
164
+ @param {Object|Array} content
165
+ @returns {SC.Builder} new isntance
166
+ */
167
+ pushStack: function() {
168
+ // Build a new CoreQuery matched element set
169
+ var ret = this.constructor.apply(this,arguments);
170
+
171
+ // Add the old object onto the stack (as a reference)
172
+ ret.prevObject = this;
173
+
174
+ // Return the newly-formed element set
175
+ return ret;
176
+ },
177
+
178
+ /**
179
+ Returns the previous object on the stack so you can continue with that
180
+ transform. If there is no previous item on the stack, an empty set will
181
+ be returned.
182
+ */
183
+ end: function() {
184
+ return this.prevObject || this.constructor();
185
+ },
186
+
187
+ // toString describes the builder
188
+ toString: function() {
189
+ return "%@$(%@)".fmt(this.defaultClass.toString(),
190
+ SC.A(this).invoke('toString').join(','));
191
+ },
192
+
193
+ /** You can enhance the fn using this mixin method. */
194
+ mixin: SC.Builder.mixin
195
+
196
+ };
197
+
198
+ // Apply SC.Enumerable. Whenever possible we want to use the Array version
199
+ // because it might be native code.
200
+ (function() {
201
+ var enumerable = SC.Enumerable, fn = SC.Builder.fn, key, value ;
202
+ for(key in enumerable) {
203
+ if (!enumerable.hasOwnProperty(key)) continue ;
204
+ value = Array.prototype[key] || enumerable[key];
205
+ fn[key] = value ;
206
+ }
207
+ })();
208
+
209
+
210
+
@@ -0,0 +1,2015 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
4
+ // Portions ©2008-2009 Apple, Inc. All rights reserved.
5
+ // License: Licened under MIT license (see license.js)
6
+ // ==========================================================================
7
+
8
+ require('system/builder') ;
9
+
10
+ /**
11
+ CoreQuery is a simplified DOM manipulation library used internally by
12
+ SproutCore to find and edit DOM elements. Outside of SproutCore, you
13
+ should generally use a more full-featured DOM library such as Prototype
14
+ or jQuery.
15
+
16
+ CoreQuery itself is a subset of jQuery with some additional plugins. If
17
+ you have jQuery already loaded when SproutCore loads, in fact, it will
18
+ replace CoreQuery with the full jQuery library and install any CoreQuery
19
+ plugins, including support for the SC.Enumerable mixin.
20
+
21
+ Much of this code is adapted from jQuery 1.2.6, which is available under an
22
+ MIT license just like SproutCore.
23
+
24
+ h1. Using CoreQuery
25
+
26
+ You can work with CoreQuery much like you would work with jQuery. The core
27
+ manipulation object is exposed as SC.$. To find some elements on the page
28
+ you just pass in a selector like this:
29
+
30
+ {{{
31
+ var cq = SC.$('p');
32
+ }}}
33
+
34
+ The object returned from this call is a CoreQuery object that implements
35
+ SC.Enumerable as well as a number of other useful manipulation methods.
36
+ Often times we call this object the "matched set", because it usually an
37
+ array of elements matching the selector key you passed.
38
+
39
+ To work with the matched set, just call the various helper methods on it.
40
+ Here are some of the more useful ones:
41
+
42
+ {{{
43
+ // change all of the text red
44
+ cq.css('color','red');
45
+
46
+ // hide/show the set
47
+ cq.hide(); cq.show();
48
+
49
+ // set the text content of the set
50
+ cq.text("Hello World!");
51
+
52
+ }}}
53
+
54
+ Of course, you can also chain these methods, just like jQuery. Here is
55
+ how you might find all of the headings in your page, change their text and
56
+ color:
57
+
58
+ {{{
59
+ SC.$('h1').text('Hello World!').css('color','red');
60
+ }}}
61
+
62
+ h1. Using CoreQuery with Views
63
+
64
+ Usually you will not want to just blindly edit the HTML content in your
65
+ application. Instead, you will use CoreQuery to update the portion of the
66
+ page managed by your SC.View instances. Every SC.View instance has a $()
67
+ property just like SC.$(). The difference is that this function will start
68
+ searching from the root of the view. For example, you could use the
69
+ following code in your updateDisplay method to set your content and color:
70
+
71
+ {{{
72
+ updateDisplay: function() {
73
+ this.$().text(this.get('value')).css('color','red');
74
+ }
75
+ }}}
76
+
77
+ You could also work on content within your view, for example this will
78
+ change the title on your view held in the span.title element:
79
+
80
+ {{{
81
+ updateDisplay: function() {
82
+ this.$('span.title').text('Hello World');
83
+ this.$().setClassName('sc-enabled', YES) ;
84
+ }
85
+ }}}
86
+
87
+ @class
88
+ @extends SC.Builder.fn
89
+ */
90
+ SC.CoreQuery = (function() {
91
+ // Define CoreQuery inside of its own scope to support some jQuery idioms.
92
+
93
+ // A simple way to check for HTML strings or ID strings
94
+ // (both of which we optimize for)
95
+ var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
96
+ // Is it a simple selector
97
+ isSimple = /^.[^:#\[\.]*$/,
98
+ undefined ;
99
+
100
+ var styleFloat = SC.browser.msie ? "styleFloat" : "cssFloat";
101
+
102
+ // used for the find() method.
103
+ var chars = (SC.browser.safari && parseInt(SC.browser.version,0) < 417) ?
104
+ "(?:[\\w*_-]|\\\\.)" :
105
+ "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)" ;
106
+ var quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)") ;
107
+ var singleClass = new RegExp("^([#.]?)(" + chars + "*)");
108
+ var quickSplit = new RegExp("([#.]?)(" + chars + "*)",'g');
109
+
110
+ // Constants used in CQ.css()
111
+ var LEFT_RIGHT = ["Left", "Right"];
112
+ var TOP_BOTTOM = ["Top", "Bottom"];
113
+ var CSS_DISPLAY_PROPS = {
114
+ position: "absolute", visibility: "hidden", display:"block"
115
+ } ;
116
+
117
+ var getWH = function getWH(elem, name, which) {
118
+ var val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
119
+ var padding = 0, border = 0, loc=which.length, dim;
120
+ while(--loc>=0) {
121
+ dim = which[loc];
122
+ padding += parseFloat(CQ.curCSS( elem, "padding" + dim, true)) || 0;
123
+ border += parseFloat(CQ.curCSS( elem, "border" + dim + "Width", true)) ||0;
124
+ }
125
+ val -= Math.round(padding + border);
126
+ return val;
127
+ } ;
128
+
129
+ var expando = SC.guidKey, uuid = 0, windowData = {},
130
+ // exclude the following css properties to add px
131
+ exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
132
+ // cache defaultView
133
+ defaultView = document.defaultView || {};
134
+
135
+ // A helper method for determining if an element's values are broken
136
+ var styleIsBorked = function styleIsBorked( elem ) {
137
+ if ( !SC.browser.safari ) return false;
138
+
139
+ // defaultView is cached
140
+ var ret = defaultView.getComputedStyle( elem, null );
141
+ return !ret || ret.getPropertyValue("color") == "";
142
+ } ;
143
+
144
+
145
+
146
+ // Helper function used by the dimensions and offset modules
147
+ function num(elem, prop) {
148
+ return elem[0] && parseInt( CQ.curCSS(elem[0], prop, true), 10 ) || 0;
149
+ } ;
150
+
151
+ var CoreQuery, CQ ;
152
+
153
+ // implement core methods here from jQuery that we want available all the
154
+ // time. Use this area to implement jQuery-compatible methods ONLY.
155
+ // New methods should be added at the bottom of the file, where they will
156
+ // be installed as plugins on CoreQuery or jQuery.
157
+ CQ = CoreQuery = SC.Builder.create( /** @scope SC.CoreQuery.fn */ {
158
+
159
+ /** Indicates that this is a jQuery-like object. */
160
+ jquery: 'SC.CoreQuery',
161
+
162
+ /**
163
+ Called on a new CoreQuery instance when it is first created. You
164
+ can pass a variety of options to the CoreQuery constructor function
165
+ including:
166
+
167
+ - a simple selector: this will find the element and return it
168
+ - element or array of elements - this will return a query with them
169
+ - html-string: this will convert to DOM.
170
+
171
+ @returns {CoreQuery} CoreQuery instance
172
+ */
173
+ init: function( selector, context ) {
174
+
175
+ // Make sure that a selection was provided
176
+ selector = selector || document;
177
+
178
+ // Handle $(DOMElement)
179
+ if ( selector.nodeType ) {
180
+ this[0] = selector;
181
+ this.length = 1;
182
+ return this ;
183
+
184
+ // Handle HTML strings
185
+ } else if ( typeof selector == "string" ) {
186
+ // Are we dealing with HTML string or an ID?
187
+ var match = quickExpr.exec( selector );
188
+
189
+ // Verify a match, and that no context was specified for #id
190
+ if ( match && (match[1] || !context) ) {
191
+
192
+ // HANDLE: $(html) -> $(array)
193
+ if ( match[1] )
194
+ selector = CQ.clean( [ match[1] ], context );
195
+
196
+ // HANDLE: $("#id")
197
+ else {
198
+ var elem = document.getElementById( match[3] );
199
+
200
+ // Make sure an element was located
201
+ if ( elem ){
202
+ // Handle the case where IE and Opera return items
203
+ // by name instead of ID
204
+ if ( elem.id != match[3] ) return CQ().find( selector );
205
+
206
+ // Otherwise, we inject the element directly into the jQuery object
207
+ return CQ( elem );
208
+ }
209
+ selector = [];
210
+ }
211
+
212
+ // HANDLE: $(expr, [context])
213
+ // (which is just equivalent to: $(content).find(expr)
214
+ } else return CQ( context ).find( selector );
215
+
216
+ // HANDLE: $(function)
217
+ // Shortcut for document ready
218
+ } else if (SC.typeOf(selector) === SC.T_FUNCTION) {
219
+ return SC.ready(selector);
220
+ }
221
+
222
+ return this.setArray(CQ.makeArray(selector));
223
+ },
224
+
225
+ /** Return the number of elements in the matched set. */
226
+ size: function() { return this.length; },
227
+
228
+ /** Return the nth element of the working array OR return a clean array
229
+ with the result set, if no number is passed.
230
+
231
+ @param {Number} num (Optional)
232
+ @returns {Object|Array}
233
+ */
234
+ get: function( num ) {
235
+ return num == undefined ? CQ.makeArray(this) : this[num];
236
+ },
237
+
238
+ /**
239
+ Find subelements matching the passed selector. Note that CoreQuery
240
+ supports only a very simplified selector search method. See
241
+ CoreQuery.find() for more information.
242
+
243
+ @param {String} selector
244
+ @returns {CoreQuery} new instance with match
245
+ */
246
+ find: function( selector ) {
247
+ var elems = CQ.map(this, function(elem){
248
+ return CQ.find( selector, elem );
249
+ });
250
+
251
+ return this.pushStack(elems);
252
+ },
253
+
254
+ /**
255
+ Filters the matching set to include only those matching the passed
256
+ selector. Note that CoreQuery supports only a simplified selector
257
+ search method. See CoreQuery.find() for more information.
258
+
259
+ Also note that CoreQuery implements SC.Enumerable, which means you can
260
+ also call this method with a callback and target and the callback will
261
+ be executed on every element in the matching set to return a result.
262
+
263
+ @param {String} selector
264
+ @returns {CoreQuery}
265
+ */
266
+ filter: function( selector ) {
267
+ return this.pushStack(
268
+ (SC.typeOf(selector) === SC.T_FUNCTION) &&
269
+ CQ.grep(this, function(elem, i){
270
+ return selector.call( elem, i );
271
+ }) || CQ.multiFilter( selector, this ) );
272
+ },
273
+
274
+ /**
275
+ Returns the results not matching the passed selector. This is the
276
+ opposite of filter.
277
+
278
+
279
+ @param {String} selector
280
+ @returns {CoreQuery}
281
+ */
282
+ not: function( selector ) {
283
+ if ( selector.constructor == String ) {
284
+ // test special case where just one selector is passed in
285
+ if ( isSimple.test( selector ) )
286
+ return this.pushStack( CQ.multiFilter( selector, this, true ) );
287
+ else
288
+ selector = CQ.multiFilter( selector, this );
289
+ }
290
+
291
+ var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
292
+ return this.filter(function() {
293
+ return isArrayLike ? CQ.inArray( this, selector ) < 0 : this != selector;
294
+ });
295
+ },
296
+
297
+ /**
298
+ Force the current matched set of elements to become the specified array
299
+ of elements (destroying the stack in the process) You should use
300
+ pushStack() in order to do this, but maintain the stack.
301
+
302
+ This method is mostly used internally. You will not need to use it
303
+ yourself very often.
304
+
305
+ @param {Array} elems
306
+ @returns {CoreQuery} receiver
307
+ */
308
+ setArray: function( elems ) {
309
+ // Resetting the length to 0, then using the native Array push
310
+ // is a super-fast way to populate an object with array-like properties
311
+ this.length = 0;
312
+ Array.prototype.push.apply( this, elems );
313
+ return this;
314
+ },
315
+
316
+ /**
317
+ Executes the passed function on every element in the CoreQuery object.
318
+ Returns an array with the return values. Note that null values will
319
+ be omitted from the resulting set. This differs from SC.Enumerable and
320
+ the JavaScript standard.
321
+
322
+ The callback must have the signature:
323
+
324
+ {{{
325
+ function(currentElement, currentIndex) { return mappedValue; }
326
+ }}}
327
+
328
+ Note that "this" on the function will also be the currentElement.
329
+
330
+ @param {Function} callback
331
+ @returns {CoreQuery} results
332
+ */
333
+ map: function( callback ) {
334
+ return this.pushStack( CQ.map(this, function(elem, i){
335
+ return callback.call( elem, i, elem );
336
+ }));
337
+ },
338
+
339
+ /**
340
+ Execute a callback for every element in the matched set. (You can seed
341
+ the arguments with an array of args, but this is only used internally.)
342
+
343
+ @param {Function} callback
344
+ @param {Object} args
345
+ @returns {CoreQuery} receiver
346
+ */
347
+ each: function( callback, args ) {
348
+ return CQ.each( this, callback, args );
349
+ },
350
+
351
+ /**
352
+ Determine the position of an element within a matched set of elements.
353
+ jQuery-compatible name for indexOf().
354
+
355
+ @param {Element} elem
356
+ @returns {Number} location
357
+ */
358
+ index: function( elem ) {
359
+ if (elem && elem.jquery) elem = elem[0];
360
+ return Array.prototype.indexOf.call(this, elem);
361
+ },
362
+
363
+ /**
364
+ Returns a new CoreQuery object that contains just the matching item.
365
+
366
+ @param {Number} i
367
+ @returns {CoreQuery}
368
+ */
369
+ eq: function( i ) {
370
+ return this.slice( i, +i + 1 );
371
+ },
372
+
373
+ /**
374
+ Slice the CoreQuery result set just like you might slice and array.
375
+ Returns a new CoreQuery object with the result set.
376
+
377
+ @returns {CoreQuery}
378
+ */
379
+ slice: function() {
380
+ return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
381
+ },
382
+
383
+ /** Adds the relevant elements to the existing matching set. */
384
+ add: function( selector ) {
385
+ return this.pushStack( CQ.merge(
386
+ this.get(),
387
+ typeof selector == 'string' ?
388
+ CQ( selector ) :
389
+ CQ.makeArray( selector )
390
+ ).uniq()) ;
391
+ },
392
+
393
+ /**
394
+ Get to set the named attribute value on the element. You can either
395
+ pass in the name of an attribute you would like to read from the first
396
+ matched element, a single attribute/value pair to set on all elements
397
+ or a hash of attribute/value pairs to set on all elements.
398
+
399
+ @param {String} name attribute name
400
+ @param {Object} value attribute value
401
+ @param {String} type ?
402
+ @returns {CoreQuery} receiver
403
+ */
404
+ attr: function( name, value, type ) {
405
+ var options = name;
406
+
407
+ // Look for the case where we're accessing a style value
408
+ if ( name.constructor == String )
409
+ if ( value === undefined )
410
+ return this[0] && CQ[ type || "attr" ]( this[0], name );
411
+
412
+ else {
413
+ options = {};
414
+ options[ name ] = value;
415
+ }
416
+
417
+ // Check to see if we're setting style values
418
+ return this.each(function(i){
419
+ // Set all the styles
420
+ for ( name in options )
421
+ CQ.attr(
422
+ (type)?this.style:this,
423
+ name, CQ.prop( this, options[ name ], type, i, name ));
424
+ });
425
+ },
426
+
427
+ html: function( value ) {
428
+ return value === undefined ?
429
+ (this[0] ?
430
+ this[0].innerHTML.replace(/ CQ\d+="(?:\d+|null)"/g, "") :
431
+ null) :
432
+ this.empty().append( value );
433
+ // return value == undefined ?
434
+ // (this[0] ? this[0].innerHTML : null) :
435
+ // this.empty().append( value );
436
+ },
437
+
438
+ andSelf: function() { return this.add( this.prevObject ); },
439
+
440
+ /**
441
+ Returns YES if every element in the matching set matches the passed
442
+ selector. Remember that only simple selectors are supported in
443
+ CoreQuery.
444
+
445
+ @param {String} selector
446
+ @return {Boolean}
447
+ */
448
+ is: function( selector ) {
449
+ return !!selector && CQ.multiFilter( selector, this ).length > 0;
450
+ },
451
+
452
+ /**
453
+ Returns YES if every element in the matching set has the named CSS
454
+ class.
455
+
456
+ @param {String} className
457
+ @returns {Boolean}
458
+ */
459
+ hasClass: function( className ) {
460
+ return Array.prototype.every.call(this, function(elem) {
461
+ return (elem.nodeType!=1) || CQ.className.has(elem, className) ;
462
+ });
463
+ },
464
+
465
+ /**
466
+ Provides a standardized, cross-browser method to get and set the
467
+ value attribute of a form element. Optionally pass a value to set or
468
+ no value to get.
469
+
470
+ @param {Object} value
471
+ @return {Object|CoreQuery}
472
+ */
473
+ val: function( value ) {
474
+
475
+ // get the value
476
+ if ( value == undefined ) {
477
+ var elem = this[0];
478
+ if (elem) {
479
+ if(CQ.nodeName(elem, 'option'))
480
+ return (elem.attributes.value || {}).specified ? elem.value : elem.text;
481
+
482
+ // We need to handle select boxes special
483
+ if ( CQ.nodeName( elem, "select" ) ) {
484
+ var index = elem.selectedIndex,
485
+ values = [],
486
+ options = elem.options,
487
+ one = elem.type == "select-one";
488
+
489
+ // Nothing was selected
490
+ if ( index < 0 ) return null;
491
+
492
+ // Loop through all the selected options
493
+ var i, max = one ? index+1:options.length;
494
+ for (i = one ? index : 0; i < max; i++ ) {
495
+ var option = options[ i ];
496
+ if ( option.selected ) {
497
+ value = CQ(option).val(); // get value
498
+ if (one) return value; // We don't need an array for one
499
+ values.push( value ); // Multi-Selects return an array
500
+ }
501
+ }
502
+
503
+ return values;
504
+ }
505
+
506
+ // Everything else, we just grab the value
507
+ return (elem.value || "").replace(/\r/g, "");
508
+ }
509
+ return undefined;
510
+
511
+ // otherwise set the value
512
+ } else {
513
+ if( value.constructor == Number ) value += ''; // force to string
514
+ this.each(function(){
515
+ if ( this.nodeType != 1 ) return;
516
+
517
+ // handle radio/checkbox. set the checked value
518
+ if (SC.typeOf(value) === SC.T_ARRAY && (/radio|checkbox/).test(this.type)) {
519
+ this.checked = (CQ.inArray(this.value, value) >= 0 ||
520
+ CQ.inArray(this.name, value) >= 0);
521
+
522
+ // handle selects
523
+ } else if ( CQ.nodeName( this, "select" ) ) {
524
+ var values = CQ.makeArray(value);
525
+ CQ( "option", this ).each(function(){
526
+ this.selected = (CQ.inArray( this.value, values ) >= 0 ||
527
+ CQ.inArray( this.text, values ) >= 0);
528
+ });
529
+
530
+ if (!values.length) this.selectedIndex = -1;
531
+
532
+ // otherwise, just set the value property
533
+ } else this.value = value;
534
+ });
535
+ }
536
+ return this ;
537
+ },
538
+
539
+ /**
540
+ Returns a clone of the matching set of elements. Note that this will
541
+ NOT clone event handlers like the jQuery version does becaue CoreQuery
542
+ does not deal with events.
543
+ */
544
+ clone: function() {
545
+ // Do the clone
546
+ var ret = this.map(function(){
547
+ if ( SC.browser.msie && !CQ.isXMLDoc(this) ) {
548
+ // IE copies events bound via attachEvent when
549
+ // using cloneNode. Calling detachEvent on the
550
+ // clone will also remove the events from the orignal
551
+ // In order to get around this, we use innerHTML.
552
+ // Unfortunately, this means some modifications to
553
+ // attributes in IE that are actually only stored
554
+ // as properties will not be copied (such as the
555
+ // the name attribute on an input).
556
+ var clone = this.cloneNode(true),
557
+ container = document.createElement("div");
558
+ container.appendChild(clone);
559
+ return CQ.clean([container.innerHTML])[0];
560
+ } else return this.cloneNode(true);
561
+ });
562
+
563
+ // Need to set the expando to null on the cloned set if it exists
564
+ // removeData doesn't work here, IE removes it from the original as well
565
+ // this is primarily for IE but the data expando shouldn't be copied
566
+ // over in any browser
567
+ var clone = ret.find("*").andSelf().each(function(){
568
+ if ( this[ SC.guidKey ] != undefined )
569
+ this[ SC.guidKey ] = null;
570
+ });
571
+
572
+ // Return the cloned set
573
+ return ret;
574
+ },
575
+
576
+ /**
577
+ Set or retrieve the specified CSS value. Pass only a key to get the
578
+ current value, pass a key and value to change it.
579
+
580
+ @param {String} key
581
+ @param {Object} value
582
+ @returns {Object|CoreQuery}
583
+ */
584
+ css: function( key, value ) {
585
+ // ignore negative width and height values
586
+ if ((key == 'width' || key == 'height') && parseFloat(value,0) < 0 ) {
587
+ value = undefined;
588
+ }
589
+ return this.attr( key, value, "curCSS" );
590
+ },
591
+
592
+ /**
593
+ Set or retrieve the text content of an element. Pass a text element to
594
+ update or set to end it.
595
+
596
+ @param {String} text
597
+ @returns {String|CoreQuery}
598
+ */
599
+ text: function( text ) {
600
+ if ( typeof text != "object" && text != null )
601
+ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
602
+
603
+ var ret = "";
604
+
605
+ CQ.each( text || this, function(){
606
+ CQ.each( this.childNodes, function(){
607
+ if ( this.nodeType != 8 )
608
+ ret += this.nodeType != 1 ?
609
+ this.nodeValue : CQ.fn.text( [ this ] );
610
+ });
611
+ });
612
+
613
+ return ret;
614
+ },
615
+
616
+ /** Simple method to show elements without animation. */
617
+ show: function() {
618
+ var isVisible = SC.$.isVisible;
619
+ this.each(function() {
620
+ if (!isVisible(this)) {
621
+
622
+ // try to restore to natural layout as defined by CSS
623
+ this.style.display = this.oldblock || '';
624
+
625
+ // handle edge case where the CSS style is none so we can't detect
626
+ // the natural display state.
627
+ if (CQ.css(this,'display') == 'none') {
628
+ var elem = CQ('<' + this.tagName + '/>');
629
+ CQ('body').append(elem);
630
+ this.style.display = elem.css('display');
631
+ // edge case where we still can't get the display
632
+ if (this.style.display === 'none') this.style.display = 'block';
633
+ elem.remove(); elem = null;
634
+ }
635
+ }
636
+ }) ;
637
+ return this ;
638
+ },
639
+
640
+ /** Simple method to hide elements without animation. */
641
+ hide: function() {
642
+ var isVisible = SC.$.isVisible;
643
+ this.each(function() {
644
+ if (isVisible(this)) {
645
+ this.oldblock = this.oldblock || CQ.css(this,'display');
646
+ this.style.display = 'none';
647
+ }
648
+ }) ;
649
+ return this ;
650
+ },
651
+
652
+ /**
653
+ Low-level dom manipulation method used by append(), before(), after()
654
+ among others. Unlike the jQuery version, this version does not execute
655
+ <script> tags. That is generally not a good way to input scripts.
656
+ */
657
+ domManip: function( args, table, reverse, callback ) {
658
+ var clone = this.length > 1, elems;
659
+
660
+ return this.each(function(){
661
+ if ( !elems ) {
662
+ elems = CQ.clean( args, this.ownerDocument );
663
+ if (reverse) elems.reverse();
664
+ }
665
+
666
+ var obj = this;
667
+ if ( table && CQ.nodeName( this, "table" ) && CQ.nodeName( elems[0], "tr" ) ) {
668
+ obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
669
+ }
670
+
671
+ CQ.each(elems, function(){
672
+ var elem = clone ? CQ( this ).clone( true )[0] : this;
673
+ // Inject the elements into the document
674
+ callback.call( obj, elem );
675
+ });
676
+ });
677
+ },
678
+
679
+ append: function() {
680
+ return this.domManip(arguments, true, false, function(elem){
681
+ if (this.nodeType == 1)
682
+ this.appendChild( elem );
683
+ });
684
+ },
685
+
686
+ prepend: function() {
687
+ return this.domManip(arguments, true, true, function(elem){
688
+ if (this.nodeType == 1)
689
+ this.insertBefore( elem, this.firstChild );
690
+ });
691
+ },
692
+
693
+ before: function() {
694
+ return this.domManip(arguments, false, false, function(elem){
695
+ this.parentNode.insertBefore( elem, this );
696
+ });
697
+ },
698
+
699
+ after: function() {
700
+ return this.domManip(arguments, false, true, function(elem){
701
+ this.parentNode.insertBefore( elem, this.nextSibling );
702
+ });
703
+ },
704
+
705
+ replaceWith: function( value ) {
706
+ return this.after( value ).remove();
707
+ },
708
+
709
+ removeData: function( key ){
710
+ return this.each(function(){ SC.removeData( this, key ); });
711
+ }
712
+
713
+ }) ;
714
+
715
+ // add useful helper methods to CoreQuery
716
+ CoreQuery.mixin(/** @scope SC.CoreQuery */ {
717
+
718
+ nodeName: function( elem, name ) {
719
+ return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
720
+ },
721
+
722
+ /**
723
+ Execute the passed callback on the elems array, returning an array with
724
+ the mapped values. Note that null return values are left out of the
725
+ resulting mapping array. This differs from the standard map() function
726
+ defined by SC.Enumerable and the JavaScript standard.
727
+
728
+ The callback must have the signature:
729
+
730
+ {{{
731
+ function(currentElement, currentIndex) { return mappedValue; }
732
+ }}}
733
+
734
+ Note that "this" on the function will also be the currentElement.
735
+
736
+ @param {Array} elems
737
+ @param {Function} callback
738
+ @returns {Array} mapped elements
739
+ */
740
+ map: function( elems, callback ) {
741
+ var ret = [];
742
+
743
+ // Go through the array, translating each of the items to their
744
+ // new value (or values).
745
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
746
+ var value = callback( elems[ i ], i );
747
+
748
+ if ( value != null )
749
+ ret[ ret.length ] = value;
750
+ }
751
+
752
+ return ret.concat.apply([],ret) ;
753
+ },
754
+
755
+ /**
756
+ Executes the passed callback on each item in the iterable object
757
+ passed. This deviates from the standard getEach() method defined in
758
+ SC.Enumerable and in the JavaScript standards.
759
+
760
+ @param {Array} object
761
+ @param {Function} callback
762
+ @param {Object} args internal use only
763
+ @returns {Object} object
764
+ */
765
+ each: function( object, callback, args ) {
766
+ var name, i = 0, length = object.length;
767
+
768
+ if ( args ) {
769
+ if ( length == undefined ) {
770
+ for ( name in object )
771
+ if ( callback.apply( object[ name ], args ) === false )
772
+ break;
773
+ } else
774
+ for ( ; i < length; )
775
+ if ( callback.apply( object[ i++ ], args ) === false )
776
+ break;
777
+
778
+ // A special, fast, case for the most common use of each
779
+ } else {
780
+ if ( length == undefined ) {
781
+ for ( name in object )
782
+ if ( callback.call( object[ name ], name, object[ name ] ) === false )
783
+ break;
784
+ } else
785
+ for ( var value = object[0];
786
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
787
+ }
788
+
789
+ return object;
790
+ },
791
+
792
+ isXMLDoc: function( elem ) {
793
+ return elem.documentElement && !elem.body ||
794
+ elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
795
+ },
796
+
797
+ clean: function( elems, context ) {
798
+ var ret = [];
799
+ context = context || document;
800
+ // !context.createElement fails in IE with an error but returns typeof 'object'
801
+ if (typeof context.createElement == 'undefined') {
802
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
803
+ }
804
+
805
+ CQ.each(elems, function(i, elem){
806
+ if ( typeof elem == 'number' ) elem += '';
807
+ if ( !elem ) return;
808
+
809
+ // Convert html string into DOM nodes
810
+ if ( typeof elem == "string" ) {
811
+ // Fix "XHTML"-style tags in all browsers
812
+ elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
813
+ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
814
+ all :
815
+ front + "></" + tag + ">";
816
+ });
817
+
818
+ // Trim whitespace, otherwise indexOf won't work as expected
819
+ var tags = elem.trim().toLowerCase(),
820
+ div = context.createElement("div");
821
+
822
+ var wrap =
823
+ // option or optgroup
824
+ !tags.indexOf("<opt") &&
825
+ [ 1, "<select multiple='multiple'>", "</select>" ] ||
826
+
827
+ !tags.indexOf("<leg") &&
828
+ [ 1, "<fieldset>", "</fieldset>" ] ||
829
+
830
+ tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
831
+ [ 1, "<table>", "</table>" ] ||
832
+
833
+ !tags.indexOf("<tr") &&
834
+ [ 2, "<table><tbody>", "</tbody></table>" ] ||
835
+
836
+ // <thead> matched above
837
+ (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
838
+ [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
839
+
840
+ !tags.indexOf("<col") &&
841
+ [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
842
+
843
+ // IE can't serialize <link> and <script> tags normally
844
+ SC.browser.msie &&
845
+ [ 1, "div<div>", "</div>" ] ||
846
+
847
+ [ 0, "", "" ];
848
+
849
+ // Go to html and back, then peel off extra wrappers
850
+ div.innerHTML = wrap[1] + elem + wrap[2];
851
+
852
+ // Move to the right depth
853
+ while ( wrap[0]-- ) div = div.lastChild;
854
+
855
+ // Remove IE's autoinserted <tbody> from table fragments
856
+ if ( SC.browser.msie ) {
857
+
858
+ // String was a <table>, *may* have spurious <tbody>
859
+ var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
860
+ div.firstChild && div.firstChild.childNodes :
861
+
862
+ // String was a bare <thead> or <tfoot>
863
+ wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
864
+ div.childNodes :
865
+ [];
866
+
867
+ for ( var j = tbody.length - 1; j >= 0 ; --j )
868
+ if ( CQ.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
869
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
870
+
871
+ // IE completely kills leading whitespace when innerHTML is used
872
+ if ( /^\s/.test( elem ) )
873
+ div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
874
+
875
+ }
876
+
877
+ elem = CQ.makeArray( div.childNodes );
878
+ }
879
+
880
+ if (elem.length === 0 && (!CQ.nodeName( elem, "form" ) && !CQ.nodeName( elem, "select" ))) return;
881
+
882
+ if (elem[0] == undefined || CQ.nodeName( elem, "form" ) || elem.options) ret.push( elem );
883
+
884
+ else ret = CQ.merge( ret, elem );
885
+
886
+ });
887
+
888
+ return ret;
889
+ },
890
+
891
+ /**
892
+ Core element finder function in SC.CoreQuery. CoreQuery supports only
893
+ a very simple set of finders. Namely, you can specify the following
894
+ simple types of selectors:
895
+
896
+ - .class-name: this will find all elements with the matching class name
897
+ - #id: this will find all elements matching the ID
898
+ - tagname: this will find all elements with the matching tags.
899
+
900
+ You can also do some basic joined expressions like:
901
+
902
+ {{{
903
+ tagname.class-name and tagname#id
904
+ }}}
905
+
906
+ Finally, you can do simple compound searches like
907
+
908
+ {{{
909
+ tagname .class-name tagname#id
910
+ }}}
911
+
912
+ You can also pass multiple selectors separated by commas. The return
913
+ set will be the OR of all the result set.
914
+
915
+ {{{
916
+ #item1,#item2,#item3
917
+ }}}
918
+
919
+ You cannot do any child searches, psuedo-selectors or other complex
920
+ searches. These are only the kinds of selectors that can be parsed
921
+ quickly and use built-in methods on the browser.
922
+
923
+ @param {String} t selector
924
+ @param {Element} context
925
+ @returns {Array} matched elements
926
+ */
927
+ find: function( t, context ) {
928
+
929
+ // Quickly handle non-string expressions
930
+ if ( typeof t != "string" ) return [ t ];
931
+
932
+ // if the selector contains commas, then we actually want to search
933
+ // multiple selectors.
934
+ if (t.indexOf(',')>=0) {
935
+ var ret = t.split(',').map(function(sel) {
936
+ return CQ.find(sel,context);
937
+ });
938
+
939
+ // flatten arrays
940
+ return ret.concat.apply([],ret).uniq() ;
941
+ }
942
+
943
+ // check to make sure context is a DOM element or a document
944
+ if ( context && context.nodeType != 1 && context.nodeType != 9) {
945
+ return [];
946
+ }
947
+
948
+ // Set the correct context (if none is provided)
949
+ context = context || document;
950
+
951
+ // Initialize the search. split the selector into pieces
952
+ var ret = [context], nodeName, inFindMode = YES;
953
+ var parts = t.match(quickSplit), len = parts.length, m ;
954
+
955
+ // loop through each part and either find or filter as needed
956
+ for(var idx=0;idx<len;idx++) {
957
+ t = parts[idx]; // the current selector to parse
958
+
959
+ // handle space separators. this just resets to find mode
960
+ if (t === ' ' || t === '') {
961
+ inFindMode = YES ;
962
+
963
+ // if we are in find mode, then use the current selector to
964
+ // find new elements that are children. at the end, leave findMode.
965
+ } else if (inFindMode) {
966
+
967
+ // split into parts to test result
968
+ m = singleClass.exec(t);
969
+
970
+ // handle special case where we get a tag name followed by an ID.
971
+ // in this case, just swap the two and proceed.
972
+ if ((m[1] === '') && (idx<(len-1)) && (parts[idx+1].charAt(0)==='#')) {
973
+ t = parts[idx+1]; parts[idx+1] = parts[idx]; // swap
974
+ m = singleClass.exec(t); // reparse
975
+ }
976
+
977
+ // now loop through and find elements based on tag
978
+ var next = [], retlen = ret.length, retidx, cur, val = m[2], found;
979
+ for(retidx=0;retidx<retlen;retidx++) {
980
+ cur = ret[retidx];
981
+ switch(m[1]) {
982
+ case '': // tag
983
+ if (!val) val = '*';
984
+ // Handle IE7 being really dumb about <object>s
985
+ if ( val == "*" && cur.nodeName.toLowerCase() == "object" ) {
986
+ val = "param";
987
+ }
988
+
989
+ next = CQ.merge(next, cur.getElementsByTagName(val));
990
+ break;
991
+
992
+ case '#': // id
993
+ // handle special case where we are searching the document
994
+ if (cur === document) {
995
+ found = document.getElementById(val) ;
996
+
997
+ // if this is IE, verify that it didn't search by name
998
+ if (SC.browser.msie && found && found.getAttribute('id')!==val){
999
+ found = NO; // clear
1000
+ } else {
1001
+ if (found) next.push(found) ;
1002
+ found = YES ; // do not do slow search
1003
+ }
1004
+ } else found = NO;
1005
+
1006
+ // Otherwise, we have to do a slow search
1007
+ if (!found) {
1008
+ // the return value of getElementsByTagName is not an Array
1009
+ // so we need to fake it.
1010
+ found = cur.getElementsByTagName('*') ;
1011
+ found = Array.prototype.find.call(found, function(el){
1012
+ return el.getAttribute && (el.getAttribute('id')===val);
1013
+ }) ;
1014
+ if (found) next.push(found) ;
1015
+ }
1016
+ break ;
1017
+
1018
+ case '.': // class
1019
+ if (cur.getElementsByClassName) {
1020
+ next = CQ.merge(next, cur.getElementsByClassName(val));
1021
+ } else {
1022
+ next = CQ.merge(next,
1023
+ CQ.classFilter(cur.getElementsByTagName('*'),val));
1024
+ }
1025
+ break;
1026
+ default:
1027
+ // do nothing
1028
+ }
1029
+ }
1030
+ delete ret; ret = next ; // swap array
1031
+ inFindMode = NO;
1032
+
1033
+ // if we are not in findMode then simply filter the results.
1034
+ } else ret = CQ.filter(t, ret) ;
1035
+ }
1036
+
1037
+ // remove original context if still there
1038
+ if (ret && ret[0] == context) ret.shift();
1039
+ return ret.uniq() ; // make sure no duplicated are returned
1040
+ },
1041
+
1042
+ classFilter: function(r,m,not){
1043
+ m = " " + m + " ";
1044
+ var tmp = [];
1045
+ for ( var i = 0; r[i]; i++ ) {
1046
+ var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
1047
+ if ( !not && pass || not && !pass )
1048
+ tmp.push( r[i] );
1049
+ }
1050
+ return tmp;
1051
+ },
1052
+
1053
+ /**
1054
+ Filters a set of elements according to those matching the passed
1055
+ selector. The selector can contain only tag, class, and id options.
1056
+
1057
+ The CoreQuery filter function is only capable of handling simple querys
1058
+ such as a tag, class or ID. You cannot combine them. Instead call
1059
+ filter several times.
1060
+
1061
+ @param {String} t the selector to filter by
1062
+ @param {Array} r the element to filter
1063
+ @param {Boolean} not invert filter
1064
+ @returns {Array} filtered array
1065
+ */
1066
+ filter: function(t,r,not) {
1067
+ // split into parts to test result
1068
+ var m = singleClass.exec(t), val = m[2], kind = m[1], filter ;
1069
+ if (kind === '.') { // special case class
1070
+ return CQ.classFilter(CQ.makeArray(r), val, not) ;
1071
+ } else {
1072
+ if (kind === '#') { // id
1073
+ filter = function(el) {
1074
+ var ret=el && el.getAttribute && (el.getAttribute('id') === val);
1075
+ return (not) ? !ret : ret ;
1076
+ } ;
1077
+
1078
+ } else { // tag
1079
+ filter = function(el) {
1080
+ var ret= CQ.nodeName(el, val);
1081
+ return (not) ? !ret : ret ;
1082
+ } ;
1083
+ }
1084
+
1085
+ // the return value may not be a real instance of Array, so fake it.
1086
+ return Array.prototype.filter.call(CQ.makeArray(r), filter) ;
1087
+ }
1088
+ },
1089
+
1090
+ /** @private Accepts filters separated by commas. */
1091
+ multiFilter: function( expr, elems, not ) {
1092
+ expr = (expr.indexOf(',')) ? expr.split(',') : [expr];
1093
+ var loc=expr.length,cur,ret=[];
1094
+ while(--loc >= 0) { // unit tests expect reverse iteration
1095
+ cur = CQ.filter(expr[loc].trim(), elems, not) ;
1096
+ ret = not ? elems = cur : CQ.merge(cur,ret);
1097
+ }
1098
+ return ret ;
1099
+ },
1100
+
1101
+ /**
1102
+ Merge two result sets together. This method knows how to handle
1103
+ the special iterables returned by IE as well. Used internally.
1104
+ */
1105
+ merge: function(first, second) {
1106
+ // We have to loop this way because IE & Opera overwrite the length
1107
+ // expando of getElementsByTagName
1108
+ var i = 0, elem, pos = first.length;
1109
+ // Also, we need to make sure that the correct elements are being
1110
+ // returned (IE returns comment nodes in a '*' query)
1111
+ if ( SC.browser.msie ) {
1112
+ while ( elem = second[ i++ ] ) {
1113
+ if ( elem.nodeType != 8 ) first[ pos++ ] = elem;
1114
+ }
1115
+
1116
+ } else {
1117
+ while ( elem = second[ i++ ] ) first[ pos++ ] = elem;
1118
+ }
1119
+
1120
+ return first;
1121
+ },
1122
+
1123
+ // makeArray is the CoreQuery version of $A().
1124
+ makeArray: function(array) {
1125
+ var ret = [];
1126
+
1127
+ if( array != null ){
1128
+ var i = array.length;
1129
+ // The window, strings (and functions) also have 'length'
1130
+ if( i == null || typeof array == 'string' || array.setInterval )
1131
+ ret[0] = array;
1132
+ else
1133
+ while( i )
1134
+ ret[--i] = array[i];
1135
+ }
1136
+
1137
+ return ret;
1138
+ },
1139
+
1140
+ inArray: function(elem,array) {
1141
+ return (array.indexOf) ? array.indexOf(elem) : Array.prototype.indexOf.call(array, elem);
1142
+ },
1143
+
1144
+ // Check to see if the W3C box model is being used
1145
+ boxModel: !SC.browser.msie || document.compatMode == "CSS1Compat",
1146
+
1147
+ props: {
1148
+ "for": "htmlFor",
1149
+ "class": "className",
1150
+ "float": styleFloat,
1151
+ cssFloat: styleFloat,
1152
+ styleFloat: styleFloat,
1153
+ readonly: "readOnly",
1154
+ maxlength: "maxLength",
1155
+ cellspacing: "cellSpacing",
1156
+ rowspan: "rowSpan"
1157
+ },
1158
+
1159
+ /** @private Prepares a property string for insertion. */
1160
+ prop: function( elem, value, type, i, name ) {
1161
+ // Handle executable functions
1162
+ if (SC.typeOf(value) === SC.T_FUNCTION) value = value.call(elem, i);
1163
+
1164
+ // Handle passing in a number to a CSS property
1165
+ return value && (value.constructor === Number) && type == "curCSS" && !exclude.test( name ) ? value + "px" : value;
1166
+ },
1167
+
1168
+
1169
+ grep: function( elems, callback, inv ) {
1170
+ var ret = [];
1171
+
1172
+ // Go through the array, only saving the items
1173
+ // that pass the validator function
1174
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
1175
+ if ( !inv != !callback( elems[ i ], i ) ) ret.push( elems[ i ] );
1176
+ }
1177
+ return ret;
1178
+ },
1179
+
1180
+ /** @private internal use only */
1181
+ className: {
1182
+
1183
+ // internal only, use addClass("class")
1184
+ add: function( elem, classNames ) {
1185
+ var has = CQ.className.has ;
1186
+ CQ.each((classNames || "").split(/\s+/), function(i, className){
1187
+ if ( elem.nodeType == 1 && !has( elem.className, className ) )
1188
+ elem.className += (elem.className ? " " : "") + className;
1189
+ });
1190
+ },
1191
+
1192
+ // internal only, use removeClass("class")
1193
+ remove: function( elem, classNames ) {
1194
+ if (elem.nodeType == 1) {
1195
+ elem.className = classNames != undefined ?
1196
+ CQ.grep(elem.className.split(/\s+/), function(className){
1197
+ return !CQ.className.has( classNames, className );
1198
+ }).join(" ") : "";
1199
+ }
1200
+ },
1201
+
1202
+ // internal only, use hasClass("class")
1203
+ has: function( elem, className ) {
1204
+ return CQ.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
1205
+ }
1206
+ },
1207
+
1208
+ /** @private A method for quickly swapping in/out CSS properties to get
1209
+ correct calculations */
1210
+ swap: function( elem, options, callback, direction, arg ) {
1211
+ var old = {};
1212
+ // Remember the old values, and insert the new ones
1213
+ for ( var name in options ) {
1214
+ old[ name ] = elem.style[ name ];
1215
+ elem.style[ name ] = options[ name ];
1216
+ }
1217
+
1218
+ var ret = callback(elem, direction, arg );
1219
+
1220
+ // Revert the old values
1221
+ for ( var name in options ) elem.style[ name ] = old[ name ];
1222
+ return ret ;
1223
+ },
1224
+
1225
+ /** returns a normalized value for the specified style name. */
1226
+ css: function( elem, name, force ) {
1227
+ // handle special case for width/height
1228
+ if ( name == "width" || name == "height" ) {
1229
+ var val, which = (name == "width") ? LEFT_RIGHT : TOP_BOTTOM,
1230
+ props = CSS_DISPLAY_PROPS;
1231
+
1232
+ val = SC.$.isVisible(elem) ? getWH(elem,name,which) : CQ.swap(elem,props,getWH,name,which) ;
1233
+
1234
+ return Math.max(0, val);
1235
+ }
1236
+
1237
+ return CQ.curCSS( elem, name, force );
1238
+ },
1239
+
1240
+ /** @private internal method to retrieve current CSS. */
1241
+ curCSS: function( elem, name, force ) {
1242
+ var ret, style = elem.style;
1243
+
1244
+ // We need to handle opacity special in IE
1245
+ if ( name == "opacity" && SC.browser.msie ) {
1246
+ ret = CQ.attr( style, "opacity" );
1247
+ return ret == "" ? "1" : ret;
1248
+ }
1249
+
1250
+ // Opera sometimes will give the wrong display answer, this fixes it,
1251
+ // see #2037
1252
+ if ( SC.browser.opera && name === "display" ) {
1253
+ var save = style.outline;
1254
+ style.outline = "0 solid black";
1255
+ style.outline = save;
1256
+ }
1257
+
1258
+ // Make sure we're using the right name for getting the float value
1259
+ var isFloat = name.match(/float/i);
1260
+ if (isFloat) name = styleFloat;
1261
+
1262
+ // simple case to collect the value
1263
+ if ( !force && style && style[ name ] ) {
1264
+ ret = style[ name ];
1265
+
1266
+ // otherwise try to use cached computed value
1267
+ } else if ( defaultView.getComputedStyle ) {
1268
+
1269
+ // Only "float" is needed here
1270
+ if (isFloat) name = "float";
1271
+
1272
+ name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
1273
+
1274
+ // get the computed style and verify its not broken.
1275
+ var computedStyle = defaultView.getComputedStyle( elem, null );
1276
+ if ( computedStyle && !styleIsBorked(elem, defaultView) ) {
1277
+ ret = computedStyle.getPropertyValue( name );
1278
+
1279
+ // If the element isn't reporting its values properly in Safari
1280
+ // then some display: none elements are involved
1281
+ } else {
1282
+ var swap = [], stack = [], a = elem, i = 0;
1283
+
1284
+ // Locate all of the parent display: none elements
1285
+ for ( ; a && styleIsBorked(a); a = a.parentNode ) stack.unshift(a);
1286
+
1287
+ // Go through and make them visible, but in reverse
1288
+ // (It would be better if we knew the exact display type that they
1289
+ // had)
1290
+ for ( ; i < stack.length; i++ ) {
1291
+ if (styleIsBorked(stack[i])) {
1292
+ swap[i] = stack[i].style.display;
1293
+ stack[i].style.display = "block";
1294
+ }
1295
+ }
1296
+
1297
+ // Since we flip the display style, we have to handle that
1298
+ // one special, otherwise get the value
1299
+ ret = (name == "display" && swap[stack.length-1]!=null) ? "none" :
1300
+ (computedStyle && computedStyle.getPropertyValue(name)) || "";
1301
+
1302
+ // Finally, revert the display styles back
1303
+ for ( i = 0; i < swap.length; i++ ) {
1304
+ if (swap[i]!=null) stack[i].style.display = swap[i];
1305
+ }
1306
+ }
1307
+
1308
+ // We should always get a number back from opacity
1309
+ if (name == "opacity" && ret == "") ret = "1";
1310
+
1311
+ } else if (elem.currentStyle) {
1312
+ // var camelCase = name.camelize();
1313
+
1314
+ ret = elem.currentStyle[ name ] || elem.currentStyle[ name.camelize() ];
1315
+
1316
+ // From the awesome hack by Dean Edwards
1317
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
1318
+ // If we're not dealing with a regular pixel number
1319
+ // but a number that has a weird ending, we need to convert it to
1320
+ // pixels
1321
+ if (!(/^\d+(px)?$/i).test(ret) && (/^\d/).test(ret)) {
1322
+ // Remember the original values
1323
+ var left = style.left, rsLeft = elem.runtimeStyle.left;
1324
+
1325
+ // Put in the new values to get a computed value out
1326
+ elem.runtimeStyle.left = elem.currentStyle.left;
1327
+ style.left = ret || 0;
1328
+ ret = style.pixelLeft + "px";
1329
+
1330
+ // Revert the changed values
1331
+ style.left = left;
1332
+ elem.runtimeStyle.left = rsLeft;
1333
+ }
1334
+ }
1335
+
1336
+ return ret;
1337
+ },
1338
+
1339
+ /** @private
1340
+ returns all of the actual nodes (excluding whitespace, comments, etc) in
1341
+ the passed element.
1342
+ */
1343
+ dir: function( elem, dir ){
1344
+ var matched = [], cur = elem[dir];
1345
+ while ( cur && cur != document ) {
1346
+ if ( cur.nodeType == 1 ) matched.push( cur );
1347
+ cur = cur[dir];
1348
+ }
1349
+ return matched;
1350
+ },
1351
+
1352
+ /** @private
1353
+ Returns the nth actual node (not whitespace, comment, etc) in the passed
1354
+ element.
1355
+ */
1356
+ nth: function(cur,result,dir,elem){
1357
+ result = result || 1;
1358
+ var num = 0;
1359
+ for ( ; cur; cur = cur[dir] ) {
1360
+ if ( cur.nodeType == 1 && ++num == result ) break;
1361
+ }
1362
+ return cur;
1363
+ },
1364
+
1365
+ /** @private Finds the regular element-style siblings. */
1366
+ sibling: function( n, elem ) {
1367
+ var r = [];
1368
+ for ( ; n; n = n.nextSibling ) {
1369
+ if ( n.nodeType == 1 && n != elem ) r.push( n );
1370
+ }
1371
+ return r;
1372
+ },
1373
+
1374
+ /** Primitive helper can read or update an attribute on an element. */
1375
+ attr: function( elem, name, value ) {
1376
+ // don't set attributes on text and comment nodes
1377
+ if (!elem || elem.nodeType == 3 || elem.nodeType == 8) return undefined;
1378
+
1379
+ var notxml = !CQ.isXMLDoc( elem ),
1380
+ set = value !== undefined,
1381
+ msie = SC.browser.msie;
1382
+
1383
+ // Try to normalize/fix the name
1384
+ name = notxml && CQ.props[ name ] || name;
1385
+
1386
+ // Only do all the following if this is a node (faster for style)
1387
+ // IE elem.getAttribute passes even for style
1388
+ if ( elem.tagName ) {
1389
+
1390
+ // These attributes require special treatment
1391
+ var special = /href|src|style/.test( name );
1392
+
1393
+ // Safari mis-reports the default selected property of a hidden option
1394
+ // Accessing the parent's selectedIndex property fixes it
1395
+ if ( name == "selected" && SC.browser.safari ) {
1396
+ elem.parentNode.selectedIndex;
1397
+ }
1398
+
1399
+ // If applicable, access the attribute via the DOM 0 way
1400
+ if ( name in elem && notxml && !special ) {
1401
+ if ( set ){
1402
+ // We can't allow the type property to be changed (since it causes
1403
+ // problems in IE)
1404
+ if ( name == "type" && CQ.nodeName( elem, "input" ) && elem.parentNode ) {
1405
+ throw "type property can't be changed";
1406
+ }
1407
+
1408
+ elem[ name ] = value;
1409
+ }
1410
+
1411
+ // browsers index elements by id/name on forms, give priority to
1412
+ // attributes.
1413
+ if( CQ.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
1414
+ return elem.getAttributeNode( name ).nodeValue;
1415
+ }
1416
+
1417
+ return elem[ name ];
1418
+ }
1419
+
1420
+ if ( msie && notxml && name === "style" )
1421
+ return CQ.attr( elem.style, "cssText", value );
1422
+
1423
+ // convert the value to a string (all browsers do this but IE) see
1424
+ // #1070 (jQuery)
1425
+ if ( set ) elem.setAttribute( name, "" + value );
1426
+
1427
+ // Some attributes require a special call on IE
1428
+ var attr = (msie && notxml && special)
1429
+ ? elem.getAttribute( name, 2 )
1430
+ : elem.getAttribute( name );
1431
+
1432
+ // Non-existent attributes return null, we normalize to undefined
1433
+ return attr === null ? undefined : attr;
1434
+ }
1435
+
1436
+ // elem is actually elem.style ... set the style
1437
+
1438
+ // IE uses filters for opacity
1439
+ if ( msie && name == "opacity" ) {
1440
+ if ( set ) {
1441
+ // IE has trouble with opacity if it does not have layout
1442
+ // Force it by setting the zoom level
1443
+ elem.zoom = 1;
1444
+
1445
+ // Set the alpha filter to set the opacity
1446
+ elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
1447
+ (parseInt(value,0) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
1448
+ }
1449
+
1450
+ return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
1451
+ (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
1452
+ "";
1453
+ }
1454
+
1455
+ name = name.camelize();
1456
+ if ( set ) elem[ name ] = value;
1457
+
1458
+ return elem[ name ];
1459
+ }
1460
+
1461
+ }) ;
1462
+
1463
+ CQ.fn.init.prototype = CQ.fn;
1464
+
1465
+ // Create a new generic handlers.
1466
+ CQ.each({
1467
+ parent: function(elem){return elem.parentNode;},
1468
+
1469
+ parents: function(elem){return CQ.dir(elem,"parentNode");},
1470
+
1471
+ next: function(elem){return CQ.nth(elem,2,"nextSibling");},
1472
+
1473
+ prev: function(elem){return CQ.nth(elem,2,"previousSibling");},
1474
+
1475
+ nextAll: function(elem){
1476
+ return CQ.dir(elem,"nextSibling");
1477
+ },
1478
+
1479
+ prevAll: function(elem){
1480
+ return CQ.dir(elem,"previousSibling");
1481
+ },
1482
+
1483
+ siblings: function(elem){
1484
+ return CQ.sibling(elem.parentNode.firstChild,elem);
1485
+ },
1486
+
1487
+ children: function(elem){return CQ.sibling(elem.firstChild);},
1488
+
1489
+ contents: function(elem){
1490
+ return CQ.nodeName(elem,"iframe") ?
1491
+ elem.contentDocument||elem.contentWindow.document :
1492
+ CQ.makeArray(elem.childNodes);
1493
+ }
1494
+
1495
+ }, function(name, fn){
1496
+ CQ.fn[ name ] = function( selector ) {
1497
+ var ret = CQ.map( this, fn );
1498
+
1499
+ if ( selector && typeof selector == "string" )
1500
+ ret = CQ.multiFilter( selector, ret );
1501
+
1502
+ return this.pushStack(ret.uniq());
1503
+ };
1504
+ });
1505
+
1506
+ CQ.each({
1507
+ appendTo: "append",
1508
+ prependTo: "prepend",
1509
+ insertBefore: "before",
1510
+ insertAfter: "after",
1511
+ replaceAll: "replaceWith"
1512
+ }, function(name, original){
1513
+ CQ.fn[ name ] = function() {
1514
+ var args = arguments;
1515
+
1516
+ return this.each(function(){
1517
+ for ( var i = 0, length = args.length; i < length; i++ )
1518
+ CQ( args[ i ] )[ original ]( this );
1519
+ });
1520
+ };
1521
+ });
1522
+
1523
+ CQ.each({
1524
+ removeAttr: function( name ) {
1525
+ CQ.attr( this, name, "" );
1526
+ if (this.nodeType == 1) this.removeAttribute( name );
1527
+ },
1528
+
1529
+ addClass: function( classNames ) {
1530
+ CQ.className.add( this, classNames );
1531
+ },
1532
+
1533
+ removeClass: function( classNames ) {
1534
+ CQ.className.remove( this, classNames );
1535
+ },
1536
+
1537
+ toggleClass: function( classNames ) {
1538
+ CQ.className[ CQ.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
1539
+ },
1540
+
1541
+ /**
1542
+ Removes either all elements or elements matching the selector. Note
1543
+ that this does NOT account for event handling, since events are not
1544
+ managed by CoreQuery, unlike jQuery.
1545
+ */
1546
+ remove: function( selector ) {
1547
+ if ( !selector || CQ.filter( selector, [ this ] ).length ) {
1548
+ if (this.parentNode) this.parentNode.removeChild( this );
1549
+ }
1550
+ },
1551
+
1552
+ /**
1553
+ Removes the contents of the receiver, leaving it empty. Note that this
1554
+ does NOT deal with Event handling since that is not managed by
1555
+ CoreQuery.
1556
+ */
1557
+ empty: function() {
1558
+ while ( this.firstChild ) this.removeChild( this.firstChild );
1559
+ }
1560
+
1561
+ }, function(name, fn){
1562
+ CQ.fn[name] = function(){ return this.each(fn, arguments); };
1563
+ });
1564
+
1565
+ // Setup width and height functions
1566
+ CQ.each([ "Height", "Width" ], function(i, name){
1567
+ var type = name.toLowerCase();
1568
+
1569
+ CQ.fn[ type ] = function( size ) {
1570
+
1571
+ // Get window width or height
1572
+ if(this[0] === window) {
1573
+
1574
+ // Opera reports document.body.client[Width/Height] properly in both
1575
+ // quirks and standards
1576
+ if (SC.browser.opera) {
1577
+ ret = document.body["client" + name];
1578
+
1579
+ // Safari reports inner[Width/Height] just fine (Mozilla and Opera
1580
+ // include scroll bar widths)
1581
+ } else if (SC.browser.safari) {
1582
+ ret = window["inner" + name] ;
1583
+
1584
+ // Everyone else use document.documentElement or document.body
1585
+ // depending on Quirks vs Standards mode
1586
+ } else if (document.compatMode) {
1587
+ ret = documentElement['client' + name];
1588
+ } else ret = document.body['client' + name];
1589
+
1590
+ // get document width or height
1591
+ } else if (this[0] === document) {
1592
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is
1593
+ // greater
1594
+ ret = Math.max(
1595
+ Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
1596
+ Math.max(document.body["offset" + name], document.documentElement["offset" + name])) ;
1597
+
1598
+ // get/set element width/or height
1599
+ } else {
1600
+ if (size == undefined) {
1601
+ return this.length ? CQ.css(this[0], type) : null ;
1602
+
1603
+ // Set the width or height on the element (default to pixels if value is unitless)
1604
+ } else {
1605
+ return this.css(type, (size.constructor==String) ? size : size+"px");
1606
+ }
1607
+ }
1608
+ return ret ;
1609
+ };
1610
+
1611
+ var tl = i ? "Left" : "Top", // top or left
1612
+ br = i ? "Right" : "Bottom"; // bottom or right
1613
+
1614
+ // innerHeight and innerWidth
1615
+ CQ.fn["inner" + name] = function(){
1616
+ return this[ name.toLowerCase() ]() +
1617
+ num(this, "padding" + tl) +
1618
+ num(this, "padding" + br);
1619
+ };
1620
+
1621
+ // outerHeight and outerWidth
1622
+ CQ.fn["outer" + name] = function(margin) {
1623
+ return this["inner" + name]() +
1624
+ num(this, "border" + tl + "Width") +
1625
+ num(this, "border" + br + "Width") +
1626
+ (margin ? num(this, "margin" + tl) + num(this, "margin" + br) : 0);
1627
+ };
1628
+
1629
+ });
1630
+
1631
+ // The Offset Method
1632
+ // Originally By Brandon Aaron, part of the Dimension Plugin
1633
+ // http://jquery.com/plugins/project/dimensions
1634
+
1635
+ /** Calculates the offset for the first passed element. */
1636
+ CoreQuery.fn.offset = function() {
1637
+ var left = 0, top = 0, elem = this[0], br = SC.browser, results;
1638
+ if (!elem) return undefined;
1639
+
1640
+ function border(elem) {
1641
+ add( CQ.curCSS(elem, "borderLeftWidth", true), CQ.curCSS(elem, "borderTopWidth", true) );
1642
+ }
1643
+
1644
+ function add(l, t) {
1645
+ left += parseInt(l, 10) || 0;
1646
+ top += parseInt(t, 10) || 0;
1647
+ }
1648
+
1649
+ var parent = elem.parentNode,
1650
+ offsetChild = elem,
1651
+ offsetParent = elem.offsetParent,
1652
+ doc = elem.ownerDocument,
1653
+ safari2 = br.safari && parseInt(br.version,0) < 522 && !(/adobeair/i).test(br.userAgent),
1654
+ css = CQ.curCSS,
1655
+ fixed = CQ.css(elem, "position") == "fixed";
1656
+
1657
+ // Use getBoundingClientRect if available
1658
+ if (!(br.mozilla && elem==document.body) && elem.getBoundingClientRect){
1659
+ var box = elem.getBoundingClientRect();
1660
+
1661
+ // Add the document scroll offsets
1662
+ add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
1663
+ box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
1664
+
1665
+ // IE adds the HTML element's border, by default it is medium which is
1666
+ // 2px IE 6 and 7 quirks mode the border width is overwritable by the
1667
+ // following css html { border: 0; } IE 7 standards mode, the border is
1668
+ // always 2px This border/offset is typically represented by the
1669
+ // clientLeft and clientTop properties
1670
+ // However, in IE6 and 7 quirks mode the clientLeft and clientTop
1671
+ // properties are not updated when overwriting it via CSS
1672
+ // Therefore this method will be off by 2px in IE while in quirksmode
1673
+ add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
1674
+
1675
+ // Otherwise loop through the offsetParents and parentNodes
1676
+ } else {
1677
+
1678
+ // Initial element offsets
1679
+ add( elem.offsetLeft, elem.offsetTop );
1680
+
1681
+ // Get parent offsets
1682
+ while ( offsetParent ) {
1683
+ // Add offsetParent offsets
1684
+ add( offsetParent.offsetLeft, offsetParent.offsetTop );
1685
+
1686
+ // Mozilla and Safari > 2 does not include the border on offset parents
1687
+ // However Mozilla adds the border for table or table cells
1688
+ if ( br.mozilla && !(/^t(able|d|h)$/i).test(offsetParent.tagName) || br.safari && !safari2 ) border( offsetParent );
1689
+
1690
+ // Add the document scroll offsets if position is fixed on any
1691
+ // offsetParent
1692
+ if (!fixed && css(offsetParent, "position") == "fixed") fixed = true;
1693
+
1694
+ // Set offsetChild to previous offsetParent unless it is the body
1695
+ // element
1696
+ offsetChild = (/^body$/i).test(offsetParent.tagName) ? offsetChild : offsetParent;
1697
+ // Get next offsetParent
1698
+ offsetParent = offsetParent.offsetParent;
1699
+ }
1700
+
1701
+ // Get parent scroll offsets
1702
+ while ( parent && parent.tagName && !(/^body|html$/i).test(parent.tagName)) {
1703
+
1704
+ // Remove parent scroll UNLESS that parent is inline or a table to
1705
+ // work around Opera inline/table scrollLeft/Top bug
1706
+ if ( !(/^inline|table.*$/i).test(css(parent, "display")) ) {
1707
+ // Subtract parent scroll offsets
1708
+ add( -parent.scrollLeft, -parent.scrollTop );
1709
+ }
1710
+
1711
+ // Mozilla does not add the border for a parent that has overflow !=
1712
+ // visible
1713
+ if ( mozilla && css(parent, "overflow") != "visible" ) border(parent);
1714
+
1715
+ // Get next parent
1716
+ parent = parent.parentNode;
1717
+ }
1718
+
1719
+ // Safari <= 2 doubles body offsets with a fixed position
1720
+ // element/offsetParent or absolutely positioned offsetChild
1721
+ // Mozilla doubles body offsets with a non-absolutely positioned
1722
+ // offsetChild
1723
+ if ((safari2 && (fixed || css(offsetChild, "position") == "absolute"))||
1724
+ (br.mozilla && css(offsetChild, "position") != "absolute") ) {
1725
+ add( -doc.body.offsetLeft, -doc.body.offsetTop );
1726
+ }
1727
+
1728
+ // Add the document scroll offsets if position is fixed
1729
+ if ( fixed ) {
1730
+ add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
1731
+ Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
1732
+ }
1733
+ }
1734
+
1735
+ // Return an object with top and left properties
1736
+ results = { top: top, left: left };
1737
+
1738
+ return results;
1739
+ };
1740
+
1741
+ CoreQuery.fn.mixin({
1742
+ position: function() {
1743
+ var left = 0, top = 0, results;
1744
+
1745
+ if ( this[0] ) {
1746
+ // Get *real* offsetParent
1747
+ var offsetParent = this.offsetParent(),
1748
+
1749
+ // Get correct offsets
1750
+ offset = this.offset(),
1751
+ parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
1752
+
1753
+ // Subtract element margins
1754
+ // note: when an element has margin: auto the offsetLeft and marginLeft
1755
+ // are the same in Safari causing offset.left to incorrectly be 0
1756
+ offset.top -= num( this, 'marginTop' );
1757
+ offset.left -= num( this, 'marginLeft' );
1758
+
1759
+ // Add offsetParent borders
1760
+ parentOffset.top += num( offsetParent, 'borderTopWidth' );
1761
+ parentOffset.left += num( offsetParent, 'borderLeftWidth' );
1762
+
1763
+ // Subtract the two offsets
1764
+ results = {
1765
+ top: offset.top - parentOffset.top,
1766
+ left: offset.left - parentOffset.left
1767
+ };
1768
+ }
1769
+
1770
+ return results;
1771
+ },
1772
+
1773
+ offsetParent: function() {
1774
+ var offsetParent = this[0].offsetParent || document.body;
1775
+ while ( offsetParent && (!(/^body|html$/i).test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') ) {
1776
+ offsetParent = offsetParent.offsetParent;
1777
+ }
1778
+ return CQ(offsetParent);
1779
+ }
1780
+ }) ;
1781
+
1782
+
1783
+ // Create scrollLeft and scrollTop methods
1784
+ CQ.each( ['Left', 'Top'], function(i, name) {
1785
+ var method = 'scroll' + name;
1786
+
1787
+ CQ.fn[ method ] = function(val) {
1788
+ if (!this[0]) return;
1789
+
1790
+ return val != undefined ?
1791
+
1792
+ // Set the scroll offset
1793
+ this.each(function() {
1794
+ this == window || this == document ?
1795
+ window.scrollTo(
1796
+ !i ? val : CQ(window).scrollLeft(),
1797
+ i ? val : CQ(window).scrollTop()
1798
+ ) :
1799
+ this[ method ] = val;
1800
+ }) :
1801
+
1802
+ // Return the scroll offset
1803
+ this[0] == window || this[0] == document ?
1804
+ self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
1805
+ CQ.boxModel && document.documentElement[ method ] ||
1806
+ document.body[ method ] : this[0][ method ];
1807
+ };
1808
+ });
1809
+
1810
+
1811
+ return CoreQuery ;
1812
+ }()) ;
1813
+
1814
+ // Install CoreQuery or jQuery, depending on what is available, as SC.$().
1815
+ SC.$ = (typeof jQuery == "undefined") ? SC.CoreQuery : jQuery ;
1816
+
1817
+ // Add some plugins to CoreQuery. If jQuery is installed, it will get these
1818
+ // also. -- test in system/core_query/additions
1819
+ SC.mixin(SC.$.fn, /** @scope SC.CoreQuery.prototype */ {
1820
+
1821
+ isCoreQuery: YES, // walk like a duck
1822
+
1823
+ /** @private - better loggin */
1824
+ toString: function() {
1825
+ var values = [];
1826
+ var len = this.length, idx=0;
1827
+ for(idx=0;idx<len;idx++) {
1828
+ values[idx] = '%@: %@'.fmt(idx,(this[idx]) ? this[idx].toString() : '(null)');
1829
+ }
1830
+ return "<$:%@>(%@)".fmt(SC.guidFor(this),values.join(' , '));
1831
+ },
1832
+
1833
+ /**
1834
+ Returns YES if all member elements are visible. This is provided as a
1835
+ common test since CoreQuery does not support filtering by
1836
+ psuedo-selector.
1837
+ */
1838
+ isVisible: function() {
1839
+ return Array.prototype.every.call(this, function(elem){
1840
+ return SC.$.isVisible(elem);
1841
+ });
1842
+ },
1843
+
1844
+ /** Returns a new CQ object with only the first item in the object. */
1845
+ first: function() {
1846
+ return this.pushStack([this[0]]);
1847
+ },
1848
+
1849
+ /** Returns a new CQ object with only the last item in the set. */
1850
+ last: function() {
1851
+ return this.pushStack([this[this.length-1]]);
1852
+ },
1853
+
1854
+ /**
1855
+ Attempts to find the views managing the passed DOM elements and returns
1856
+ them. This will start with the matched element and walk up the DOM until
1857
+ it finds an element managed by a view.
1858
+
1859
+ @returns {Array} array of views or null.
1860
+ */
1861
+ view: function() {
1862
+ return this.map(function() {
1863
+ var ret=null, guidKey = SC.viewKey, dom = this, value;
1864
+ while(!ret && dom && (dom !== document)) {
1865
+ if (value = dom.getAttribute('id')) ret = SC.View.views[value] ;
1866
+ dom = dom.parentNode;
1867
+ }
1868
+ dom =null;
1869
+ return ret ;
1870
+ });
1871
+ },
1872
+
1873
+ /**
1874
+ You can either pass a single class name and a boolean indicating whether
1875
+ the value should be added or removed, or you can pass a hash with all
1876
+ the class names you want to add or remove with a boolean indicating
1877
+ whether they should be there or not.
1878
+
1879
+ This is far more efficient than using addClass/removeClass.
1880
+
1881
+ @param {String|Hash} className class name or hash of classNames + bools
1882
+ @param {Boolean} shouldAdd for class name if a string was passed
1883
+ @returns {SC.CoreQuery} receiver
1884
+ */
1885
+ setClass: function(className, shouldAdd) {
1886
+ if (SC.none(className)) return this; //nothing to do
1887
+ var isHash = SC.typeOf(className) !== SC.T_STRING ;
1888
+ var fix = this._fixupClass, key;
1889
+ this.each(function() {
1890
+ if (this.nodeType !== 1) return; // nothing to do
1891
+
1892
+ // collect the class name from the element and build an array
1893
+ var classNames = this.className.split(/\s+/), didChange = NO;
1894
+
1895
+ // loop through hash or just fix single className
1896
+ if (isHash) {
1897
+ for(var key in className) {
1898
+ if (!className.hasOwnProperty(key)) continue ;
1899
+ didChange = fix(classNames, key, className[key]) || didChange;
1900
+ }
1901
+ } else didChange = fix(classNames, className, shouldAdd);
1902
+
1903
+ // if classNames were changed, join them and set...
1904
+ if (didChange) this.className = classNames.join(' ');
1905
+ });
1906
+ return this ;
1907
+ },
1908
+
1909
+ /** @private used by setClass */
1910
+ _fixupClass: function(classNames, name, shouldAdd) {
1911
+ var indexOf = classNames.indexOf(name);
1912
+ // if should add, add class...
1913
+ if (shouldAdd) {
1914
+ if (indexOf < 0) { classNames.push(name); return YES ; }
1915
+
1916
+ // otherwise, null out class name (this will leave some extra spaces)
1917
+ } else if (indexOf >= 0) { classNames[indexOf]=null; return YES; }
1918
+ return NO ;
1919
+ },
1920
+
1921
+ /**
1922
+ Returns YES if any of the matched elements have the passed element or CQ object as a child element.
1923
+ */
1924
+ within: function(el) {
1925
+ el = SC.$(el); // make into CQ object
1926
+ var ret, elCur, myCur, idx, len = el.length;
1927
+ var loc = this.length;
1928
+ while(!ret && (--loc >= 0)) {
1929
+ myCur = this[loc];
1930
+ for(idx=0; !ret && (idx<len); idx++) {
1931
+ elCur = el[idx];
1932
+ while(elCur && (elCur !== myCur)) elCur = elCur.parentNode;
1933
+ ret = elCur === myCur ;
1934
+ }
1935
+ }
1936
+ myCur = elCur = null ; // clear memory
1937
+ return ret ;
1938
+ }
1939
+
1940
+ });
1941
+
1942
+ /**
1943
+ Make CoreQuery enumerable. Since some methods need to be disambiguated,
1944
+ we will implement some wrapper functions here.
1945
+
1946
+ Note that SC.Enumerable is implemented on SC.Builder, which means the
1947
+ CoreQuery object inherits this automatically. jQuery does not extend from
1948
+ SC.Builder though, so we reapply SC.Enumerable just to be safe.
1949
+ */
1950
+ (function() {
1951
+ var original = {};
1952
+
1953
+ var wrappers = {
1954
+
1955
+ // if you call find with a selector, then use the jQuery way. If you
1956
+ // call with a function/target, use Enumerable way
1957
+ find: function(callback,target) {
1958
+ return (target !== undefined) ? SC.Enumerable.find.call(this, callback, target) : original.find.call(this, callback) ;
1959
+ },
1960
+
1961
+ // ditto for filter - execute SC.Enumerable style if a target is passed.
1962
+ filter: function(callback,target) {
1963
+ return (target !== undefined) ?
1964
+ this.pushStack(SC.Enumerable.filter.call(this, callback, target)) :
1965
+ original.filter.call(this, callback) ;
1966
+ },
1967
+
1968
+ // filterProperty is an SC.Enumerable thing, but it needs to be wrapped
1969
+ // in a CoreQuery object.
1970
+ filterProperty: function(key, value) {
1971
+ return this.pushStack(
1972
+ SC.Enumerable.filterProperty.call(this,key,value));
1973
+ },
1974
+
1975
+ // indexOf() is best implemented using the jQuery index()
1976
+ indexOf: SC.$.index,
1977
+
1978
+ // map() is a little tricky because jQuery is non-standard. If you pass
1979
+ // a context object, we will treat it like SC.Enumerable. Otherwise use
1980
+ // jQuery.
1981
+ map: function(callback, target) {
1982
+ return (target !== undefined) ?
1983
+ SC.Enumerable.map.call(this, callback, target) :
1984
+ original.map.call(this, callback);
1985
+ }
1986
+ };
1987
+
1988
+ // loop through an update some enumerable methods. If this is CoreQuery,
1989
+ // we just need to patch up the wrapped methods. If this is jQuery, we
1990
+ // need to go through the entire set of SC.Enumerable.
1991
+ var isCoreQuery = SC.$.jquery === 'SC.CoreQuery';
1992
+ var fn = SC.$.fn, enumerable = isCoreQuery ? wrappers : SC.Enumerable ;
1993
+ for(var key in enumerable) {
1994
+ if (!enumerable.hasOwnProperty(key)) continue ;
1995
+ var value = enumerable[key];
1996
+ if (key in wrappers) {
1997
+ original[key] = fn[key]; value = wrappers[key];
1998
+ }
1999
+ fn[key] = value;
2000
+ }
2001
+ })();
2002
+
2003
+ // Add some global helper methods.
2004
+ SC.mixin(SC.$, {
2005
+
2006
+ /** @private helper method to determine if an element is visible. Exposed
2007
+ for use in testing. */
2008
+ isVisible: function(elem) {
2009
+ var CQ = SC.$;
2010
+ return ("hidden"!=elem.type) && (CQ.css(elem,"display")!="none") && (CQ.css(elem,"visibility")!="hidden");
2011
+ }
2012
+
2013
+ }) ;
2014
+
2015
+