8
0

upcastwriter.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. import DocumentFragment from '../../src/view/documentfragment';
  6. import Element from '../../src/view/element';
  7. import Text from '../../src/view/text';
  8. import UpcastWriter from '../../src/view/upcastwriter';
  9. import HtmlDataProcessor from '../../src/dataprocessor/htmldataprocessor';
  10. import ViewPosition from '../../src/view/position';
  11. import ViewRange from '../../src/view/range';
  12. import ViewSelection from '../../src/view/selection';
  13. describe( 'UpcastWriter', () => {
  14. let writer, view, dataprocessor;
  15. before( () => {
  16. writer = new UpcastWriter();
  17. dataprocessor = new HtmlDataProcessor();
  18. } );
  19. beforeEach( () => {
  20. const html = '' +
  21. '<h1 style="color:blue;position:fixed;">Heading <strong>1</strong></h1>' +
  22. '<p class="foo1 bar2" style="text-align:left;" data-attr="abc">Foo <i>Bar</i> <strong>Bold</strong></p>' +
  23. '<p><u>Some underlined</u> text</p>' +
  24. '<ul>' +
  25. '<li class="single">Item 1</li>' +
  26. '<li><span>Item <s>1</s></span></li>' +
  27. '<li><h2>Item 1</h2></li>' +
  28. '</ul>';
  29. view = dataprocessor.toView( html );
  30. } );
  31. describe( 'is()', () => {
  32. it( 'should return true for "upcastWriter"', () => {
  33. expect( writer.is( 'upcastWriter' ) ).to.be.true;
  34. expect( writer.is( 'view:upcastWriter' ) ).to.be.true;
  35. } );
  36. it( 'should return false for other accept values', () => {
  37. expect( writer.is( 'rootElement' ) ).to.be.false;
  38. expect( writer.is( 'containerElement' ) ).to.be.false;
  39. expect( writer.is( 'element' ) ).to.be.false;
  40. expect( writer.is( 'p' ) ).to.be.false;
  41. expect( writer.is( 'text' ) ).to.be.false;
  42. expect( writer.is( 'textProxy' ) ).to.be.false;
  43. expect( writer.is( 'attributeElement' ) ).to.be.false;
  44. expect( writer.is( 'uiElement' ) ).to.be.false;
  45. expect( writer.is( 'emptyElement' ) ).to.be.false;
  46. expect( writer.is( 'documentFragment' ) ).to.be.false;
  47. expect( writer.is( 'model:renderer' ) ).to.be.false;
  48. } );
  49. } );
  50. describe( 'createDocumentFragment', () => {
  51. it( 'should create empty document fragment', () => {
  52. const df = writer.createDocumentFragment();
  53. expect( df ).to.instanceOf( DocumentFragment );
  54. expect( df.childCount ).to.equal( 0 );
  55. } );
  56. it( 'should create document fragment with children', () => {
  57. const df = writer.createDocumentFragment( [ view.getChild( 0 ), view.getChild( 1 ) ] );
  58. expect( df ).to.instanceOf( DocumentFragment );
  59. expect( df.childCount ).to.equal( 2 );
  60. } );
  61. } );
  62. describe( 'createElement', () => {
  63. it( 'should create empty element', () => {
  64. const el = writer.createElement( 'p' );
  65. expect( el ).to.instanceOf( Element );
  66. expect( el.name ).to.equal( 'p' );
  67. expect( Array.from( el.getAttributes() ).length ).to.equal( 0 );
  68. expect( el.childCount ).to.equal( 0 );
  69. } );
  70. it( 'should create element with attributes', () => {
  71. const el = writer.createElement( 'a', { 'class': 'editor', 'contentEditable': 'true' } );
  72. expect( el ).to.instanceOf( Element );
  73. expect( el.name ).to.equal( 'a' );
  74. expect( Array.from( el.getAttributes() ).length ).to.equal( 2 );
  75. expect( el.childCount ).to.equal( 0 );
  76. } );
  77. it( 'should create element with children', () => {
  78. const el = writer.createElement( 'div', null, [ view.getChild( 0 ) ] );
  79. expect( el ).to.instanceOf( Element );
  80. expect( el.name ).to.equal( 'div' );
  81. expect( Array.from( el.getAttributes() ).length ).to.equal( 0 );
  82. expect( el.childCount ).to.equal( 1 );
  83. } );
  84. it( 'should create element with attributes and children', () => {
  85. const el = writer.createElement( 'blockquote',
  86. { 'class': 'editor', 'contentEditable': 'true' },
  87. view.getChild( 2 ) );
  88. expect( el ).to.instanceOf( Element );
  89. expect( el.name ).to.equal( 'blockquote' );
  90. expect( Array.from( el.getAttributes() ).length ).to.equal( 2 );
  91. expect( el.childCount ).to.equal( 1 );
  92. } );
  93. } );
  94. describe( 'createText', () => {
  95. it( 'should create text', () => {
  96. const text = writer.createText( 'FooBar' );
  97. expect( text ).to.instanceOf( Text );
  98. expect( text.data ).to.equal( 'FooBar' );
  99. } );
  100. } );
  101. describe( 'clone', () => {
  102. it( 'should clone simple element', () => {
  103. const el = view.getChild( 0 );
  104. const clone = writer.clone( el );
  105. expect( clone ).to.not.equal( el );
  106. expect( clone.isSimilar( el ) ).to.true;
  107. expect( clone.childCount ).to.equal( 0 );
  108. } );
  109. it( 'should clone element with all attributes', () => {
  110. const el = view.getChild( 1 );
  111. const clone = writer.clone( el );
  112. expect( clone ).to.not.equal( el );
  113. expect( clone.isSimilar( el ) ).to.true;
  114. expect( clone.childCount ).to.equal( 0 );
  115. } );
  116. it( 'should deep clone element', () => {
  117. const el = view.getChild( 0 );
  118. const clone = writer.clone( el, true );
  119. expect( clone ).to.not.equal( el );
  120. expect( clone.isSimilar( el ) ).to.true;
  121. expect( clone.childCount ).to.equal( el.childCount );
  122. } );
  123. } );
  124. describe( 'appendChild', () => {
  125. it( 'should append inline child to paragraph', () => {
  126. const el = view.getChild( 2 );
  127. const newChild = new Element( 'span' );
  128. const appended = writer.appendChild( newChild, el );
  129. expect( appended ).to.equal( 1 );
  130. expect( newChild.parent ).to.equal( el );
  131. expect( el.childCount ).to.equal( 3 );
  132. } );
  133. it( 'should append block children to paragraph', () => {
  134. const el = view.getChild( 2 );
  135. const newChild1 = new Element( 'p' );
  136. const newChild2 = new Element( 'h2' );
  137. const appended = writer.appendChild( [ newChild1, newChild2 ], el );
  138. expect( appended ).to.equal( 2 );
  139. expect( newChild1.parent ).to.equal( el );
  140. expect( newChild2.parent ).to.equal( el );
  141. expect( el.childCount ).to.equal( 4 );
  142. } );
  143. it( 'should append list item to the list', () => {
  144. const el = view.getChild( 3 );
  145. const newChild = new Element( 'li' );
  146. const appended = writer.appendChild( newChild, el );
  147. expect( appended ).to.equal( 1 );
  148. expect( newChild.parent ).to.equal( el );
  149. expect( el.childCount ).to.equal( 4 );
  150. } );
  151. it( 'should append element to DocumentFragment element', () => {
  152. const newChild = new Element( 'p' );
  153. const appended = writer.appendChild( newChild, view );
  154. expect( appended ).to.equal( 1 );
  155. expect( newChild.parent ).to.equal( view );
  156. expect( view.childCount ).to.equal( 5 );
  157. } );
  158. } );
  159. describe( 'insertChild', () => {
  160. it( 'should insert inline child into the paragraph on the first position', () => {
  161. const el = view.getChild( 2 );
  162. const newChild = new Element( 'span' );
  163. const inserted = writer.insertChild( 0, newChild, el );
  164. expect( inserted ).to.equal( 1 );
  165. expect( newChild.parent ).to.equal( el );
  166. expect( el.getChild( 0 ) ).to.equal( newChild );
  167. expect( el.childCount ).to.equal( 3 );
  168. } );
  169. it( 'should insert block children into the paragraph on the last position', () => {
  170. const el = view.getChild( 2 );
  171. const newChild1 = new Element( 'blockquote' );
  172. const newChild2 = new Element( 'h2' );
  173. const inserted = writer.insertChild( 2, [ newChild1, newChild2 ], el );
  174. expect( inserted ).to.equal( 2 );
  175. expect( newChild1.parent ).to.equal( el );
  176. expect( newChild2.parent ).to.equal( el );
  177. expect( el.getChild( 2 ) ).to.equal( newChild1 );
  178. expect( el.getChild( 3 ) ).to.equal( newChild2 );
  179. expect( el.childCount ).to.equal( 4 );
  180. } );
  181. it( 'should insert list item into the list element', () => {
  182. const el = view.getChild( 3 );
  183. const newChild = new Element( 'li' );
  184. const inserted = writer.insertChild( 1, newChild, el );
  185. expect( inserted ).to.equal( 1 );
  186. expect( newChild.parent ).to.equal( el );
  187. expect( el.getChild( 1 ) ).to.equal( newChild );
  188. expect( el.childCount ).to.equal( 4 );
  189. } );
  190. it( 'should insert element to DocumentFragment element', () => {
  191. const newChild = new Element( 'p' );
  192. const inserted = writer.insertChild( 4, newChild, view );
  193. expect( inserted ).to.equal( 1 );
  194. expect( newChild.parent ).to.equal( view );
  195. expect( view.getChild( 4 ) ).to.equal( newChild );
  196. expect( view.childCount ).to.equal( 5 );
  197. } );
  198. } );
  199. describe( 'removeChildren', () => {
  200. it( 'should remove child from the beginning of the paragraph', () => {
  201. const el = view.getChild( 1 );
  202. const toRemove = el.getChild( 0 );
  203. const removed = writer.removeChildren( 0, 1, el );
  204. expect( removed.length ).to.equal( 1 );
  205. expect( removed[ 0 ] ).to.equal( toRemove );
  206. expect( el.childCount ).to.equal( 3 );
  207. } );
  208. it( 'should remove two last list items from the list element', () => {
  209. const el = view.getChild( 3 );
  210. const toRemove1 = el.getChild( 1 );
  211. const toRemove2 = el.getChild( 2 );
  212. const removed = writer.removeChildren( 1, 2, el );
  213. expect( removed.length ).to.equal( 2 );
  214. expect( removed[ 0 ] ).to.equal( toRemove1 );
  215. expect( removed[ 1 ] ).to.equal( toRemove2 );
  216. expect( el.childCount ).to.equal( 1 );
  217. } );
  218. it( 'should remove child from DocumentFragment element', () => {
  219. const toRemove = view.getChild( 2 );
  220. const removed = writer.removeChildren( 2, 1, view );
  221. expect( removed.length ).to.equal( 1 );
  222. expect( removed[ 0 ] ).to.equal( toRemove );
  223. expect( view.childCount ).to.equal( 3 );
  224. } );
  225. } );
  226. describe( 'remove', () => {
  227. it( 'should remove list item from the list element', () => {
  228. const toRemove = view.getChild( 3 ).getChild( 1 );
  229. const removed = writer.remove( toRemove );
  230. expect( removed.length ).to.equal( 1 );
  231. expect( removed[ 0 ] ).to.equal( toRemove );
  232. expect( view.getChild( 3 ).childCount ).to.equal( 2 );
  233. } );
  234. it( 'should have no effect on detached elements', () => {
  235. const newChild = new Element( 'h2' );
  236. const removed = writer.remove( newChild );
  237. expect( removed.length ).to.equal( 0 );
  238. expect( view.childCount ).to.equal( 4 );
  239. } );
  240. it( 'should remove direct root (DocumentFragment) child', () => {
  241. const toRemove = view.getChild( 3 );
  242. const removed = writer.remove( toRemove );
  243. expect( removed.length ).to.equal( 1 );
  244. expect( removed[ 0 ] ).to.equal( toRemove );
  245. expect( view.childCount ).to.equal( 3 );
  246. } );
  247. } );
  248. describe( 'replace', () => {
  249. it( 'should replace single element', () => {
  250. const el = view.getChild( 0 ).getChild( 1 );
  251. const newChild = new Element( 'span' );
  252. const replacement = writer.replace( el, newChild );
  253. expect( replacement ).to.true;
  254. expect( view.getChild( 0 ).getChild( 1 ) ).to.equal( newChild );
  255. expect( view.getChild( 0 ).childCount ).to.equal( 2 );
  256. } );
  257. it( 'should replace element with children', () => {
  258. const el = view.getChild( 3 );
  259. const newChild = new Element( 'ol' );
  260. const replacement = writer.replace( el, newChild );
  261. expect( replacement ).to.true;
  262. expect( view.getChild( 3 ) ).to.equal( newChild );
  263. expect( view.childCount ).to.equal( 4 );
  264. } );
  265. it( 'should have no effect on detached elements', () => {
  266. const oldChild = new Element( 'h2' );
  267. const newChild = new Element( 'h2' );
  268. const replacement = writer.replace( oldChild, newChild );
  269. expect( replacement ).to.false;
  270. expect( view.childCount ).to.equal( 4 );
  271. } );
  272. } );
  273. describe( 'rename', () => {
  274. it( 'should rename simple element', () => {
  275. const el = view.getChild( 0 ).getChild( 1 );
  276. const renamed = writer.rename( 'i', el );
  277. expect( renamed ).to.not.equal( el );
  278. expect( renamed ).to.equal( view.getChild( 0 ).getChild( 1 ) );
  279. expect( renamed.name ).to.equal( 'i' );
  280. expect( view.getChild( 0 ).childCount ).to.equal( 2 );
  281. } );
  282. it( 'should rename direct root (DocumentFragment) child element', () => {
  283. const el = view.getChild( 1 );
  284. const renamed = writer.rename( 'h3', el );
  285. expect( renamed ).to.not.equal( el );
  286. expect( renamed ).to.equal( view.getChild( 1 ) );
  287. expect( renamed.name ).to.equal( 'h3' );
  288. expect( view.childCount ).to.equal( 4 );
  289. } );
  290. it( 'should have no effect on detached element', () => {
  291. const el = new Element( 'h2' );
  292. const renamed = writer.rename( 'h3', el );
  293. expect( renamed ).to.null;
  294. expect( view.childCount ).to.equal( 4 );
  295. } );
  296. } );
  297. describe( 'setAttribute', () => {
  298. it( 'should add new attribute', () => {
  299. const el = view.getChild( 0 );
  300. writer.setAttribute( 'testAttr', 'testVal', el );
  301. expect( el.getAttribute( 'testAttr' ) ).to.equal( 'testVal' );
  302. } );
  303. it( 'should update existing attribute', () => {
  304. const el = view.getChild( 1 );
  305. writer.setAttribute( 'data-attr', 'foo', el );
  306. expect( el.getAttribute( 'data-attr' ) ).to.equal( 'foo' );
  307. } );
  308. } );
  309. describe( 'removeAttribute', () => {
  310. it( 'should remove existing attribute', () => {
  311. const el = view.getChild( 1 );
  312. writer.removeAttribute( 'data-attr', el );
  313. expect( el.hasAttribute( 'data-attr' ) ).to.false;
  314. } );
  315. it( 'should have no effect if attribute does not exists', () => {
  316. const el = view.getChild( 0 );
  317. writer.removeAttribute( 'non-existent', el );
  318. expect( el.hasAttribute( 'non-existent' ) ).to.false;
  319. } );
  320. } );
  321. describe( 'addClass', () => {
  322. it( 'should add new classes if no classes', () => {
  323. const el = view.getChild( 2 );
  324. writer.addClass( [ 'foo', 'bar' ], el );
  325. expect( el.hasClass( 'foo' ) ).to.true;
  326. expect( el.hasClass( 'bar' ) ).to.true;
  327. expect( Array.from( el.getClassNames() ).length ).to.equal( 2 );
  328. } );
  329. it( 'should add new class to existing classes', () => {
  330. const el = view.getChild( 1 );
  331. writer.addClass( 'newClass', el );
  332. expect( el.hasClass( 'newClass' ) ).to.true;
  333. expect( Array.from( el.getClassNames() ).length ).to.equal( 3 );
  334. } );
  335. } );
  336. describe( 'removeClass', () => {
  337. it( 'should remove existing class', () => {
  338. const el = view.getChild( 3 ).getChild( 0 );
  339. writer.removeClass( 'single', el );
  340. expect( el.hasClass( 'single' ) ).to.false;
  341. expect( Array.from( el.getClassNames() ).length ).to.equal( 0 );
  342. } );
  343. it( 'should remove existing class from many classes', () => {
  344. const el = view.getChild( 1 );
  345. writer.removeClass( 'foo1', el );
  346. expect( el.hasClass( 'foo1' ) ).to.false;
  347. expect( el.hasClass( 'bar2' ) ).to.true;
  348. expect( Array.from( el.getClassNames() ).length ).to.equal( 1 );
  349. } );
  350. it( 'should have no effect if there are no classes', () => {
  351. const el = view.getChild( 0 );
  352. writer.removeClass( 'non-existent', el );
  353. expect( el.hasClass( 'non-existent' ) ).to.false;
  354. expect( Array.from( el.getClassNames() ).length ).to.equal( 0 );
  355. } );
  356. } );
  357. describe( 'setStyle', () => {
  358. it( 'should add new style', () => {
  359. const el = view.getChild( 2 );
  360. writer.setStyle( {
  361. color: 'red',
  362. position: 'fixed'
  363. }, el );
  364. expect( el.getStyle( 'color' ) ).to.equal( 'red' );
  365. expect( el.getStyle( 'position' ) ).to.equal( 'fixed' );
  366. expect( Array.from( el.getStyleNames() ).length ).to.equal( 2 );
  367. } );
  368. it( 'should update existing styles', () => {
  369. const el = view.getChild( 1 );
  370. writer.setStyle( 'text-align', 'center', el );
  371. expect( el.getStyle( 'text-align' ) ).to.equal( 'center' );
  372. expect( Array.from( el.getStyleNames() ).length ).to.equal( 1 );
  373. } );
  374. } );
  375. describe( 'removeStyle', () => {
  376. it( 'should remove existing style', () => {
  377. const el = view.getChild( 0 );
  378. writer.removeStyle( [ 'color', 'position' ], el );
  379. expect( el.hasStyle( 'color' ) ).to.false;
  380. expect( el.hasStyle( 'position' ) ).to.false;
  381. expect( Array.from( el.getStyleNames() ).length ).to.equal( 0 );
  382. } );
  383. it( 'should remove value from existing styles', () => {
  384. const el = view.getChild( 0 );
  385. writer.removeStyle( 'position', el );
  386. expect( el.hasStyle( 'color' ) ).to.true;
  387. expect( el.hasStyle( 'position' ) ).to.false;
  388. expect( Array.from( el.getStyleNames() ).length ).to.equal( 1 );
  389. } );
  390. it( 'should have no effect if styles does not exists', () => {
  391. const el = view.getChild( 2 );
  392. writer.removeStyle( [ 'color', 'position' ], el );
  393. expect( el.hasStyle( 'color' ) ).to.false;
  394. expect( el.hasStyle( 'position' ) ).to.false;
  395. expect( Array.from( el.getStyleNames() ).length ).to.equal( 0 );
  396. } );
  397. } );
  398. describe( 'setCustomProperty', () => {
  399. it( 'should add or update custom property', () => {
  400. const el = new Element( 'span' );
  401. writer.setCustomProperty( 'prop1', 'foo', el );
  402. writer.setCustomProperty( 'prop2', 'bar', el );
  403. expect( el.getCustomProperty( 'prop1' ) ).to.equal( 'foo' );
  404. expect( el.getCustomProperty( 'prop2' ) ).to.equal( 'bar' );
  405. expect( Array.from( el.getCustomProperties() ).length ).to.equal( 2 );
  406. const objectProperty = { foo: 'bar' };
  407. writer.setCustomProperty( 'prop2', objectProperty, el );
  408. expect( el.getCustomProperty( 'prop1' ) ).to.equal( 'foo' );
  409. expect( el.getCustomProperty( 'prop2' ) ).to.equal( objectProperty );
  410. expect( Array.from( el.getCustomProperties() ).length ).to.equal( 2 );
  411. } );
  412. } );
  413. describe( 'removeCustomProperty', () => {
  414. it( 'should remove existing custom property', () => {
  415. const el = new Element( 'p' );
  416. writer.setCustomProperty( 'prop1', 'foo', el );
  417. expect( el.getCustomProperty( 'prop1' ) ).to.equal( 'foo' );
  418. expect( Array.from( el.getCustomProperties() ).length ).to.equal( 1 );
  419. writer.removeCustomProperty( 'prop1', el );
  420. expect( el.getCustomProperty( 'prop1' ) ).to.undefined;
  421. expect( Array.from( el.getCustomProperties() ).length ).to.equal( 0 );
  422. } );
  423. it( 'should have no effect if custom property does not exists', () => {
  424. const el = new Element( 'h1' );
  425. writer.removeCustomProperty( 'prop1', el );
  426. expect( el.getCustomProperty( 'prop1' ) ).to.undefined;
  427. expect( Array.from( el.getCustomProperties() ).length ).to.equal( 0 );
  428. } );
  429. } );
  430. describe( 'createPositionAt()', () => {
  431. it( 'should return instance of Position', () => {
  432. const span = new Element( 'span' );
  433. expect( writer.createPositionAt( span, 0 ) ).to.be.instanceof( ViewPosition );
  434. } );
  435. } );
  436. describe( 'createPositionAfter()', () => {
  437. it( 'should return instance of Position', () => {
  438. const span = new Element( 'span', undefined, new Element( 'span' ) );
  439. expect( writer.createPositionAfter( span.getChild( 0 ) ) ).to.be.instanceof( ViewPosition );
  440. } );
  441. } );
  442. describe( 'createPositionBefore()', () => {
  443. it( 'should return instance of Position', () => {
  444. const span = new Element( 'span', undefined, new Element( 'span' ) );
  445. expect( writer.createPositionBefore( span.getChild( 0 ) ) ).to.be.instanceof( ViewPosition );
  446. } );
  447. } );
  448. describe( 'createRange()', () => {
  449. it( 'should return instance of Range', () => {
  450. expect( writer.createRange( writer.createPositionAt( new Element( 'span' ), 0 ) ) ).to.be.instanceof( ViewRange );
  451. } );
  452. } );
  453. describe( 'createRangeIn()', () => {
  454. it( 'should return instance of Range', () => {
  455. const span = new Element( 'span', undefined, new Element( 'span' ) );
  456. expect( writer.createRangeIn( span.getChild( 0 ) ) ).to.be.instanceof( ViewRange );
  457. } );
  458. } );
  459. describe( 'createRangeOn()', () => {
  460. it( 'should return instance of Range', () => {
  461. const span = new Element( 'span', undefined, new Element( 'span' ) );
  462. expect( writer.createRangeOn( span.getChild( 0 ) ) ).to.be.instanceof( ViewRange );
  463. } );
  464. } );
  465. describe( 'createSelection()', () => {
  466. it( 'should return instance of Selection', () => {
  467. expect( writer.createSelection() ).to.be.instanceof( ViewSelection );
  468. } );
  469. } );
  470. } );