sproutit-sproutcore 1.0.0.20090407205609 → 1.0.0.20090408130025

Sign up to get free protection for your applications and to get access to all the features.
Files changed (574) hide show
  1. data/frameworks/sproutcore/Buildfile +63 -0
  2. data/frameworks/sproutcore/HISTORY +682 -0
  3. data/frameworks/sproutcore/README +22 -0
  4. data/frameworks/sproutcore/apps/sc_jsdoc/controllers/docs.js +149 -0
  5. data/frameworks/sproutcore/apps/sc_jsdoc/core.js +16 -0
  6. data/frameworks/sproutcore/apps/sc_jsdoc/english.lproj/body.css +17 -0
  7. data/frameworks/sproutcore/apps/sc_jsdoc/english.lproj/body.js +99 -0
  8. data/frameworks/sproutcore/apps/sc_jsdoc/english.lproj/images/sproutcore-logo.png +0 -0
  9. data/frameworks/sproutcore/apps/sc_jsdoc/english.lproj/strings.js +15 -0
  10. data/frameworks/sproutcore/apps/sc_jsdoc/main.js +27 -0
  11. data/frameworks/sproutcore/apps/sc_jsdoc/models/doc.js +21 -0
  12. data/frameworks/sproutcore/apps/sc_qunit/controllers/runner.js +209 -0
  13. data/frameworks/sproutcore/apps/sc_qunit/core.js +16 -0
  14. data/frameworks/sproutcore/apps/sc_qunit/english.lproj/body.css +17 -0
  15. data/frameworks/sproutcore/apps/sc_qunit/english.lproj/body.js +107 -0
  16. data/frameworks/sproutcore/apps/sc_qunit/english.lproj/images/sproutcore-logo.png +0 -0
  17. data/frameworks/sproutcore/apps/sc_qunit/english.lproj/strings.js +15 -0
  18. data/frameworks/sproutcore/apps/sc_qunit/main.js +18 -0
  19. data/frameworks/sproutcore/apps/sc_qunit/models/test.js +24 -0
  20. data/frameworks/sproutcore/apps/sc_qunit/views/test_iframe.js +52 -0
  21. data/frameworks/sproutcore/apps/tests/controllers/targets.js +47 -0
  22. data/frameworks/sproutcore/apps/tests/controllers/test.js +20 -0
  23. data/frameworks/sproutcore/apps/tests/controllers/tests.js +38 -0
  24. data/frameworks/sproutcore/apps/tests/core.js +35 -0
  25. data/frameworks/sproutcore/apps/tests/english.lproj/loading.rhtml +9 -0
  26. data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +19 -0
  27. data/frameworks/sproutcore/apps/tests/english.lproj/main_page.js +86 -0
  28. data/frameworks/sproutcore/apps/tests/english.lproj/strings.js +17 -0
  29. data/frameworks/sproutcore/apps/tests/fixtures/target.js +43 -0
  30. data/frameworks/sproutcore/apps/tests/fixtures/test.js +43 -0
  31. data/frameworks/sproutcore/apps/tests/main.js +39 -0
  32. data/frameworks/sproutcore/apps/tests/models/target.js +49 -0
  33. data/frameworks/sproutcore/apps/tests/models/test.js +20 -0
  34. data/frameworks/sproutcore/apps/tests/tests/controllers/targets.js +15 -0
  35. data/frameworks/sproutcore/apps/tests/tests/controllers/test.js +15 -0
  36. data/frameworks/sproutcore/apps/tests/tests/controllers/tests.js +15 -0
  37. data/frameworks/sproutcore/apps/tests/tests/models/target.js +15 -0
  38. data/frameworks/sproutcore/apps/tests/tests/models/test.js +15 -0
  39. data/frameworks/sproutcore/apps/welcome/core.js +23 -0
  40. data/frameworks/sproutcore/apps/welcome/english.lproj/loading.rhtml +8 -0
  41. data/frameworks/sproutcore/apps/welcome/english.lproj/main_page.js +43 -0
  42. data/frameworks/sproutcore/apps/welcome/english.lproj/strings.js +15 -0
  43. data/frameworks/sproutcore/apps/welcome/main.js +36 -0
  44. data/frameworks/sproutcore/design/Design Charts.graffle +15819 -0
  45. data/frameworks/sproutcore/design/Record State Table.numbers +0 -0
  46. data/frameworks/sproutcore/frameworks/datastore/core.js +14 -0
  47. data/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +113 -0
  48. data/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +256 -0
  49. data/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +196 -0
  50. data/frameworks/sproutcore/frameworks/datastore/debug/json.js +71 -0
  51. data/frameworks/sproutcore/frameworks/datastore/debug/standard_setup.js +96 -0
  52. data/frameworks/sproutcore/frameworks/datastore/fixtures/author_fixtures.js +2503 -0
  53. data/frameworks/sproutcore/frameworks/datastore/fixtures/sample.js +17 -0
  54. data/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +92 -0
  55. data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +38 -0
  56. data/frameworks/sproutcore/frameworks/datastore/models/record.js +430 -0
  57. data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +361 -0
  58. data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +305 -0
  59. data/frameworks/sproutcore/frameworks/datastore/system/query.js +128 -0
  60. data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +149 -0
  61. data/frameworks/sproutcore/frameworks/datastore/system/store.js +1689 -0
  62. data/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +86 -0
  63. data/frameworks/sproutcore/frameworks/datastore/tests/integration/contact_model.js +114 -0
  64. data/frameworks/sproutcore/frameworks/datastore/tests/integration/mail_model.js +91 -0
  65. data/frameworks/sproutcore/frameworks/datastore/tests/integration/test_runner_model.js +56 -0
  66. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/destroy.js +73 -0
  67. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/readAttribute.js +48 -0
  68. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js +42 -0
  69. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/storeDidChangeProperties.js +138 -0
  70. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +46 -0
  71. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +71 -0
  72. data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +115 -0
  73. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +40 -0
  74. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChanges.js +116 -0
  75. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +135 -0
  76. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/dataHashDidChange.js +110 -0
  77. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/discardChanges.js +99 -0
  78. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readDataHash.js +180 -0
  79. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readEditableDataHash.js +126 -0
  80. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/removeDataHash.js +163 -0
  81. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +166 -0
  82. data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +175 -0
  83. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js +54 -0
  84. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +126 -0
  85. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +127 -0
  86. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +57 -0
  87. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +78 -0
  88. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +247 -0
  89. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +106 -0
  90. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +21 -0
  91. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushChanges.js +61 -0
  92. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/readDataHash.js +74 -0
  93. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/readEditableDataHash.js +74 -0
  94. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +74 -0
  95. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/removeDataHash.js +144 -0
  96. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/retrieveRecord.js +137 -0
  97. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/writeDataHash.js +130 -0
  98. data/frameworks/sproutcore/frameworks/debug/core.js +1 -0
  99. data/frameworks/sproutcore/frameworks/deprecated/core.js +61 -0
  100. data/frameworks/sproutcore/frameworks/deprecated/lib/button_views.rb +330 -0
  101. data/frameworks/sproutcore/frameworks/deprecated/lib/collection_view.rb +83 -0
  102. data/frameworks/sproutcore/frameworks/deprecated/lib/core_views.rb +326 -0
  103. data/frameworks/sproutcore/frameworks/deprecated/lib/form_views.rb +253 -0
  104. data/frameworks/sproutcore/frameworks/deprecated/lib/index.rhtml +75 -0
  105. data/frameworks/sproutcore/frameworks/deprecated/lib/menu_views.rb +93 -0
  106. data/frameworks/sproutcore/frameworks/deprecated/server/rails_server.js +80 -0
  107. data/frameworks/sproutcore/frameworks/deprecated/server/rest_server.js +178 -0
  108. data/frameworks/sproutcore/frameworks/deprecated/server/server.js +674 -0
  109. data/frameworks/sproutcore/frameworks/deprecated/system/animator.js +679 -0
  110. data/frameworks/sproutcore/frameworks/deprecated/system/binding.js +36 -0
  111. data/frameworks/sproutcore/frameworks/deprecated/system/browser.js +77 -0
  112. data/frameworks/sproutcore/frameworks/deprecated/system/classic_responder.js +314 -0
  113. data/frameworks/sproutcore/frameworks/deprecated/system/event.js +60 -0
  114. data/frameworks/sproutcore/frameworks/deprecated/system/globals.js +20 -0
  115. data/frameworks/sproutcore/frameworks/deprecated/system/misc.js +60 -0
  116. data/frameworks/sproutcore/frameworks/deprecated/system/node_descriptor.js +72 -0
  117. data/frameworks/sproutcore/frameworks/deprecated/system/object.js +124 -0
  118. data/frameworks/sproutcore/frameworks/deprecated/system/path_module.js +433 -0
  119. data/frameworks/sproutcore/frameworks/deprecated/system/string.js +109 -0
  120. data/frameworks/sproutcore/frameworks/deprecated/tests/application/application.rhtml +125 -0
  121. data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/clippingFrame.rhtml +401 -0
  122. data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/frame.rhtml +357 -0
  123. data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/isVisibleInWindow.rhtml +147 -0
  124. data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/base.rhtml +298 -0
  125. data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/incremental_rendering.rhtml +260 -0
  126. data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/source_list_rendering.rhtml +143 -0
  127. data/frameworks/sproutcore/frameworks/deprecated/tests/views/popup_button.rhtml +128 -0
  128. data/frameworks/sproutcore/frameworks/deprecated/tests/views/text_field.rhtml +37 -0
  129. data/frameworks/sproutcore/frameworks/deprecated/views/collection.js +24 -0
  130. data/frameworks/sproutcore/frameworks/designer/coders/design.js +30 -0
  131. data/frameworks/sproutcore/frameworks/designer/coders/localization.js +28 -0
  132. data/frameworks/sproutcore/frameworks/designer/coders/object.js +347 -0
  133. data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +102 -0
  134. data/frameworks/sproutcore/frameworks/designer/css/css_rule.js +22 -0
  135. data/frameworks/sproutcore/frameworks/designer/css/css_style.js +29 -0
  136. data/frameworks/sproutcore/frameworks/designer/css/css_style_sheet.js +201 -0
  137. data/frameworks/sproutcore/frameworks/designer/ext/page.js +88 -0
  138. data/frameworks/sproutcore/frameworks/designer/ext/view.js +40 -0
  139. data/frameworks/sproutcore/frameworks/designer/views/controls/button.js +18 -0
  140. data/frameworks/sproutcore/frameworks/designer/views/designer.js +553 -0
  141. data/frameworks/sproutcore/frameworks/designer/views/label.js +17 -0
  142. data/frameworks/sproutcore/frameworks/designer/views/mixins/button.js +13 -0
  143. data/frameworks/sproutcore/frameworks/designer/views/tab.js +17 -0
  144. data/frameworks/sproutcore/frameworks/desktop/core.js +6 -0
  145. data/frameworks/sproutcore/frameworks/desktop/debug/drag.js +41 -0
  146. data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +56 -0
  147. data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/a_sample_image.jpg +0 -0
  148. data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/apple-logo1.jpeg +0 -0
  149. data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/iframe.html +23 -0
  150. data/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +71 -0
  151. data/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +943 -0
  152. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/blank.gif +0 -0
  153. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_222222.png +0 -0
  154. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_454545.png +0 -0
  155. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_888888.png +0 -0
  156. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_ffffff.png +0 -0
  157. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
  158. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
  159. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/panels/sprite-x.png +0 -0
  160. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/panels/sprite-y.png +0 -0
  161. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
  162. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/000000.png +0 -0
  163. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/ffffff.png +0 -0
  164. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
  165. data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +156 -0
  166. data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +83 -0
  167. data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +99 -0
  168. data/frameworks/sproutcore/frameworks/desktop/english.lproj/palette.css +3 -0
  169. data/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +94 -0
  170. data/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +39 -0
  171. data/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +31 -0
  172. data/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +10 -0
  173. data/frameworks/sproutcore/frameworks/desktop/english.lproj/scroller.css +26 -0
  174. data/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +141 -0
  175. data/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +19 -0
  176. data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +57 -0
  177. data/frameworks/sproutcore/frameworks/desktop/english.lproj/split.css +70 -0
  178. data/frameworks/sproutcore/frameworks/desktop/english.lproj/split_divider.css +8 -0
  179. data/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +14 -0
  180. data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +12 -0
  181. data/frameworks/sproutcore/frameworks/desktop/english.lproj/text_field.css +29 -0
  182. data/frameworks/sproutcore/frameworks/desktop/english.lproj/toolbar.css +6 -0
  183. data/frameworks/sproutcore/frameworks/desktop/mixins/border.js +53 -0
  184. data/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +22 -0
  185. data/frameworks/sproutcore/frameworks/desktop/mixins/collection_item.js +22 -0
  186. data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +226 -0
  187. data/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +247 -0
  188. data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +377 -0
  189. data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +504 -0
  190. data/frameworks/sproutcore/frameworks/desktop/panes/modal.js +68 -0
  191. data/frameworks/sproutcore/frameworks/desktop/panes/palette.js +63 -0
  192. data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +184 -0
  193. data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +402 -0
  194. data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +46 -0
  195. data/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +39 -0
  196. data/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +81 -0
  197. data/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +175 -0
  198. data/frameworks/sproutcore/frameworks/desktop/protocols/responder.js +280 -0
  199. data/frameworks/sproutcore/frameworks/desktop/system/drag.js +721 -0
  200. data/frameworks/sproutcore/frameworks/desktop/system/key_bindings.js +40 -0
  201. data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +641 -0
  202. data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +187 -0
  203. data/frameworks/sproutcore/frameworks/desktop/tests/integration/dialog.js +43 -0
  204. data/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/methods.js +10 -0
  205. data/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +152 -0
  206. data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +10 -0
  207. data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +57 -0
  208. data/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/methods.js +10 -0
  209. data/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/ui.js +36 -0
  210. data/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +10 -0
  211. data/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +40 -0
  212. data/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +10 -0
  213. data/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +80 -0
  214. data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/methods.js +10 -0
  215. data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +38 -0
  216. data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +45 -0
  217. data/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +140 -0
  218. data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +145 -0
  219. data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +99 -0
  220. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/methods.js +10 -0
  221. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +39 -0
  222. data/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/methods.js +10 -0
  223. data/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +64 -0
  224. data/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +10 -0
  225. data/frameworks/sproutcore/frameworks/desktop/tests/views/grid/ui.js +10 -0
  226. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/methods.js +10 -0
  227. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui.js +110 -0
  228. data/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +255 -0
  229. data/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/methods.js +10 -0
  230. data/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js +44 -0
  231. data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/methods.js +128 -0
  232. data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +240 -0
  233. data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +113 -0
  234. data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +202 -0
  235. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +139 -0
  236. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +111 -0
  237. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +63 -0
  238. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/ui.js +70 -0
  239. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +94 -0
  240. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +206 -0
  241. data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +81 -0
  242. data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +85 -0
  243. data/frameworks/sproutcore/frameworks/desktop/tests/views/separator.js +37 -0
  244. data/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/methods.js +10 -0
  245. data/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/ui.js +10 -0
  246. data/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +50 -0
  247. data/frameworks/sproutcore/frameworks/desktop/tests/views/split/ui.js +52 -0
  248. data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +54 -0
  249. data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +88 -0
  250. data/frameworks/sproutcore/frameworks/desktop/tests/views/text_field/methods.js +76 -0
  251. data/frameworks/sproutcore/frameworks/desktop/tests/views/text_field/ui.js +198 -0
  252. data/frameworks/sproutcore/frameworks/desktop/tests/views/web/methods.js +10 -0
  253. data/frameworks/sproutcore/frameworks/desktop/tests/views/web/ui.js +110 -0
  254. data/frameworks/sproutcore/frameworks/desktop/views/button.js +320 -0
  255. data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +98 -0
  256. data/frameworks/sproutcore/frameworks/desktop/views/collection.js +2141 -0
  257. data/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +44 -0
  258. data/frameworks/sproutcore/frameworks/desktop/views/form.js +595 -0
  259. data/frameworks/sproutcore/frameworks/desktop/views/grid.js +199 -0
  260. data/frameworks/sproutcore/frameworks/desktop/views/list.js +706 -0
  261. data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +523 -0
  262. data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +437 -0
  263. data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +62 -0
  264. data/frameworks/sproutcore/frameworks/desktop/views/progress.js +207 -0
  265. data/frameworks/sproutcore/frameworks/desktop/views/radio.js +332 -0
  266. data/frameworks/sproutcore/frameworks/desktop/views/scene.js +56 -0
  267. data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +648 -0
  268. data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +203 -0
  269. data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +509 -0
  270. data/frameworks/sproutcore/frameworks/desktop/views/select_field.js +292 -0
  271. data/frameworks/sproutcore/frameworks/desktop/views/separator.js +37 -0
  272. data/frameworks/sproutcore/frameworks/desktop/views/slider.js +178 -0
  273. data/frameworks/sproutcore/frameworks/desktop/views/source_list.js +1117 -0
  274. data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +169 -0
  275. data/frameworks/sproutcore/frameworks/desktop/views/split.js +651 -0
  276. data/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +55 -0
  277. data/frameworks/sproutcore/frameworks/desktop/views/tab.js +190 -0
  278. data/frameworks/sproutcore/frameworks/desktop/views/text_field.js +233 -0
  279. data/frameworks/sproutcore/frameworks/desktop/views/thumb.js +49 -0
  280. data/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +49 -0
  281. data/frameworks/sproutcore/frameworks/desktop/views/web.js +86 -0
  282. data/frameworks/sproutcore/frameworks/foundation/TESTING +46 -0
  283. data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +490 -0
  284. data/frameworks/sproutcore/frameworks/foundation/controllers/controller.js +317 -0
  285. data/frameworks/sproutcore/frameworks/foundation/controllers/object.js +421 -0
  286. data/frameworks/sproutcore/frameworks/foundation/core.js +111 -0
  287. data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +172 -0
  288. data/frameworks/sproutcore/frameworks/foundation/english.lproj/blank.gif +0 -0
  289. data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +53 -0
  290. data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +55 -0
  291. data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +5 -0
  292. data/frameworks/sproutcore/frameworks/foundation/english.lproj/debug/control-test-pane.css +8 -0
  293. data/frameworks/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-logo.png +0 -0
  294. data/frameworks/sproutcore/frameworks/foundation/english.lproj/static_layout.css +5 -0
  295. data/frameworks/sproutcore/frameworks/foundation/english.lproj/view.css +40 -0
  296. data/frameworks/sproutcore/frameworks/foundation/ext/object.js +81 -0
  297. data/frameworks/sproutcore/frameworks/foundation/ext/run_loop.js +158 -0
  298. data/frameworks/sproutcore/frameworks/foundation/fixtures/file_exists.json +1 -0
  299. data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +291 -0
  300. data/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +88 -0
  301. data/frameworks/sproutcore/frameworks/foundation/mixins/control.js +352 -0
  302. data/frameworks/sproutcore/frameworks/foundation/mixins/editable.js +146 -0
  303. data/frameworks/sproutcore/frameworks/foundation/mixins/responder.js +156 -0
  304. data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +154 -0
  305. data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +101 -0
  306. data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +237 -0
  307. data/frameworks/sproutcore/frameworks/foundation/mixins/validatable.js +176 -0
  308. data/frameworks/sproutcore/frameworks/foundation/panes/main.js +47 -0
  309. data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +555 -0
  310. data/frameworks/sproutcore/frameworks/foundation/protocols/inline_editor_delegate.js +84 -0
  311. data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +244 -0
  312. data/frameworks/sproutcore/frameworks/foundation/system/browser.js +64 -0
  313. data/frameworks/sproutcore/frameworks/foundation/system/builder.js +210 -0
  314. data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +2015 -0
  315. data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +129 -0
  316. data/frameworks/sproutcore/frameworks/foundation/system/error.js +93 -0
  317. data/frameworks/sproutcore/frameworks/foundation/system/event.js +817 -0
  318. data/frameworks/sproutcore/frameworks/foundation/system/image_cache.js +433 -0
  319. data/frameworks/sproutcore/frameworks/foundation/system/json.js +440 -0
  320. data/frameworks/sproutcore/frameworks/foundation/system/locale.js +288 -0
  321. data/frameworks/sproutcore/frameworks/foundation/system/page.js +106 -0
  322. data/frameworks/sproutcore/frameworks/foundation/system/ready.js +189 -0
  323. data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +865 -0
  324. data/frameworks/sproutcore/frameworks/foundation/system/request.js +255 -0
  325. data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +368 -0
  326. data/frameworks/sproutcore/frameworks/foundation/system/routes.js +446 -0
  327. data/frameworks/sproutcore/frameworks/foundation/system/time.js +478 -0
  328. data/frameworks/sproutcore/frameworks/foundation/system/timer.js +549 -0
  329. data/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +158 -0
  330. data/frameworks/sproutcore/frameworks/foundation/system/utils.js +330 -0
  331. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array.js +118 -0
  332. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/controller.js +268 -0
  333. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object.js +433 -0
  334. data/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/methods.js +10 -0
  335. data/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/ui.js +113 -0
  336. data/frameworks/sproutcore/frameworks/foundation/tests/integration/creating_views.js +113 -0
  337. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/content.js +195 -0
  338. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/displayProperties.js +89 -0
  339. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/content.js +168 -0
  340. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/displayProperties.js +89 -0
  341. data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +42 -0
  342. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +1323 -0
  343. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_dimensions.js +387 -0
  344. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_selector.js +405 -0
  345. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js +49 -0
  346. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/within.js +66 -0
  347. data/frameworks/sproutcore/frameworks/foundation/tests/system/error.js +41 -0
  348. data/frameworks/sproutcore/frameworks/foundation/tests/system/json.js +14 -0
  349. data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +128 -0
  350. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js +47 -0
  351. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js +44 -0
  352. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/end.js +119 -0
  353. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/get.js +51 -0
  354. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js +50 -0
  355. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_basic.js +28 -0
  356. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_className.js +179 -0
  357. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_style.js +100 -0
  358. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/init.js +55 -0
  359. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/join.js +28 -0
  360. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/push_text.js +74 -0
  361. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +45 -0
  362. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/update.js +205 -0
  363. data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +89 -0
  364. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeKeyPane.js +124 -0
  365. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeMainPane.js +68 -0
  366. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/root_responder.js +97 -0
  367. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +238 -0
  368. data/frameworks/sproutcore/frameworks/foundation/tests/system/routes.js +33 -0
  369. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js +38 -0
  370. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invokeLater.js +201 -0
  371. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +71 -0
  372. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +67 -0
  373. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/schedule.js +170 -0
  374. data/frameworks/sproutcore/frameworks/foundation/tests/system/user_defaults.js +27 -0
  375. data/frameworks/sproutcore/frameworks/foundation/tests/system/utils/normalizeURL.js +18 -0
  376. data/frameworks/sproutcore/frameworks/foundation/tests/system/utils/range.js +62 -0
  377. data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +35 -0
  378. data/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js +21 -0
  379. data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +47 -0
  380. data/frameworks/sproutcore/frameworks/foundation/tests/validators/password.js +13 -0
  381. data/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +10 -0
  382. data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +83 -0
  383. data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +39 -0
  384. data/frameworks/sproutcore/frameworks/foundation/tests/views/main_pane.js +31 -0
  385. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +89 -0
  386. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/firstResponder.js +148 -0
  387. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/keyPane.js +133 -0
  388. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/sendEvent.js +165 -0
  389. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +132 -0
  390. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/convertFrames.js +246 -0
  391. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/createChildViews.js +87 -0
  392. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/createLayer.js +97 -0
  393. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +85 -0
  394. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +52 -0
  395. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/init.js +50 -0
  396. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +200 -0
  397. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisibleInWindow.js +102 -0
  398. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layer.js +150 -0
  399. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutChildViews.js +162 -0
  400. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutDidChange.js +127 -0
  401. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +248 -0
  402. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/parentViewDidChange.js +67 -0
  403. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/prepareContext.js +166 -0
  404. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/removeChild.js +189 -0
  405. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/render.js +83 -0
  406. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/replaceChild.js +29 -0
  407. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayer.js +142 -0
  408. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayerLocation.js +194 -0
  409. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/viewDidResize.js +185 -0
  410. data/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +125 -0
  411. data/frameworks/sproutcore/frameworks/foundation/validators/date.js +52 -0
  412. data/frameworks/sproutcore/frameworks/foundation/validators/email.js +45 -0
  413. data/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js +33 -0
  414. data/frameworks/sproutcore/frameworks/foundation/validators/number.js +82 -0
  415. data/frameworks/sproutcore/frameworks/foundation/validators/password.js +86 -0
  416. data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +311 -0
  417. data/frameworks/sproutcore/frameworks/foundation/views/container.js +136 -0
  418. data/frameworks/sproutcore/frameworks/foundation/views/field.js +276 -0
  419. data/frameworks/sproutcore/frameworks/foundation/views/image.js +158 -0
  420. data/frameworks/sproutcore/frameworks/foundation/views/label.js +261 -0
  421. data/frameworks/sproutcore/frameworks/foundation/views/view.js +2160 -0
  422. data/frameworks/sproutcore/frameworks/mobile/english.lproj/core.css +12 -0
  423. data/frameworks/sproutcore/frameworks/mobile/lib/index.rhtml +126 -0
  424. data/frameworks/sproutcore/frameworks/mobile/system/root_responder.js +109 -0
  425. data/frameworks/sproutcore/frameworks/mobile/tests/views/button/ui.js +9 -0
  426. data/frameworks/sproutcore/frameworks/mobile/views/button.js +190 -0
  427. data/frameworks/sproutcore/frameworks/runtime/README +11 -0
  428. data/frameworks/sproutcore/frameworks/runtime/core.js +777 -0
  429. data/frameworks/sproutcore/frameworks/runtime/license.js +28 -0
  430. data/frameworks/sproutcore/frameworks/runtime/mixins/array.js +403 -0
  431. data/frameworks/sproutcore/frameworks/runtime/mixins/delegate_support.js +70 -0
  432. data/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1193 -0
  433. data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1149 -0
  434. data/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +135 -0
  435. data/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +108 -0
  436. data/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +128 -0
  437. data/frameworks/sproutcore/frameworks/runtime/protocols/sparse_array_delegate.js +131 -0
  438. data/frameworks/sproutcore/frameworks/runtime/system/binding.js +891 -0
  439. data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +107 -0
  440. data/frameworks/sproutcore/frameworks/runtime/system/object.js +783 -0
  441. data/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +99 -0
  442. data/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +214 -0
  443. data/frameworks/sproutcore/frameworks/runtime/system/set.js +246 -0
  444. data/frameworks/sproutcore/frameworks/runtime/system/sparse_array.js +286 -0
  445. data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +56 -0
  446. data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +23 -0
  447. data/frameworks/sproutcore/frameworks/runtime/tests/core/clone.js +66 -0
  448. data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +147 -0
  449. data/frameworks/sproutcore/frameworks/runtime/tests/core/inspect.js +27 -0
  450. data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +25 -0
  451. data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +38 -0
  452. data/frameworks/sproutcore/frameworks/runtime/tests/core/keys.js +20 -0
  453. data/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +30 -0
  454. data/frameworks/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +19 -0
  455. data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +37 -0
  456. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable.js +592 -0
  457. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +467 -0
  458. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +123 -0
  459. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +79 -0
  460. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +80 -0
  461. data/frameworks/sproutcore/frameworks/runtime/tests/system/array.js +263 -0
  462. data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +190 -0
  463. data/frameworks/sproutcore/frameworks/runtime/tests/system/object/base.js +135 -0
  464. data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +339 -0
  465. data/frameworks/sproutcore/frameworks/runtime/tests/system/run_loop.js +120 -0
  466. data/frameworks/sproutcore/frameworks/runtime/tests/system/set.js +313 -0
  467. data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +84 -0
  468. data/frameworks/sproutcore/frameworks/testing/core.js +13 -0
  469. data/frameworks/sproutcore/frameworks/testing/english.lproj/additions.css +8 -0
  470. data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +131 -0
  471. data/frameworks/sproutcore/frameworks/testing/extras.js +43 -0
  472. data/frameworks/sproutcore/frameworks/testing/jquery.js +3559 -0
  473. data/frameworks/sproutcore/frameworks/testing/qunit.js +819 -0
  474. data/frameworks/sproutcore/frameworks/testing/tests/debug/qunit.js +25 -0
  475. data/frameworks/sproutcore/frameworks/testing/utils.js +55 -0
  476. data/frameworks/sproutcore/lib/index.rhtml +118 -0
  477. data/frameworks/sproutcore/license.js +28 -0
  478. data/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +69 -0
  479. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/button.css +41 -0
  480. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/core.css +8 -0
  481. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/backButton.png +0 -0
  482. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/blueButton.png +0 -0
  483. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/cancel.png +0 -0
  484. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/grayButton.png +0 -0
  485. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/leftButton.png +0 -0
  486. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrow.png +0 -0
  487. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrowSel.png +0 -0
  488. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listGroup.png +0 -0
  489. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/loading.gif +0 -0
  490. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/pinstripes.png +0 -0
  491. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/rightButton.png +0 -0
  492. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/selection.png +0 -0
  493. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/thumb.png +0 -0
  494. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggle.png +0 -0
  495. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggleOn.png +0 -0
  496. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolButton.png +0 -0
  497. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolbar.png +0 -0
  498. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/whiteButton.png +0 -0
  499. data/frameworks/sproutcore/themes/iphone_theme/english.lproj/strings.js +15 -0
  500. data/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/Data +0 -0
  501. data/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Preview.jpg +0 -0
  502. data/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Thumbnail.jpg +0 -0
  503. data/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/Data +0 -0
  504. data/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Preview.jpg +0 -0
  505. data/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Thumbnail.jpg +0 -0
  506. data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/Data +0 -0
  507. data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Preview.jpg +0 -0
  508. data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Thumbnail.jpg +0 -0
  509. data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/Data +0 -0
  510. data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Preview.jpg +0 -0
  511. data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Thumbnail.jpg +0 -0
  512. data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +333 -0
  513. data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +90 -0
  514. data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +53 -0
  515. data/frameworks/sproutcore/themes/standard_theme/english.lproj/core.css +47 -0
  516. data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +55 -0
  517. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
  518. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-ysprite.png +0 -0
  519. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-toolbar-view.png +0 -0
  520. data/frameworks/sproutcore/themes/standard_theme/english.lproj/label.css +37 -0
  521. data/frameworks/sproutcore/themes/standard_theme/english.lproj/pane.css +8 -0
  522. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-fat.jpg +0 -0
  523. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-thin.jpg +0 -0
  524. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-edge.png +0 -0
  525. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-left-corner.png +0 -0
  526. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-right-corner.png +0 -0
  527. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/left-edge.png +0 -0
  528. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/overlay.png +0 -0
  529. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/right-edge.png +0 -0
  530. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-edge.png +0 -0
  531. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-left-corner.png +0 -0
  532. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-right-corner.png +0 -0
  533. data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +23 -0
  534. data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +113 -0
  535. data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +141 -0
  536. data/frameworks/sproutcore/themes/standard_theme/english.lproj/slider.css +62 -0
  537. data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +27 -0
  538. data/frameworks/sproutcore/themes/standard_theme/english.lproj/tab.css +12 -0
  539. data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +13 -0
  540. data/frameworks/sproutcore/themes/standard_theme/english.lproj/toolbar.css +4 -0
  541. data/lib/thor/.autotest +7 -0
  542. data/lib/thor/CHANGELOG.rdoc +52 -0
  543. data/lib/thor/LICENSE +20 -0
  544. data/lib/thor/README.markdown +76 -0
  545. data/lib/thor/Rakefile +6 -0
  546. data/lib/thor/Thorfile +45 -0
  547. data/lib/thor/bin/rake2thor +83 -0
  548. data/lib/thor/bin/thor +7 -0
  549. data/lib/thor/lib/thor/error.rb +3 -0
  550. data/lib/thor/lib/thor/options.rb +267 -0
  551. data/lib/thor/lib/thor/ordered_hash.rb +64 -0
  552. data/lib/thor/lib/thor/runner.rb +305 -0
  553. data/lib/thor/lib/thor/task.rb +83 -0
  554. data/lib/thor/lib/thor/task_hash.rb +22 -0
  555. data/lib/thor/lib/thor/tasks/package.rb +18 -0
  556. data/lib/thor/lib/thor/tasks.rb +77 -0
  557. data/lib/thor/lib/thor/util.rb +75 -0
  558. data/lib/thor/lib/thor.rb +170 -0
  559. data/lib/thor/script/destroy +14 -0
  560. data/lib/thor/script/generate +14 -0
  561. data/lib/thor/spec/fixtures/task.thor +10 -0
  562. data/lib/thor/spec/options_spec.rb +271 -0
  563. data/lib/thor/spec/ordered_hash_spec.rb +84 -0
  564. data/lib/thor/spec/spec.opts +1 -0
  565. data/lib/thor/spec/spec_helper.rb +30 -0
  566. data/lib/thor/spec/task_spec.rb +11 -0
  567. data/lib/thor/spec/tasks_spec.rb +28 -0
  568. data/lib/thor/spec/thor_runner_spec.rb +194 -0
  569. data/lib/thor/spec/thor_spec.rb +206 -0
  570. data/lib/thor/spec/util_spec.rb +99 -0
  571. data/lib/thor/task.thor +15 -0
  572. data/lib/thor/thor.gemspec +29 -0
  573. metadata +3 -4
  574. data/sproutcore.gemspec +0 -47
@@ -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
+