Canvas.st 15 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. Smalltalk current createPackage: 'Canvas' properties: #{}!
  2. Object subclass: #HTMLCanvas
  3. instanceVariableNames: 'root'
  4. package: 'Canvas'!
  5. !HTMLCanvas methodsFor: 'accessing'!
  6. root
  7. ^root
  8. !
  9. root: aTagBrush
  10. root := aTagBrush
  11. !
  12. snippet: anElement
  13. "Adds clone of anElement, finds [data-snippet=""*""] subelement
  14. and returns TagBrush as if that subelement was just added.
  15. Rarely needed to use directly, use `html foo` dynamically installed method
  16. for a snippet named foo."
  17. | clone caret |
  18. clone := anElement asJQuery clone.
  19. self with: (TagBrush fromJQuery: clone canvas: self).
  20. caret := clone find: '[data-snippet="*"]'.
  21. caret toArray isEmpty ifTrue: [ caret := clone ].
  22. ^TagBrush fromJQuery: (caret removeAttr: 'data-snippet') canvas: self
  23. ! !
  24. !HTMLCanvas methodsFor: 'adding'!
  25. entity: aString
  26. "Adds a character representing html entity, eg.
  27. html entity: 'copy'
  28. adds a copyright sign.
  29. If a name does not represent valid HTML entity, error is raised."
  30. | result |
  31. result := ('<span />' asJQuery html: '&', aString, ';') text.
  32. result size = 1 ifFalse: [ self error: 'Not an HTML entity: ', aString ].
  33. self with: result
  34. !
  35. with: anObject
  36. ^self root with: anObject
  37. ! !
  38. !HTMLCanvas methodsFor: 'initialization'!
  39. initialize
  40. super initialize.
  41. root ifNil: [root := TagBrush fromString: 'div' canvas: self]
  42. !
  43. initializeFromJQuery: aJQuery
  44. root := TagBrush fromJQuery: aJQuery canvas: self
  45. ! !
  46. !HTMLCanvas methodsFor: 'tags'!
  47. a
  48. ^self tag: 'a'
  49. !
  50. abbr
  51. ^self tag: 'abbr'
  52. !
  53. address
  54. ^self tag: 'address'
  55. !
  56. area
  57. ^self tag: 'area'
  58. !
  59. article
  60. ^self tag: 'article'
  61. !
  62. aside
  63. ^self tag: 'aside'
  64. !
  65. audio
  66. ^self tag: 'audio'
  67. !
  68. base
  69. ^self tag: 'base'
  70. !
  71. blockquote
  72. ^self tag: 'blockquote'
  73. !
  74. body
  75. ^self tag: 'body'
  76. !
  77. br
  78. ^self tag: 'br'
  79. !
  80. button
  81. ^self tag: 'button'
  82. !
  83. canvas
  84. ^self tag: 'canvas'
  85. !
  86. caption
  87. ^self tag: 'caption'
  88. !
  89. cite
  90. ^self tag: 'cite'
  91. !
  92. code
  93. ^self tag: 'code'
  94. !
  95. col
  96. ^self tag: 'col'
  97. !
  98. colgroup
  99. ^self tag: 'colgroup'
  100. !
  101. command
  102. ^self tag: 'command'
  103. !
  104. datalist
  105. ^self tag: 'datalist'
  106. !
  107. dd
  108. ^self tag: 'dd'
  109. !
  110. del
  111. ^self tag: 'del'
  112. !
  113. details
  114. ^self tag: 'details'
  115. !
  116. div
  117. ^self tag: 'div'
  118. !
  119. div: aBlock
  120. ^self div with: aBlock
  121. !
  122. dl
  123. ^self tag: 'dl'
  124. !
  125. dt
  126. ^self tag: 'dt'
  127. !
  128. em
  129. ^self tag: 'em'
  130. !
  131. embed
  132. ^self tag: 'embed'
  133. !
  134. fieldset
  135. ^self tag: 'fieldset'
  136. !
  137. figcaption
  138. ^self tag: 'figcaption'
  139. !
  140. figure
  141. ^self tag: 'figure'
  142. !
  143. footer
  144. ^self tag: 'footer'
  145. !
  146. form
  147. ^self tag: 'form'
  148. !
  149. h1
  150. ^self tag: 'h1'
  151. !
  152. h1: anObject
  153. ^self h1 with: anObject
  154. !
  155. h2
  156. ^self tag: 'h2'
  157. !
  158. h2: anObject
  159. ^ self h2 with: anObject
  160. !
  161. h3
  162. ^self tag: 'h3'
  163. !
  164. h3: anObject
  165. ^self h3 with: anObject
  166. !
  167. h4
  168. ^self tag: 'h4'
  169. !
  170. h4: anObject
  171. ^self h4 with: anObject
  172. !
  173. h5
  174. ^self tag: 'h5'
  175. !
  176. h5: anObject
  177. ^self h5 with: anObject
  178. !
  179. h6
  180. ^self tag: 'h6'
  181. !
  182. h6: anObject
  183. ^self h6 with: anObject
  184. !
  185. head
  186. ^self tag: 'head'
  187. !
  188. header
  189. ^self tag: 'header'
  190. !
  191. hgroup
  192. ^self tag: 'hgroup'
  193. !
  194. hr
  195. ^self tag: 'hr'
  196. !
  197. html
  198. ^self tag: 'html'
  199. !
  200. iframe
  201. ^self tag: 'iframe'
  202. !
  203. iframe: aString
  204. ^self iframe src: aString
  205. !
  206. img
  207. ^self tag: 'img'
  208. !
  209. img: aString
  210. ^self img src: aString
  211. !
  212. input
  213. ^self tag: 'input'
  214. !
  215. label
  216. ^self tag: 'label'
  217. !
  218. legend
  219. ^self tag: 'legend'
  220. !
  221. li
  222. ^self tag: 'li'
  223. !
  224. li: anObject
  225. ^self li with: anObject
  226. !
  227. link
  228. ^self tag: 'link'
  229. !
  230. map
  231. ^self tag: 'map'
  232. !
  233. mark
  234. ^self tag: 'mark'
  235. !
  236. menu
  237. ^self tag: 'menu'
  238. !
  239. meta
  240. ^self tag: 'meta'
  241. !
  242. nav
  243. ^self tag: 'nav'
  244. !
  245. newTag: aString
  246. ^TagBrush fromString: aString canvas: self
  247. !
  248. noscript
  249. ^self tag: 'noscript'
  250. !
  251. object
  252. ^self tag: 'object'
  253. !
  254. ol
  255. ^self tag: 'ol'
  256. !
  257. ol: anObject
  258. ^self ol with: anObject
  259. !
  260. optgroup
  261. ^self tag: 'optgroup'
  262. !
  263. option
  264. ^self tag: 'option'
  265. !
  266. output
  267. ^self tag: 'output'
  268. !
  269. p
  270. ^self tag: 'p'
  271. !
  272. p: anObject
  273. ^self p with: anObject
  274. !
  275. param
  276. ^self tag: 'param'
  277. !
  278. pre
  279. ^self tag: 'pre'
  280. !
  281. progress
  282. ^self tag: 'progress'
  283. !
  284. script
  285. ^self tag: 'script'
  286. !
  287. section
  288. ^self tag: 'section'
  289. !
  290. select
  291. ^self tag: 'select'
  292. !
  293. small
  294. ^self tag: 'small'
  295. !
  296. source
  297. ^self tag: 'source'
  298. !
  299. span
  300. ^self tag: 'span'
  301. !
  302. span: anObject
  303. ^self span with: anObject
  304. !
  305. strong
  306. ^self tag: 'strong'
  307. !
  308. strong: anObject
  309. ^self strong with: anObject
  310. !
  311. style
  312. ^ root addBrush: (StyleTag canvas: self)
  313. !
  314. style: aString
  315. ^ self style with: aString; yourself
  316. !
  317. sub
  318. ^self tag: 'sub'
  319. !
  320. summary
  321. ^self tag: 'summary'
  322. !
  323. sup
  324. ^self tag: 'sup'
  325. !
  326. table
  327. ^self tag: 'table'
  328. !
  329. tag: aString
  330. ^root addBrush: (self newTag: aString)
  331. !
  332. tbody
  333. ^self tag: 'tbody'
  334. !
  335. td
  336. ^self tag: 'td'
  337. !
  338. textarea
  339. ^self tag: 'textarea'
  340. !
  341. tfoot
  342. ^self tag: 'tfoot'
  343. !
  344. th
  345. ^self tag: 'th'
  346. !
  347. thead
  348. ^self tag: 'thead'
  349. !
  350. time
  351. ^self tag: 'time'
  352. !
  353. title
  354. ^self tag: 'title'
  355. !
  356. tr
  357. ^self tag: 'tr'
  358. !
  359. ul
  360. ^self tag: 'ul'
  361. !
  362. ul: anObject
  363. ^self ul with: anObject
  364. !
  365. video
  366. ^self tag: 'video'
  367. ! !
  368. !HTMLCanvas class methodsFor: 'instance creation'!
  369. browserVersion
  370. ^(jQuery at: #browser) version
  371. !
  372. isMSIE
  373. ^((jQuery at: #browser) at: #msie) notNil
  374. !
  375. isMozilla
  376. ^((jQuery at: #browser) at: #mozilla) notNil
  377. !
  378. isOpera
  379. ^((jQuery at: #browser) at: #opera) notNil
  380. !
  381. isWebkit
  382. ^((jQuery at: #browser) at: #webkit) notNil
  383. !
  384. onJQuery: aJQuery
  385. ^self basicNew
  386. initializeFromJQuery: aJQuery;
  387. initialize;
  388. yourself
  389. ! !
  390. Object subclass: #HTMLSnippet
  391. instanceVariableNames: 'snippets'
  392. package: 'Canvas'!
  393. !HTMLSnippet commentStamp!
  394. HTMLSnippet instance is the registry of html snippets.
  395. HTMLSnippet current is the public singleton instance.
  396. At the beginning, it scans the document for any html elements
  397. with 'data-snippet="foo"' attribute and takes them off the document,
  398. remembering them in the store under the specified name.
  399. It also install method #foo into HTMLCanvas dynamically.
  400. Every html snippet should mark a 'caret', a place where contents
  401. can be inserted, by 'data-snippet="*"' (a special name for caret).
  402. For example:
  403. <li data-snippet='menuelement' class='...'><a data-snippet='*'></a></li>
  404. defines a list element with a link inside; the link itself is marked as a caret.
  405. You can later issue
  406. html menuelement href: '/foo'; with: 'A foo'
  407. to insert the whole snippet and directly manipulate the caret, so it renders:
  408. <li class='...'><a href='/foo'>A foo</a></li>
  409. For a self-careting tags (not very useful, but you do not need to fill class etc.
  410. you can use
  411. <div class='lots of classes' attr1='one' attr2='two' data-snippet='*bar'></div>
  412. and in code later do:
  413. html bar with: [ xxx ]
  414. to render
  415. <div class='lots of classes' attr1='one' attr2='two'>...added by xxx...</div>!
  416. !HTMLSnippet methodsFor: 'accessing'!
  417. snippetAt: aString
  418. ^ self snippets at: aString
  419. !
  420. snippets
  421. ^snippets ifNil: [ snippets := #{} ]
  422. ! !
  423. !HTMLSnippet methodsFor: 'initialization'!
  424. initializeFromJQuery: aJQuery
  425. "Finds and takes out all snippets out of aJQuery.
  426. Installs it into self."
  427. (self snippetsFromJQuery: aJQuery) do: [ :each |
  428. self installSnippetFromJQuery: each asJQuery ]
  429. ! !
  430. !HTMLSnippet methodsFor: 'method generation'!
  431. snippetAt: aString compile: anElement
  432. "Method generation for the snippet.
  433. The selector is aString, the method block uses anElement"
  434. ClassBuilder new
  435. installMethod: ([ :htmlReceiver | htmlReceiver snippet: anElement ]
  436. currySelf asCompiledMethod: aString)
  437. forClass: HTMLCanvas
  438. category: '**snippets'
  439. ! !
  440. !HTMLSnippet methodsFor: 'private'!
  441. snippetsFromJQuery: aJQuery
  442. ^ (aJQuery find: '[data-snippet]') toArray
  443. ! !
  444. !HTMLSnippet methodsFor: 'snippet installation'!
  445. installSnippetFromJQuery: element
  446. | name |
  447. name := element attr: 'data-snippet'.
  448. name = '*' ifFalse: [
  449. ('^\*' asRegexp test: name)
  450. ifTrue: [
  451. name := name allButFirst.
  452. element attr: 'data-snippet' put: '*' ]
  453. ifFalse: [
  454. element removeAttr: 'data-snippet' ].
  455. self snippetAt: name install: (element detach get: 0) ]
  456. !
  457. snippetAt: aString install: anElement
  458. self snippets at: aString put: anElement.
  459. self snippetAt: aString compile: anElement
  460. ! !
  461. HTMLSnippet class instanceVariableNames: 'current'!
  462. !HTMLSnippet class methodsFor: 'initialization'!
  463. ensureCurrent
  464. current ifNil: [
  465. current := super new
  466. initializeFromJQuery: document asJQuery;
  467. yourself ]
  468. !
  469. initialize
  470. super initialize.
  471. self isDOMAvailable ifTrue: [
  472. self ensureCurrent ]
  473. ! !
  474. !HTMLSnippet class methodsFor: 'instance creation'!
  475. current
  476. ^ current
  477. !
  478. isDOMAvailable
  479. < return typeof document !!== 'undefined' >
  480. !
  481. new
  482. self shouldNotImplement
  483. ! !
  484. Object subclass: #TagBrush
  485. instanceVariableNames: 'canvas element'
  486. package: 'Canvas'!
  487. !TagBrush methodsFor: 'accessing'!
  488. element
  489. ^element
  490. ! !
  491. !TagBrush methodsFor: 'adding'!
  492. addBrush: aTagBrush
  493. self appendChild: aTagBrush element.
  494. ^aTagBrush
  495. !
  496. append: anObject
  497. anObject appendToBrush: self
  498. !
  499. appendBlock: aBlock
  500. | root |
  501. root := canvas root.
  502. canvas root: self.
  503. aBlock value: canvas.
  504. canvas root: root
  505. !
  506. appendChild: anElement
  507. "In IE7 and IE8 appendChild fails on several node types. So we need to check"
  508. <var element=self['@element'];
  509. if (null == element.canHaveChildren || element.canHaveChildren) {
  510. element.appendChild(anElement);
  511. } else {
  512. element.text = String(element.text) + anElement.innerHTML;
  513. } >
  514. !
  515. appendString: aString
  516. self appendChild: (self createTextNodeFor: aString)
  517. !
  518. appendToBrush: aTagBrush
  519. aTagBrush addBrush: self
  520. !
  521. contents: anObject
  522. self
  523. empty;
  524. append: anObject
  525. !
  526. empty
  527. self asJQuery empty
  528. !
  529. with: anObject
  530. self append: anObject
  531. ! !
  532. !TagBrush methodsFor: 'attributes'!
  533. accesskey: aString
  534. self at: 'accesskey' put: aString
  535. !
  536. action: aString
  537. self at: 'action' put: aString
  538. !
  539. align: aString
  540. self at: 'align' put: aString
  541. !
  542. alt: aString
  543. self at: 'alt' put: aString
  544. !
  545. at: aString put: aValue
  546. <self['@element'].setAttribute(aString, aValue)>
  547. !
  548. class: aString
  549. <self['@element'].className = aString>
  550. !
  551. cols: aString
  552. self at: 'cols' put: aString
  553. !
  554. contenteditable: aString
  555. self at: 'contenteditable' put: aString
  556. !
  557. contextmenu: aString
  558. self at: 'contextmenu' put: aString
  559. !
  560. draggable: aString
  561. self at: 'draggable' put: aString
  562. !
  563. for: aString
  564. self at: 'for' put: aString
  565. !
  566. height: aString
  567. self at: 'height' put: aString
  568. !
  569. hidden
  570. self at: 'hidden' put: 'hidden'
  571. !
  572. href: aString
  573. self at: 'href' put: aString
  574. !
  575. id: aString
  576. self at: 'id' put: aString
  577. !
  578. media: aString
  579. self at: 'media' put: aString
  580. !
  581. method: aString
  582. self at: 'method' put: aString
  583. !
  584. name: aString
  585. self at: 'name' put: aString
  586. !
  587. placeholder: aString
  588. self at: 'placeholder' put: aString
  589. !
  590. rel: aString
  591. self at: 'rel' put: aString
  592. !
  593. removeAt: aString
  594. <self['@element'].removeAttribute(aString)>
  595. !
  596. rows: aString
  597. self at: 'rows' put: aString
  598. !
  599. src: aString
  600. self at: 'src' put: aString
  601. !
  602. style: aString
  603. self at: 'style' put: aString
  604. !
  605. tabindex: aNumber
  606. self at: 'tabindex' put: aNumber
  607. !
  608. target: aString
  609. self at: 'target' put: aString
  610. !
  611. title: aString
  612. self at: 'title' put: aString
  613. !
  614. type: aString
  615. self at: 'type' put: aString
  616. !
  617. valign: aString
  618. self at: 'valign' put: aString
  619. !
  620. value: aString
  621. self at: 'value' put: aString
  622. !
  623. width: aString
  624. self at: 'width' put: aString
  625. ! !
  626. !TagBrush methodsFor: 'converting'!
  627. asJQuery
  628. ^window jQuery: self element
  629. ! !
  630. !TagBrush methodsFor: 'events'!
  631. onBlur: aBlock
  632. self asJQuery bind: 'blur' do: aBlock
  633. !
  634. onChange: aBlock
  635. self asJQuery bind: 'change' do: aBlock
  636. !
  637. onClick: aBlock
  638. self asJQuery bind: 'click' do: aBlock
  639. !
  640. onDblClick: aBlock
  641. self asJQuery bind: 'dblclick' do: aBlock
  642. !
  643. onFocus: aBlock
  644. self asJQuery bind: 'focus' do: aBlock
  645. !
  646. onFocusIn: aBlock
  647. self asJQuery bind: 'focusin' do: aBlock
  648. !
  649. onFocusOut: aBlock
  650. self asJQuery bind: 'focusout' do: aBlock
  651. !
  652. onHover: aBlock
  653. self asJQuery bind: 'hover' do: aBlock
  654. !
  655. onKeyDown: aBlock
  656. self asJQuery bind: 'keydown' do: aBlock
  657. !
  658. onKeyPress: aBlock
  659. self asJQuery bind: 'keypress' do: aBlock
  660. !
  661. onKeyUp: aBlock
  662. self asJQuery bind: 'keyup' do: aBlock
  663. !
  664. onMouseDown: aBlock
  665. self asJQuery bind: 'mousedown' do: aBlock
  666. !
  667. onMouseEnter: aBlock
  668. self asJQuery bind: 'mouseenter' do: aBlock
  669. !
  670. onMouseLeave: aBlock
  671. self asJQuery bind: 'mouseleave' do: aBlock
  672. !
  673. onMouseMove: aBlock
  674. self asJQuery bind: 'mousemove' do: aBlock
  675. !
  676. onMouseOut: aBlock
  677. self asJQuery bind: 'mouseout' do: aBlock
  678. !
  679. onMouseOver: aBlock
  680. self asJQuery bind: 'mouseover' do: aBlock
  681. !
  682. onMouseUp: aBlock
  683. self asJQuery bind: 'mouseup' do: aBlock
  684. !
  685. onSelect: aBlock
  686. self asJQuery bind: 'select' do: aBlock
  687. !
  688. onSubmit: aBlock
  689. self asJQuery bind: 'submit' do: aBlock
  690. !
  691. onUnload: aBlock
  692. self asJQuery bind: 'unload' do: aBlock
  693. ! !
  694. !TagBrush methodsFor: 'initialization'!
  695. initializeFromJQuery: aJQuery canvas: aCanvas
  696. element := aJQuery get: 0.
  697. canvas := aCanvas
  698. !
  699. initializeFromString: aString canvas: aCanvas
  700. element := self createElementFor: aString.
  701. canvas := aCanvas
  702. ! !
  703. !TagBrush methodsFor: 'private'!
  704. createElementFor: aString
  705. <return document.createElement(String(aString))>
  706. !
  707. createTextNodeFor: aString
  708. <return document.createTextNode(String(aString))>
  709. ! !
  710. !TagBrush class methodsFor: 'instance creation'!
  711. fromJQuery: aJQuery canvas: aCanvas
  712. ^self new
  713. initializeFromJQuery: aJQuery canvas: aCanvas;
  714. yourself
  715. !
  716. fromString: aString canvas: aCanvas
  717. ^self new
  718. initializeFromString: aString canvas: aCanvas;
  719. yourself
  720. ! !
  721. TagBrush subclass: #StyleTag
  722. instanceVariableNames: 'canvas element'
  723. package: 'Canvas'!
  724. !StyleTag commentStamp!
  725. I'm a <style> tag use to inline CSS or load a stylesheet.
  726. For inlining handle IE compatibility problems.!
  727. !StyleTag methodsFor: 'adding'!
  728. with: aString
  729. HTMLCanvas isMSIE
  730. ifTrue: [self element styleSheet cssText: aString ]
  731. ifFalse: [super with: aString ].
  732. ! !
  733. !StyleTag class methodsFor: 'instance creation'!
  734. canvas: aCanvas
  735. ^self new
  736. initializeFromString: 'style' canvas: aCanvas;
  737. yourself
  738. ! !
  739. Object subclass: #Widget
  740. instanceVariableNames: ''
  741. package: 'Canvas'!
  742. !Widget methodsFor: 'adding'!
  743. appendToBrush: aTagBrush
  744. self appendToJQuery: aTagBrush asJQuery
  745. !
  746. appendToJQuery: aJQuery
  747. self renderOn: (HTMLCanvas onJQuery: aJQuery)
  748. ! !
  749. !Widget methodsFor: 'rendering'!
  750. renderOn: html
  751. self
  752. ! !
  753. !Object methodsFor: '*Canvas'!
  754. appendToBrush: aTagBrush
  755. aTagBrush append: self asString
  756. !
  757. appendToJQuery: aJQuery
  758. aJQuery append: self asString
  759. ! !
  760. !BlockClosure methodsFor: '*Canvas'!
  761. appendToBrush: aTagBrush
  762. aTagBrush appendBlock: self
  763. !
  764. appendToJQuery: aJQuery
  765. self value: (HTMLCanvas onJQuery: aJQuery)
  766. ! !
  767. !CharacterArray methodsFor: '*Canvas'!
  768. asSnippet
  769. ^ HTMLSnippet current snippetAt: self asString
  770. ! !
  771. !String methodsFor: '*Canvas'!
  772. appendToBrush: aTagBrush
  773. aTagBrush appendString: self
  774. !
  775. appendToJQuery: aJQuery
  776. aJQuery append: self
  777. !
  778. asJQuery
  779. <return jQuery(String(self))>
  780. ! !
  781. !JSObjectProxy methodsFor: '*Canvas'!
  782. asJQuery
  783. <return jQuery(self['@jsObject'])>
  784. ! !