How to use range method in taiko

Best JavaScript code snippet using taiko

enlarge.js

Source:enlarge.js Github

copy

Full Screen

...3 'use strict';4 var doc = CKEDITOR.document,5 html2 = document.getElementById( 'playground2' ).innerHTML;6 function getRange( startId, endId ) {7 var range = new CKEDITOR.dom.range( CKEDITOR.document );8 range.moveToBookmark( { startNode: startId, endNode: endId, serializable: true } );9 return range;10 }11 var tests = {12 setUp: function() {13 document.getElementById( 'playground2' ).innerHTML = html2;14 },15 // @param CKEDITOR.dom.range range Range object which will be tested.16 // @param Number startOffset17 // @param Number endOffset18 // @param Node startContainer19 // @param Node [endContainer] If not given will be set to startContainer.20 assertRangeContainers: function( range, startOffset, endOffset, startContainer, endContainer ) {21 assert.isInstanceOf( CKEDITOR.dom.range, range, 'assertRangeContainers: range parameter has invalid type, should be instance of CKEDITOR.dom.range' );22 if ( typeof endContainer == 'undefined' )23 endContainer = startContainer;24 // do asserts...25 assert.areSame( startContainer, range.startContainer.$, 'range.startContainer' );26 assert.areSame( startOffset, range.startOffset, 'range.startOffset' );27 assert.areSame( endContainer, range.endContainer.$, 'range.endContainer' );28 assert.areSame( endOffset, range.endOffset, 'range.endOffset' );29 assert.isFalse( range.collapsed, 'range.collapsed' );30 },31 // https://dev.ckeditor.com/ticket/873232 'test enlarge element (HTML comments)': function() {33 // IE9+Compat throws exception with the below content.34 if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )35 assert.ignore();36 var ct = CKEDITOR.document.getById( '_EnlargeP19' ),37 ranges = bender.tools.setHtmlWithRange( ct, '<!-- foo --><p><strong>foo</strong></p><p>[bar]</p><!--bar-->' );38 ranges[ 0 ].enlarge( CKEDITOR.ENLARGE_ELEMENT );39 var output = bender.tools.getHtmlWithRanges( ct, ranges );40 assert.areSame( '<!-- foo --><p><strong>foo</strong></p>[<p>bar</p>]<!--bar-->', output );41 },42 // https://dev.ckeditor.com/ticket/495043 'test enlarge element 16': function() {44 var ct = doc.getById( 'editable_playground' );45 var source = '<p><b>A</b> <b>B</b> [C]D</p>';46 var range = bender.tools.setHtmlWithRange( ct, source )[ 0 ];47 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );48 assert.areSame( source, bender.tools.getHtmlWithRanges( ct, new CKEDITOR.dom.rangeList( [ range ] ) ) );49 },50 test_enlarge_block1: function() {51 var range = getRange( 'S5', null );52 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );53 assert.areSame( document.getElementById( '_EnlargeP11' ), range.startContainer.$, 'range.startContainer' );54 assert.areSame( 0, range.startOffset, 'range.startOffset' );55 assert.areSame( document.getElementById( '_EnlargeP11' ), range.endContainer.$, 'range.endContainer' );56 assert.areSame( 5, range.endOffset, 'range.endOffset' );57 assert.isFalse( range.collapsed, 'range.collapsed' );58 },59 test_enlarge_element9: function() {60 // <p>Test<i> [Enlarge</i>]</p>61 // <p>Test<i> [Enlarge</i>]</p>62 var range = new CKEDITOR.dom.range( doc );63 range.setStart( doc.getById( '_EnlargeI3' ).getFirst(), 1 );64 range.setEnd( doc.getById( '_EnlargeP3' ), 2 );65 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );66 assert.areSame( document.getElementById( '_EnlargeI3' ).firstChild, range.startContainer.$, 'range.startContainer' );67 assert.areSame( 1, range.startOffset, 'range.startOffset' );68 assert.areSame( document.getElementById( '_EnlargeP3' ), range.endContainer.$, 'range.endContainer' );69 assert.areSame( 2, range.endOffset, 'range.endOffset' );70 assert.isFalse( range.collapsed, 'range.collapsed' );71 },72 test_enlarge_element10: CKEDITOR.env.ie ?73 function() {74 // <p>Test <i>[Enlarge</i>]</p>75 // <p>Test [<i>Enlarge</i>]</p>76 var range = new CKEDITOR.dom.range( doc );77 range.setStart( doc.getById( '_EnlargeI4' ).getFirst(), 0 );78 range.setEnd( doc.getById( '_EnlargeP4' ), 2 );79 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );80 assert.areSame( document.getElementById( '_EnlargeP4' ), range.startContainer.$, 'range.startContainer' );81 assert.areSame( 1, range.startOffset, 'range.startOffset' );82 assert.areSame( document.getElementById( '_EnlargeP4' ), range.endContainer.$, 'range.endContainer' );83 assert.areSame( 2, range.endOffset, 'range.endOffset' );84 assert.isFalse( range.collapsed, 'range.collapsed' );85 }86 :87 function() {88 // <p>Test <i> [Enlarge</i>]</p>89 // <p>Test [<i> Enlarge</i>]</p>90 var range = new CKEDITOR.dom.range( doc );91 range.setStart( doc.getById( '_EnlargeI4' ).getFirst(), 1 );92 range.setEnd( doc.getById( '_EnlargeP4' ), 2 );93 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );94 assert.areSame( document.getElementById( '_EnlargeP4' ), range.startContainer.$, 'range.startContainer' );95 assert.areSame( 1, range.startOffset, 'range.startOffset' );96 assert.areSame( document.getElementById( '_EnlargeP4' ), range.endContainer.$, 'range.endContainer' );97 assert.areSame( 2, range.endOffset, 'range.endOffset' );98 assert.isFalse( range.collapsed, 'range.collapsed' );99 },100 test_enlarge_element11: function() {101 // <p>Test <i>[Enlarge]</i></p>102 // <p>Test [<i>Enlarge</i>]</p>103 var range = new CKEDITOR.dom.range( doc );104 range.setStart( doc.getById( '_EnlargeI5' ), 0 );105 range.setEnd( doc.getById( '_EnlargeI5' ), 1 );106 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );107 assert.areSame( document.getElementById( '_EnlargeP5' ), range.startContainer.$, 'range.startContainer' );108 assert.areSame( 1, range.startOffset, 'range.startOffset' );109 assert.areSame( document.getElementById( '_EnlargeP5' ), range.endContainer.$, 'range.endContainer' );110 assert.areSame( 2, range.endOffset, 'range.endOffset' );111 assert.isFalse( range.collapsed, 'range.collapsed' );112 },113 test_enlarge_element12: function() {114 // <p>Test <i><b></b>[Enlarge]</i></p>115 // <p>Test [<i><b></b>Enlarge</i>]</p>116 var range = new CKEDITOR.dom.range( doc );117 range.setStart( doc.getById( '_EnlargeI6' ), 1 );118 range.setEnd( doc.getById( '_EnlargeI6' ), 2 );119 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );120 assert.areSame( document.getElementById( '_EnlargeP6' ), range.startContainer.$, 'range.startContainer' );121 assert.areSame( 1, range.startOffset, 'range.startOffset' );122 assert.areSame( document.getElementById( '_EnlargeP6' ), range.endContainer.$, 'range.endContainer' );123 assert.areSame( 2, range.endOffset, 'range.endOffset' );124 assert.isFalse( range.collapsed, 'range.collapsed' );125 },126 test_enlarge_element13: function() {127 // <p>Test <i><b></b>[Enlarge]</i></p>128 // <p>Test [<i><b></b>Enlarge</i>]</p>129 doc.getById( '_EnlargeP' ).setHtml( 'this <i>is some </i>sample text' );130 var range = new CKEDITOR.dom.range( doc );131 range.setStart( doc.getById( '_EnlargeP' ), 0 );132 range.setEnd( doc.getById( '_EnlargeP' ).getChild( 1 ), 0 );133 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );134 assert.areSame( document.getElementById( '_EnlargeP' ), range.startContainer.$, 'range.startContainer' );135 assert.areSame( 0, range.startOffset, 'range.startOffset' );136 assert.areSame( document.getElementById( '_EnlargeP' ).childNodes[ 1 ], range.endContainer.$, 'range.endContainer' );137 assert.areSame( 0, range.endOffset, 'range.endOffset' );138 assert.isFalse( range.collapsed, 'range.collapsed' );139 },140 // Enlarge without including line-breaks; (https://dev.ckeditor.com/ticket/7087)141 test_enlarge_element15: function() {142 // <p><i>[Enlarge]</i><br /></p>143 // <p>[<i>Enlarge</i>]<br /></p>144 var range = new CKEDITOR.dom.range( doc );145 range.setStart( doc.getById( '_EnlargeI8' ), 0 );146 range.setEnd( doc.getById( '_EnlargeI8' ), 1 );147 range.enlarge( CKEDITOR.ENLARGE_ELEMENT, true );148 assert.areSame( document.getElementById( '_EnlargeP18' ), range.startContainer.$ );149 assert.areSame( 0, range.startOffset, 'range.startOffset' );150 assert.areSame( document.getElementById( '_EnlargeP18' ), range.endContainer.$ );151 assert.areSame( 1, range.endOffset, 'range.endOffset' );152 assert.isFalse( range.collapsed, 'range.collapsed' );153 },154 test_enlarge_element20: function() {155 // <p><span contenteditable="false">[foobar]</span></p>156 // <p><span contenteditable="false">[foobar]</span></p>157 var range = new CKEDITOR.dom.range( doc ),158 expectedTextNode = document.getElementById( '_EnlargeS20' ).firstChild;159 range.setStart( doc.getById( '_EnlargeS20' ).getFirst(), 0 );160 range.setEnd( doc.getById( '_EnlargeS20' ).getFirst(), 5 );161 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );162 this.assertRangeContainers( range, 0, 5, expectedTextNode );163 },164 test_enlarge_element21: function() {165 // <p><span contenteditable="false"><i>[foobar]</i></span></p>166 // <p><span contenteditable="false">[<i>foobar</i>]</span></p>167 var range = new CKEDITOR.dom.range( doc ),168 expectedSelectContainer = document.getElementById( '_EnlargeS21' );169 range.setStart( doc.getById( '_EnlargeI21' ).getFirst(), 0 );170 range.setEnd( doc.getById( '_EnlargeI21' ).getFirst(), 6 );171 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );172 this.assertRangeContainers( range, 0, 1, expectedSelectContainer );173 },174 'test enlarge with _empty_ contenteditable as preceding item': function() {175 // <p><span contenteditable="false"></span><i>[foobar]</i></p>176 // [<p><span contenteditable="false"></span><i>foobar</i></p>]177 var range = new CKEDITOR.dom.range( doc ),178 expectedSelectContainer = doc.getById( '_EnlargeP22Container' ).$;179 range.setStart( doc.getById( '_EnlargeI22' ).getFirst(), 0 );180 range.setEnd( doc.getById( '_EnlargeI22' ).getFirst(), 6 );181 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );182 // IE8 has its ways to select183 if ( CKEDITOR.env.ie && CKEDITOR.env.version == 8 )184 this.assertRangeContainers( range, 1, 2, doc.getById( '_EnlargeP22' ).$, expectedSelectContainer );185 else186 this.assertRangeContainers( range, 1, 2, expectedSelectContainer, expectedSelectContainer );187 },188 'test enlarge with whitespaced contenteditable as preceding item': function() {189 // <p><span contenteditable="false"> </span><i>[foobar]</i></p>190 // [<p><span contenteditable="false"> </span><i>foobar</i></p>]191 var range = new CKEDITOR.dom.range( doc ),192 expectedSelectContainer = doc.getById( '_EnlargeP24Container' ).$;193 range.setStart( doc.getById( '_EnlargeI24' ).getFirst(), 0 );194 range.setEnd( doc.getById( '_EnlargeI24' ).getFirst(), 6 );195 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );196 if ( CKEDITOR.env.ie && CKEDITOR.env.version == 8 )197 this.assertRangeContainers( range, 1, 2, doc.getById( '_EnlargeP24' ).$, expectedSelectContainer );198 else199 this.assertRangeContainers( range, 1, 2, expectedSelectContainer, expectedSelectContainer );200 },201 'test enlarge with contenteditable as preceding item': function() {202 // <p><span contenteditable="false">bombom</span><i>[foobar]</i><span>foo</span></p>203 // <p><span contenteditable="false">bombom</span>[<i>[foobar]</i>]<span>foo</span></p>204 var range = new CKEDITOR.dom.range( doc ),205 expectedSelectContainer = doc.getById( '_EnlargeP23' ).$;206 range.setStart( doc.getById( '_EnlargeI23' ).getFirst(), 0 );207 range.setEnd( doc.getById( '_EnlargeI23' ).getFirst(), 6 );208 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );209 this.assertRangeContainers( range, 1, 2, expectedSelectContainer );210 },211 test_enlarge_list1: function() {212 var range = getRange( 'S1', null );213 range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS );214 assert.areSame( document.getElementById( '_EnlargeP7' ), range.startContainer.$, 'range.startContainer' );215 assert.areSame( 0, range.startOffset, 'range.startOffset' );216 assert.areSame( document.getElementById( '_EnlargeP7' ), range.endContainer.$, 'range.endContainer' );217 assert.areSame( 3, range.endOffset, 'range.endOffset' );218 assert.isFalse( range.collapsed, 'range.collapsed' );219 },220 test_enlarge_list2: function() {221 var range = getRange( 'S2', 'E2' );222 range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS );223 assert.areSame( document.getElementById( '_EnlargeP8' ), range.startContainer.$, 'range.startContainer' );224 assert.areSame( 0, range.startOffset, 'range.startOffset' );225 assert.areSame( document.getElementById( '_EnlargeP8' ), range.endContainer.$, 'range.endContainer' );226 assert.areSame( 4, range.endOffset, 'range.endOffset' );227 assert.isFalse( range.collapsed, 'range.collapsed' );228 },229 test_enlarge_list3: function() {230 var range = getRange( 'S3', null );231 range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS );232 assert.areSame( document.getElementById( '_EnlargeP9' ), range.startContainer.$, 'range.startContainer' );233 assert.areSame( 2, range.startOffset, 'range.startOffset' );234 assert.areSame( document.getElementById( '_EnlargeP9' ), range.endContainer.$, 'range.endContainer' );235 assert.areSame( 3, range.endOffset, 'range.endOffset' );236 assert.isFalse( range.collapsed, 'range.collapsed' );237 },238 test_enlarge_list4: function() {239 var range = getRange( 'S4', null );240 range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS );241 assert.areSame( document.getElementById( '_EnlargeP10' ), range.startContainer.$, 'range.startContainer' );242 assert.areSame( 3, range.startOffset, 'range.startOffset' );243 assert.areSame( document.getElementById( '_EnlargeP10' ), range.endContainer.$, 'range.endContainer' );244 assert.areSame( 5, range.endOffset, 'range.endOffset' );245 assert.isFalse( range.collapsed, 'range.collapsed' );246 },247 test_enlarge_list5: function() {248 var range = getRange( 'S9', null );249 var bookmark = range.createBookmark();250 range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS );251 assert.areSame( document.getElementById( '_EnlargeP15' ), range.startContainer.$, 'range.startContainer' );252 assert.areSame( 0, range.startOffset, 'range.startOffset' );253 assert.areSame( document.getElementById( '_EnlargeP15' ), range.endContainer.$, 'range.endContainer' );254 assert.areSame( 4, range.endOffset, 'range.endOffset' );255 assert.isFalse( range.collapsed, 'range.collapsed' );256 range.moveToBookmark( bookmark );257 },258 test_enlarge_block2: function() {259 var range = getRange( 'S10', null );260 var bookmark = range.createBookmark();261 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );262 assert.areSame( document.getElementById( '_EnlargeP16' ), range.startContainer.$, 'range.startContainer' );263 assert.areSame( 0, range.startOffset, 'range.startOffset' );264 assert.areSame( document.getElementById( '_EnlargeP16' ), range.endContainer.$, 'range.endContainer' );265 assert.areSame( 5, range.endOffset, 'range.endOffset' );266 assert.isFalse( range.collapsed, 'range.collapsed' );267 range.moveToBookmark( bookmark );268 },269 test_enlarge_block3: function() {270 var range = getRange( 'S6', null );271 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );272 assert.areSame( document.getElementById( '_EnlargeP12' ), range.startContainer.$, 'range.startContainer' );273 assert.areSame( 0, range.startOffset, 'range.startOffset' );274 assert.areSame( document.getElementById( '_EnlargeP12' ), range.endContainer.$, 'range.endContainer' );275 assert.areSame( 2, range.endOffset, 'range.endOffset' );276 assert.isFalse( range.collapsed, 'range.collapsed' );277 },278 test_enlarge_block4: function() {279 var range = getRange( 'S7', null );280 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );281 assert.areSame( document.getElementById( '_EnlargeP13' ), range.startContainer.$, 'range.startContainer' );282 assert.areSame( 0, range.startOffset, 'range.startOffset' );283 assert.areSame( document.getElementById( '_EnlargeP13' ), range.endContainer.$, 'range.endContainer' );284 assert.areSame( 2, range.endOffset, 'range.endOffset' );285 assert.isFalse( range.collapsed, 'range.collapsed' );286 },287 test_enlarge_block5: function() {288 var range = getRange( 'S8', null );289 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );290 assert.areSame( document.getElementById( '_EnlargeP14' ), range.startContainer.$, 'range.startContainer' );291 assert.areSame( 0, range.startOffset, 'range.startOffset' );292 assert.isTrue( range.collapsed, 'range.collapsed' );293 },294 /**295 * Test enlarge list when there's no nodes between296 * range start and the block boundary.297 */298 test_enlarge_block6: function() {299 var range = getRange( 'S11', null );300 range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS );301 assert.areSame( document.getElementById( '_EnlargeP17' ),302 range.startContainer.$, 'range.startContainer' );303 assert.areSame( 0, range.startOffset, 'range.startOffset' );304 },305 /**306 * We should stop enlarging the range when it ends right after BR,307 * this's the case when a line selection is made in IE/Opera. (https://dev.ckeditor.com/ticket/7490)308 */309 test_enlarge_brs: function() {310 var target = CKEDITOR.document.getById( '_EnlargeP19' ),311 range = bender.tools.setHtmlWithRange( target, '[line1<br />line2<br />]line3' )[ 0 ];312 range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS );313 assert.areSame( target.$, range.startContainer.$, 'range.startContainer' );314 assert.areSame( 0, range.startOffset, 'range.startOffset' );315 assert.areSame( target.$, range.endContainer.$, 'range.endContainer' );316 assert.areSame( 4, range.endOffset, 'range.startOffset' );317 },318 'test enlarge does not stop on positioned or floated inline elements': function() {319 var target = CKEDITOR.document.getById( '_EnlargeP25a' ),320 range = getRange( 'S25a', null );321 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );322 assert.areSame( target, range.startContainer, 'range.startContainer' );323 assert.areSame( target, range.endContainer, 'range.endContainer' );324 assert.areSame( 0, range.startOffset, 'range.startOffset' );325 assert.areSame( target.getChildCount(), range.endOffset, 'range.endOffset' );326 },327 'test enlarge stops on block boundaries': function() {328 var target = CKEDITOR.document.getById( '_EnlargeP25b' ),329 range = getRange( 'S25b', null );330 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );331 assert.areSame( target, range.startContainer, 'range.startContainer' );332 assert.areSame( target, range.endContainer, 'range.endContainer' );333 assert.isTrue( range.startOffset > 0, 'range.startOffset - range has not been moved to the start' );334 assert.isTrue( range.endOffset < target.getChildCount(), 'range.endOffset - range has not been moved to the end' );335 },336 'test enlarge does not check contents of non-editable elements - ENLARGE_BLOCK_CONTENTS': function() {337 var target = CKEDITOR.document.getById( '_EnlargeP26' ),338 range = getRange( 'S26', null );339 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );340 assert.areSame( target, range.startContainer, 'range.startContainer' );341 assert.areSame( target, range.endContainer, 'range.endContainer' );342 // Starts right after </p#P26S>.343 assert.areSame( CKEDITOR.document.getById( 'P26S' ).getIndex() + 1, range.startOffset, 'range.startOffset' );344 // Ends right before <p#P26E>.345 assert.areSame( CKEDITOR.document.getById( 'P26E' ).getIndex(), range.endOffset, 'range.endOffset' );346 },347 'test enlarge does not check contents of non-editable elements - ENLARGE_LIST_ITEM_CONTENTS': function() {348 var target = CKEDITOR.document.getById( '_EnlargeP26' ),349 range = getRange( 'S26', null );350 range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS );351 assert.areSame( target, range.startContainer, 'range.startContainer' );352 assert.areSame( target, range.endContainer, 'range.endContainer' );353 // Starts right after </p#P26S>.354 assert.areSame( CKEDITOR.document.getById( 'P26S' ).getIndex() + 1, range.startOffset, 'range.startOffset' );355 // Ends right before <p#P26E>.356 assert.areSame( CKEDITOR.document.getById( 'P26E' ).getIndex(), range.endOffset, 'range.endOffset' );357 },358 'test enlarge stops on non-editable blocks': function() {359 var target = CKEDITOR.document.getById( '_EnlargeP27' ),360 range = getRange( 'S27', null );361 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );362 assert.areSame( target, range.startContainer, 'range.startContainer' );363 assert.areSame( target, range.endContainer, 'range.endContainer' );364 // Starts right after </p#P27S>.365 assert.areSame( CKEDITOR.document.getById( 'P27S' ).getIndex() + 1, range.startOffset, 'range.startOffset' );366 // Ends right before <p#P27E>.367 assert.areSame( CKEDITOR.document.getById( 'P27E' ).getIndex(), range.endOffset, 'range.endOffset' );368 },369 'test enlarge stops on non-editable blocks 2': function() {370 var target = CKEDITOR.document.getById( '_EnlargeP28' ),371 range = new CKEDITOR.dom.range( doc );372 range.setStart( target, 0 );373 range.collapse( true );374 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );375 assert.isTrue( range.collapsed, 'range.collapsed' );376 assert.areSame( target, range.startContainer, 'range.startContainer' );377 assert.areSame( 0, range.startOffset, 'range.startOffset' );378 },379 // https://dev.ckeditor.com/ticket/11798380 'test enlarge between non-editable block and block limit boundary': function() {381 var target = CKEDITOR.document.getById( 'S29' ),382 range = new CKEDITOR.dom.range( doc );383 // <td#S29><p non-editable>foo</p>^</td>384 range.moveToPosition( target, CKEDITOR.POSITION_BEFORE_END );385 range.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );386 assert.isTrue( range.collapsed, 'range.collapsed' );387 assert.areSame( target, range.startContainer, 'range.startContainer' );388 assert.areSame( target.getChildCount(), range.startOffset, 'range.startOffset' );389 },390 'test space 1': function() {391 // <div>x<p><b>[foo] </b>bar</p>x</div> ->392 // <div>x[<p><b>foo] </b>bar</p>x</div>393 var p = doc.getById( 'p' ),394 pContainer = doc.getById( 'pContainer' );395 p.setHtml( '<b id="b">foo </b>bar' );396 var b = doc.getById( 'b' );397 var range = new CKEDITOR.dom.range( doc );398 range.setStart( b.getFirst(), 0 );399 range.setEnd( b.getFirst(), 3 );400 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );401 this.assertRangeContainers( range, 1, 3, pContainer.$, b.getFirst().$ );402 },403 'test space 2': function() {404 // <div>x<p><b>[foo]</b> bar</p>x</div> ->405 // <div>x[<p><b>foo</b>] bar</p>x</div>406 var p = doc.getById( 'p' ),407 pContainer = doc.getById( 'pContainer' );408 p.setHtml( '<b id="b">foo</b> bar' );409 var b = doc.getById( 'b' );410 var range = new CKEDITOR.dom.range( doc );411 range.setStart( b.getFirst(), 0 );412 range.setEnd( b.getFirst(), 3 );413 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );414 this.assertRangeContainers( range, 1, 1, pContainer.$, p.$ );415 },416 'test space 3': function() {417 // <div>x<p><b>[foo] </b></p>x</div> ->418 // <div>x[<p><b>foo </b></p>]x</div>419 var p = doc.getById( 'p' ),420 pContainer = doc.getById( 'pContainer' );421 p.setHtml( '<b id="b">foo </b>' );422 var b = doc.getById( 'b' );423 var range = new CKEDITOR.dom.range( doc );424 range.setStart( b.getFirst(), 0 );425 range.setEnd( b.getFirst(), 3 );426 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );427 this.assertRangeContainers( range, 1, 2, pContainer.$, pContainer.$ );428 },429 'test space 4': function() {430 // <div>x<p>[foo] <b>bar</b> </p>x</div> ->431 // <div>x[<p>foo] <b>bar</b> </p>x</div>432 var p = doc.getById( 'p' ),433 pContainer = doc.getById( 'pContainer' );434 p.setHtml( 'foo <b>bar</b> ' );435 var range = new CKEDITOR.dom.range( doc );436 range.setStart( p.getFirst(), 0 );437 range.setEnd( p.getFirst(), 3 );438 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );439 this.assertRangeContainers( range, 1, 3, pContainer.$, p.getFirst().$ );440 },441 'test space 5': function() {442 // <div>x<p>[foo] </p>x</div> ->443 // <div>x[<p>foo </p>]x</div>444 var p = doc.getById( 'p' ),445 pContainer = doc.getById( 'pContainer' );446 p.setHtml( 'foo ' );447 var range = new CKEDITOR.dom.range( doc );448 range.setStart( p.getFirst(), 0 );449 range.setEnd( p.getFirst(), 3 );450 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );451 this.assertRangeContainers( range, 1, 2, pContainer.$, pContainer.$ );452 },453 'test space 6': function() {454 // <div>x<p>[foo] bar</p>x</div> ->455 // <div>x[<p>foo] bar</p>x</div>456 var p = doc.getById( 'p' ),457 pContainer = doc.getById( 'pContainer' );458 p.setHtml( 'foo bar' );459 var range = new CKEDITOR.dom.range( doc );460 range.setStart( p.getFirst(), 0 );461 range.setEnd( p.getFirst(), 3 );462 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );463 this.assertRangeContainers( range, 1, 3, pContainer.$, p.getFirst().$ );464 },465 'test space 7': function() {466 // <div>x<p><i><b>[foo] </b></i>bar </p>x</div> ->467 // <div>x[<p><i><b>foo] </b></i>bar </p>x</div>468 var p = doc.getById( 'p' ),469 pContainer = doc.getById( 'pContainer' );470 p.setHtml( '<i><b id="b">foo </b></i>bar ' );471 var b = doc.getById( 'b' );472 var range = new CKEDITOR.dom.range( doc );473 range.setStart( b.getFirst(), 0 );474 range.setEnd( b.getFirst(), 3 );475 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );476 this.assertRangeContainers( range, 1, 3, pContainer.$, b.getFirst().$ );477 },478 'test space 8': function() {479 // <div>x<p>foo <i><b>[bar] </b></i></p>x</div> ->480 // <div>x<p>foo [<i><b>bar </b></i></p>]x</div> ->481 var p = doc.getById( 'p' ),482 pContainer = doc.getById( 'pContainer' );483 p.setHtml( 'foo <i><b id="b">bar </b></i>' );484 var b = doc.getById( 'b' );485 var range = new CKEDITOR.dom.range( doc );486 range.setStart( b.getFirst(), 0 );487 range.setEnd( b.getFirst(), 3 );488 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );489 this.assertRangeContainers( range, 1, 2, p.$, pContainer.$ );490 },491 'test space 9': function() {492 // <div>x<p><i><b>[foo]</b></i> bar</p>x</div> ->493 // <div>x[<p><i><b>foo</b></i>] bar</p>x</div> ->494 var p = doc.getById( 'p' ),495 pContainer = doc.getById( 'pContainer' );496 p.setHtml( '<i><b id="b">foo</b></i> bar' );497 var b = doc.getById( 'b' );498 var range = new CKEDITOR.dom.range( doc );499 range.setStart( b.getFirst(), 0 );500 range.setEnd( b.getFirst(), 3 );501 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );502 this.assertRangeContainers( range, 1, 1, pContainer.$, p.$ );503 },504 'test space 10': function() {505 // <div>x<p>foo <i><b>[bar]</b></i> </p>x</div> ->506 // <div>x<p>foo [<i><b>bar</b></i> </p>]x</div>507 var p = doc.getById( 'p' ),508 pContainer = doc.getById( 'pContainer' );509 p.setHtml( 'foo <i><b id="b">bar</b></i> ' );510 var b = doc.getById( 'b' );511 var range = new CKEDITOR.dom.range( doc );512 range.setStart( b.getFirst(), 0 );513 range.setEnd( b.getFirst(), 3 );514 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );515 this.assertRangeContainers( range, 1, 2, p.$, pContainer.$ );516 },517 'test space 11': function() {518 // <div>x<p>[foo] |bar</p>x</div> ->519 // <div>x[<p>foo] |bar</p>x</div>520 // (pipe means there are 2 separate text nodes)521 var p = doc.getById( 'p' ),522 pContainer = doc.getById( 'pContainer' );523 p.setHtml( 'foo ' );524 p.append( new CKEDITOR.dom.text( 'bar' ) );525 var range = new CKEDITOR.dom.range( doc );526 range.setStart( p.getFirst(), 0 );527 range.setEnd( p.getFirst(), 3 );528 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );529 this.assertRangeContainers( range, 1, 3, pContainer.$, p.getFirst().$ );530 },531 'test space 12': function() {532 // <div>x<p>[foo]| </p>x</div> ->533 // <div>x[<p>foo| </p>]x</div>534 // (pipe means there are 2 separate text nodes)535 var p = doc.getById( 'p' ),536 pContainer = doc.getById( 'pContainer' );537 p.setHtml( 'foo' );538 p.append( new CKEDITOR.dom.text( ' ' ) );539 var range = new CKEDITOR.dom.range( doc );540 range.setStart( p.getFirst(), 0 );541 range.setEnd( p.getFirst(), 3 );542 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );543 this.assertRangeContainers( range, 1, 2, pContainer.$, pContainer.$ );544 },545 'test space 13': function() {546 // <div>x<p>[foo] <b></b></p>x</div> ->547 // <div>x[<p>foo] <b></b></p>x</div>548 var p = doc.getById( 'p' ),549 pContainer = doc.getById( 'pContainer' );550 p.setHtml( 'foo <b></b>' );551 var range = new CKEDITOR.dom.range( doc );552 range.setStart( p.getFirst(), 0 );553 range.setEnd( p.getFirst(), 3 );554 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );555 this.assertRangeContainers( range, 1, 3, pContainer.$, p.getFirst().$ );556 }557 };558 // IE only tests.559 CKEDITOR.env.ie && YUITest.Util.mix( tests, {560 test_enlarge_element1: CKEDITOR.env.version > 8 ?561 function() {562 // <p> Test <b> <i> [Enlarge]</i> this</b> </p>563 // <p> Test <b> [<i> Enlarge</i>] this</b> </p>564 var range = new CKEDITOR.dom.range( doc );565 range.setStart( doc.getById( '_EnlargeI' ).getFirst(), 2 );566 range.setEnd( doc.getById( '_EnlargeI' ), 1 );567 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );568 assert.areSame( document.getElementById( '_EnlargeB' ), range.startContainer.$, 'range.startContainer' );569 assert.areSame( 1, range.startOffset, 'range.startOffset' );570 assert.areSame( document.getElementById( '_EnlargeB' ), range.endContainer.$, 'range.endContainer' );571 assert.areSame( 2, range.endOffset, 'range.endOffset' );572 assert.isFalse( range.collapsed, 'range.collapsed' );573 } : function() {574 // <p>Test <b><i>[Enlarge]</i> this</b></p>575 // <p>Test <b>[<i>Enlarge</i>] this</b></p>576 var range = new CKEDITOR.dom.range( doc );577 range.setStart( doc.getById( '_EnlargeI' ).getFirst(), 0 );578 range.setEnd( doc.getById( '_EnlargeI' ), 1 );579 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );580 assert.areSame( document.getElementById( '_EnlargeB' ), range.startContainer.$, 'range.startContainer' );581 assert.areSame( 0, range.startOffset, 'range.startOffset' );582 assert.areSame( document.getElementById( '_EnlargeB' ), range.endContainer.$, 'range.endContainer' );583 assert.areSame( 1, range.endOffset, 'range.endOffset' );584 assert.isFalse( range.collapsed, 'range.collapsed' );585 },586 test_enlarge_element2: CKEDITOR.env.version > 8 ?587 function() {588 // <p> Test <b> <i> [Enlarge</i> this]</b> </p>589 // <p> Test [<b> <i> Enlarge</i> this</b>] </p>590 var range = new CKEDITOR.dom.range( doc );591 range.setStart( doc.getById( '_EnlargeI' ).getFirst(), 2 );592 range.setEnd( doc.getById( '_EnlargeB' ), 3 );593 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );594 assert.areSame( document.getElementById( '_EnlargeP' ), range.startContainer.$, 'range.startContainer' );595 assert.areSame( 1, range.startOffset, 'range.startOffset' );596 assert.areSame( document.getElementById( '_EnlargeP' ), range.endContainer.$, 'range.endContainer' );597 assert.areSame( 2, range.endOffset, 'range.endOffset' );598 assert.isFalse( range.collapsed, 'range.collapsed' );599 } : function() {600 // <p>Test <b><i>[Enlarge</i> this]</b></p>601 // <p>Test [<b><i>Enlarge</i> this</b>]</p>602 var range = new CKEDITOR.dom.range( doc );603 range.setStart( doc.getById( '_EnlargeI' ).getFirst(), 0 );604 range.setEnd( doc.getById( '_EnlargeB' ), 2 );605 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );606 assert.areSame( document.getElementById( '_EnlargeP' ), range.startContainer.$, 'range.startContainer' );607 assert.areSame( 1, range.startOffset, 'range.startOffset' );608 assert.areSame( document.getElementById( '_EnlargeP' ), range.endContainer.$, 'range.endContainer' );609 assert.areSame( 2, range.endOffset, 'range.endOffset' );610 assert.isFalse( range.collapsed, 'range.collapsed' );611 },612 test_enlarge_element3: CKEDITOR.env.version > 8 ?613 function() {614 // <p> [Test <b> <i> Enlarge]</i> this</b> </p>615 // <p> [Test <b> <i> Enlarge</i>] this</b> </p>616 var range = new CKEDITOR.dom.range( doc );617 range.setStart( doc.getById( '_EnlargeP' ).getFirst(), 1 );618 range.setEnd( doc.getById( '_EnlargeI' ), 1 );619 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );620 assert.areSame( document.getElementById( '_EnlargeP' ).firstChild, range.startContainer.$, 'range.startContainer' );621 assert.areSame( 1, range.startOffset, 'range.startOffset' );622 assert.areSame( document.getElementById( '_EnlargeB' ), range.endContainer.$, 'range.endContainer' );623 assert.areSame( 2, range.endOffset, 'range.endOffset' );624 assert.isFalse( range.collapsed, 'range.collapsed' );625 } : function() {626 // <p>[Test <b><i>Enlarge]</i> this</b></p>627 // <p>[Test <b><i>Enlarge</i>] this</b></p>628 var range = new CKEDITOR.dom.range( doc );629 range.setStart( doc.getById( '_EnlargeP' ).getFirst(), 0 );630 range.setEnd( doc.getById( '_EnlargeI' ), 1 );631 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );632 assert.areSame( document.getElementById( '_EnlargeP' ).firstChild, range.startContainer.$, 'range.startContainer' );633 assert.areSame( 0, range.startOffset, 'range.startOffset' );634 assert.areSame( document.getElementById( '_EnlargeB' ), range.endContainer.$, 'range.endContainer' );635 assert.areSame( 1, range.endOffset, 'range.endOffset' );636 assert.isFalse( range.collapsed, 'range.collapsed' );637 },638 test_enlarge_element4: CKEDITOR.env.version > 8 ?639 function() {640 // <p> [Test <b> <i> Enlarge</i> this]</b> </p>641 // [<p> Test <b> <i> Enlarge</i> this</b> </p>]642 var range = new CKEDITOR.dom.range( doc );643 range.setStart( doc.getById( '_EnlargeP' ).getFirst(), 1 );644 range.setEnd( doc.getById( '_EnlargeB' ).getChild( 2 ), 5 );645 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );646 assert.areSame( document.getElementById( '_EnlargeP' ).parentNode, range.startContainer.$, 'range.startContainer' );647 assert.areSame( doc.getById( '_EnlargeP' ).getIndex(), range.startOffset, 'range.startOffset' );648 assert.areSame( document.getElementById( '_EnlargeP' ).parentNode, range.endContainer.$, 'range.endContainer' );649 assert.areSame( doc.getById( '_EnlargeP' ).getIndex() + 1, range.endOffset, 'range.endOffset' );650 assert.isFalse( range.collapsed, 'range.collapsed' );651 } : function() {652 // <p>[Test <b><i>Enlarge</i> this]</b></p>653 // [<p>Test <b><i>Enlarge</i> this</b></p>]654 var range = new CKEDITOR.dom.range( doc );655 range.setStart( doc.getById( '_EnlargeP' ).getFirst(), 0 );656 range.setEnd( doc.getById( '_EnlargeB' ).getChild( 1 ), 5 );657 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );658 assert.areSame( document.getElementById( '_EnlargeP' ).parentNode, range.startContainer.$, 'range.startContainer' );659 assert.areSame( doc.getById( '_EnlargeP' ).getIndex(), range.startOffset, 'range.startOffset' );660 assert.areSame( document.getElementById( '_EnlargeP' ).parentNode, range.endContainer.$, 'range.endContainer' );661 assert.areSame( doc.getById( '_EnlargeP' ).getIndex() + 1, range.endOffset, 'range.endOffset' );662 assert.isFalse( range.collapsed, 'range.collapsed' );663 },664 test_enlarge_element5: function() {665 // <p>Test<b> <i>[Enlarge</i> this]</b></p>666 // <p>Test<b> [<i>Enlarge</i> this]</b></p>667 var range = new CKEDITOR.dom.range( doc );668 range.setStart( doc.getById( '_EnlargeI1' ).getFirst(), 0 );669 range.setEnd( doc.getById( '_EnlargeB1' ).getChild( 2 ), 5 );670 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );671 assert.areSame( document.getElementById( '_EnlargeB1' ), range.startContainer.$, 'range.startContainer' );672 assert.areSame( 1, range.startOffset, 'range.startOffset' );673 assert.areSame( document.getElementById( '_EnlargeB1' ).childNodes[ 2 ], range.endContainer.$, 'range.endContainer' );674 assert.areSame( 5, range.endOffset, 'range.endOffset' );675 assert.isFalse( range.collapsed, 'range.collapsed' );676 },677 test_enlarge_element6: CKEDITOR.env.version > 8 ?678 function() {679 // <p> <b> <i> [Enlarge</i>] this</b> </p>680 // <p> <b> [<i> Enlarge</i>] this</b> </p>681 var range = new CKEDITOR.dom.range( doc );682 range.setStart( doc.getById( '_EnlargeI2' ).getFirst(), 2 );683 range.setEnd( doc.getById( '_EnlargeB2' ), 2 );684 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );685 assert.areSame( document.getElementById( '_EnlargeB2' ), range.startContainer.$, 'range.startContainer' );686 assert.areSame( 1, range.startOffset, 'range.startOffset' );687 assert.areSame( document.getElementById( '_EnlargeB2' ), range.endContainer.$, 'range.endContainer' );688 assert.areSame( 2, range.endOffset, 'range.endOffset' );689 assert.isFalse( range.collapsed, 'range.collapsed' );690 } : function() {691 // <p><b><i>[Enlarge</i>] this</b></p>692 // <p><b>[<i>Enlarge</i>] this</b></p>693 var range = new CKEDITOR.dom.range( doc );694 range.setStart( doc.getById( '_EnlargeI2' ).getFirst(), 0 );695 range.setEnd( doc.getById( '_EnlargeB2' ), 1 );696 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );697 assert.areSame( document.getElementById( '_EnlargeB2' ), range.startContainer.$, 'range.startContainer' );698 assert.areSame( 0, range.startOffset, 'range.startOffset' );699 assert.areSame( document.getElementById( '_EnlargeB2' ), range.endContainer.$, 'range.endContainer' );700 assert.areSame( 1, range.endOffset, 'range.endOffset' );701 assert.isFalse( range.collapsed, 'range.collapsed' );702 },703 test_enlarge_element7: CKEDITOR.env.version > 8 ?704 function() {705 // <p> <b> <i> [Enlarge</i> this]</b> </p>706 // [<p> <b> <i> Enlarge</i> this</b> </p>]707 var range = new CKEDITOR.dom.range( doc );708 range.setStart( doc.getById( '_EnlargeI2' ).getFirst(), 2 );709 range.setEnd( doc.getById( '_EnlargeB2' ), 3 );710 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );711 assert.areSame( document.getElementById( '_EnlargeP2' ).parentNode, range.startContainer.$, 'range.startContainer' );712 assert.areSame( doc.getById( '_EnlargeP2' ).getIndex(), range.startOffset, 'range.startOffset' );713 assert.areSame( document.getElementById( '_EnlargeP2' ).parentNode, range.endContainer.$, 'range.endContainer' );714 assert.areSame( doc.getById( '_EnlargeP2' ).getIndex() + 1, range.endOffset, 'range.endOffset' );715 assert.isFalse( range.collapsed, 'range.collapsed' );716 } : function() {717 // <p><b><i>[Enlarge</i> this]</b></p>718 // [<p><b><i>Enlarge</i> this</b></p>]719 var range = new CKEDITOR.dom.range( doc );720 range.setStart( doc.getById( '_EnlargeI2' ).getFirst(), 0 );721 range.setEnd( doc.getById( '_EnlargeB2' ), 2 );722 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );723 assert.areSame( document.getElementById( '_EnlargeP2' ).parentNode, range.startContainer.$, 'range.startContainer' );724 assert.areSame( doc.getById( '_EnlargeP2' ).getIndex(), range.startOffset, 'range.startOffset' );725 assert.areSame( document.getElementById( '_EnlargeP2' ).parentNode, range.endContainer.$, 'range.endContainer' );726 assert.areSame( doc.getById( '_EnlargeP2' ).getIndex() + 1, range.endOffset, 'range.endOffset' );727 assert.isFalse( range.collapsed, 'range.collapsed' );728 },729 test_enlarge_element8: CKEDITOR.env.version > 8 ?730 function() {731 // <p> Test <b> <i> [Enlarge</i> this</b> </p><p> <b> <i> Enlarge</i> this]</b> </p>732 // <p> Test [<b> <i> Enlarge</i> this</b> </p><p> <b> <i> Enlarge</i> this</b> </p>]733 var range = new CKEDITOR.dom.range( doc );734 range.setStart( doc.getById( '_EnlargeI' ).getFirst(), 2 );735 range.setEnd( doc.getById( '_EnlargeB2' ), 3 );736 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );737 assert.areSame( document.getElementById( '_EnlargeP' ), range.startContainer.$, 'range.startContainer' );738 assert.areSame( 1, range.startOffset, 'range.startOffset' );739 assert.areSame( document.getElementById( '_EnlargeP2' ).parentNode, range.endContainer.$, 'range.endContainer' );740 assert.areSame( doc.getById( '_EnlargeP2' ).getIndex() + 1, range.endOffset, 'range.endOffset' );741 assert.isFalse( range.collapsed, 'range.collapsed' );742 } : function() {743 // <p>Test <b><i>[Enlarge</i> this</b></p><p><b><i>Enlarge</i> this]</b></p>744 // <p>Test [<b><i>Enlarge</i> this</b></p><p><b><i>Enlarge</i> this</b></p>]745 var range = new CKEDITOR.dom.range( doc );746 range.setStart( doc.getById( '_EnlargeI' ).getFirst(), 0 );747 range.setEnd( doc.getById( '_EnlargeB2' ), 2 );748 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );749 assert.areSame( document.getElementById( '_EnlargeP' ), range.startContainer.$, 'range.startContainer' );750 assert.areSame( 1, range.startOffset, 'range.startOffset' );751 assert.areSame( document.getElementById( '_EnlargeP2' ).parentNode, range.endContainer.$, 'range.endContainer' );752 assert.areSame( doc.getById( '_EnlargeP2' ).getIndex() + 1, range.endOffset, 'range.endOffset' );753 assert.isFalse( range.collapsed, 'range.collapsed' );754 }755 } );756 bender.test( tests );...

Full Screen

Full Screen

code-points.js

Source:code-points.js Github

copy

Full Screen

...5 * @link https://tools.ietf.org/html/rfc3454#appendix-A.16 */7const unassigned_code_points = new Set([8 0x0221,9 ...range(0x0234, 0x024f),10 ...range(0x02ae, 0x02af),11 ...range(0x02ef, 0x02ff),12 ...range(0x0350, 0x035f),13 ...range(0x0370, 0x0373),14 ...range(0x0376, 0x0379),15 ...range(0x037b, 0x037d),16 ...range(0x037f, 0x0383),17 0x038b,18 0x038d,19 0x03a2,20 0x03cf,21 ...range(0x03f7, 0x03ff),22 0x0487,23 0x04cf,24 ...range(0x04f6, 0x04f7),25 ...range(0x04fa, 0x04ff),26 ...range(0x0510, 0x0530),27 ...range(0x0557, 0x0558),28 0x0560,29 0x0588,30 ...range(0x058b, 0x0590),31 0x05a2,32 0x05ba,33 ...range(0x05c5, 0x05cf),34 ...range(0x05eb, 0x05ef),35 ...range(0x05f5, 0x060b),36 ...range(0x060d, 0x061a),37 ...range(0x061c, 0x061e),38 0x0620,39 ...range(0x063b, 0x063f),40 ...range(0x0656, 0x065f),41 ...range(0x06ee, 0x06ef),42 0x06ff,43 0x070e,44 ...range(0x072d, 0x072f),45 ...range(0x074b, 0x077f),46 ...range(0x07b2, 0x0900),47 0x0904,48 ...range(0x093a, 0x093b),49 ...range(0x094e, 0x094f),50 ...range(0x0955, 0x0957),51 ...range(0x0971, 0x0980),52 0x0984,53 ...range(0x098d, 0x098e),54 ...range(0x0991, 0x0992),55 0x09a9,56 0x09b1,57 ...range(0x09b3, 0x09b5),58 ...range(0x09ba, 0x09bb),59 0x09bd,60 ...range(0x09c5, 0x09c6),61 ...range(0x09c9, 0x09ca),62 ...range(0x09ce, 0x09d6),63 ...range(0x09d8, 0x09db),64 0x09de,65 ...range(0x09e4, 0x09e5),66 ...range(0x09fb, 0x0a01),67 ...range(0x0a03, 0x0a04),68 ...range(0x0a0b, 0x0a0e),69 ...range(0x0a11, 0x0a12),70 0x0a29,71 0x0a31,72 0x0a34,73 0x0a37,74 ...range(0x0a3a, 0x0a3b),75 0x0a3d,76 ...range(0x0a43, 0x0a46),77 ...range(0x0a49, 0x0a4a),78 ...range(0x0a4e, 0x0a58),79 0x0a5d,80 ...range(0x0a5f, 0x0a65),81 ...range(0x0a75, 0x0a80),82 0x0a84,83 0x0a8c,84 0x0a8e,85 0x0a92,86 0x0aa9,87 0x0ab1,88 0x0ab4,89 ...range(0x0aba, 0x0abb),90 0x0ac6,91 0x0aca,92 ...range(0x0ace, 0x0acf),93 ...range(0x0ad1, 0x0adf),94 ...range(0x0ae1, 0x0ae5),95 ...range(0x0af0, 0x0b00),96 0x0b04,97 ...range(0x0b0d, 0x0b0e),98 ...range(0x0b11, 0x0b12),99 0x0b29,100 0x0b31,101 ...range(0x0b34, 0x0b35),102 ...range(0x0b3a, 0x0b3b),103 ...range(0x0b44, 0x0b46),104 ...range(0x0b49, 0x0b4a),105 ...range(0x0b4e, 0x0b55),106 ...range(0x0b58, 0x0b5b),107 0x0b5e,108 ...range(0x0b62, 0x0b65),109 ...range(0x0b71, 0x0b81),110 0x0b84,111 ...range(0x0b8b, 0x0b8d),112 0x0b91,113 ...range(0x0b96, 0x0b98),114 0x0b9b,115 0x0b9d,116 ...range(0x0ba0, 0x0ba2),117 ...range(0x0ba5, 0x0ba7),118 ...range(0x0bab, 0x0bad),119 0x0bb6,120 ...range(0x0bba, 0x0bbd),121 ...range(0x0bc3, 0x0bc5),122 0x0bc9,123 ...range(0x0bce, 0x0bd6),124 ...range(0x0bd8, 0x0be6),125 ...range(0x0bf3, 0x0c00),126 0x0c04,127 0x0c0d,128 0x0c11,129 0x0c29,130 0x0c34,131 ...range(0x0c3a, 0x0c3d),132 0x0c45,133 0x0c49,134 ...range(0x0c4e, 0x0c54),135 ...range(0x0c57, 0x0c5f),136 ...range(0x0c62, 0x0c65),137 ...range(0x0c70, 0x0c81),138 0x0c84,139 0x0c8d,140 0x0c91,141 0x0ca9,142 0x0cb4,143 ...range(0x0cba, 0x0cbd),144 0x0cc5,145 0x0cc9,146 ...range(0x0cce, 0x0cd4),147 ...range(0x0cd7, 0x0cdd),148 0x0cdf,149 ...range(0x0ce2, 0x0ce5),150 ...range(0x0cf0, 0x0d01),151 0x0d04,152 0x0d0d,153 0x0d11,154 0x0d29,155 ...range(0x0d3a, 0x0d3d),156 ...range(0x0d44, 0x0d45),157 0x0d49,158 ...range(0x0d4e, 0x0d56),159 ...range(0x0d58, 0x0d5f),160 ...range(0x0d62, 0x0d65),161 ...range(0x0d70, 0x0d81),162 0x0d84,163 ...range(0x0d97, 0x0d99),164 0x0db2,165 0x0dbc,166 ...range(0x0dbe, 0x0dbf),167 ...range(0x0dc7, 0x0dc9),168 ...range(0x0dcb, 0x0dce),169 0x0dd5,170 0x0dd7,171 ...range(0x0de0, 0x0df1),172 ...range(0x0df5, 0x0e00),173 ...range(0x0e3b, 0x0e3e),174 ...range(0x0e5c, 0x0e80),175 0x0e83,176 ...range(0x0e85, 0x0e86),177 0x0e89,178 ...range(0x0e8b, 0x0e8c),179 ...range(0x0e8e, 0x0e93),180 0x0e98,181 0x0ea0,182 0x0ea4,183 0x0ea6,184 ...range(0x0ea8, 0x0ea9),185 0x0eac,186 0x0eba,187 ...range(0x0ebe, 0x0ebf),188 0x0ec5,189 0x0ec7,190 ...range(0x0ece, 0x0ecf),191 ...range(0x0eda, 0x0edb),192 ...range(0x0ede, 0x0eff),193 0x0f48,194 ...range(0x0f6b, 0x0f70),195 ...range(0x0f8c, 0x0f8f),196 0x0f98,197 0x0fbd,198 ...range(0x0fcd, 0x0fce),199 ...range(0x0fd0, 0x0fff),200 0x1022,201 0x1028,202 0x102b,203 ...range(0x1033, 0x1035),204 ...range(0x103a, 0x103f),205 ...range(0x105a, 0x109f),206 ...range(0x10c6, 0x10cf),207 ...range(0x10f9, 0x10fa),208 ...range(0x10fc, 0x10ff),209 ...range(0x115a, 0x115e),210 ...range(0x11a3, 0x11a7),211 ...range(0x11fa, 0x11ff),212 0x1207,213 0x1247,214 0x1249,215 ...range(0x124e, 0x124f),216 0x1257,217 0x1259,218 ...range(0x125e, 0x125f),219 0x1287,220 0x1289,221 ...range(0x128e, 0x128f),222 0x12af,223 0x12b1,224 ...range(0x12b6, 0x12b7),225 0x12bf,226 0x12c1,227 ...range(0x12c6, 0x12c7),228 0x12cf,229 0x12d7,230 0x12ef,231 0x130f,232 0x1311,233 ...range(0x1316, 0x1317),234 0x131f,235 0x1347,236 ...range(0x135b, 0x1360),237 ...range(0x137d, 0x139f),238 ...range(0x13f5, 0x1400),239 ...range(0x1677, 0x167f),240 ...range(0x169d, 0x169f),241 ...range(0x16f1, 0x16ff),242 0x170d,243 ...range(0x1715, 0x171f),244 ...range(0x1737, 0x173f),245 ...range(0x1754, 0x175f),246 0x176d,247 0x1771,248 ...range(0x1774, 0x177f),249 ...range(0x17dd, 0x17df),250 ...range(0x17ea, 0x17ff),251 0x180f,252 ...range(0x181a, 0x181f),253 ...range(0x1878, 0x187f),254 ...range(0x18aa, 0x1dff),255 ...range(0x1e9c, 0x1e9f),256 ...range(0x1efa, 0x1eff),257 ...range(0x1f16, 0x1f17),258 ...range(0x1f1e, 0x1f1f),259 ...range(0x1f46, 0x1f47),260 ...range(0x1f4e, 0x1f4f),261 0x1f58,262 0x1f5a,263 0x1f5c,264 0x1f5e,265 ...range(0x1f7e, 0x1f7f),266 0x1fb5,267 0x1fc5,268 ...range(0x1fd4, 0x1fd5),269 0x1fdc,270 ...range(0x1ff0, 0x1ff1),271 0x1ff5,272 0x1fff,273 ...range(0x2053, 0x2056),274 ...range(0x2058, 0x205e),275 ...range(0x2064, 0x2069),276 ...range(0x2072, 0x2073),277 ...range(0x208f, 0x209f),278 ...range(0x20b2, 0x20cf),279 ...range(0x20eb, 0x20ff),280 ...range(0x213b, 0x213c),281 ...range(0x214c, 0x2152),282 ...range(0x2184, 0x218f),283 ...range(0x23cf, 0x23ff),284 ...range(0x2427, 0x243f),285 ...range(0x244b, 0x245f),286 0x24ff,287 ...range(0x2614, 0x2615),288 0x2618,289 ...range(0x267e, 0x267f),290 ...range(0x268a, 0x2700),291 0x2705,292 ...range(0x270a, 0x270b),293 0x2728,294 0x274c,295 0x274e,296 ...range(0x2753, 0x2755),297 0x2757,298 ...range(0x275f, 0x2760),299 ...range(0x2795, 0x2797),300 0x27b0,301 ...range(0x27bf, 0x27cf),302 ...range(0x27ec, 0x27ef),303 ...range(0x2b00, 0x2e7f),304 0x2e9a,305 ...range(0x2ef4, 0x2eff),306 ...range(0x2fd6, 0x2fef),307 ...range(0x2ffc, 0x2fff),308 0x3040,309 ...range(0x3097, 0x3098),310 ...range(0x3100, 0x3104),311 ...range(0x312d, 0x3130),312 0x318f,313 ...range(0x31b8, 0x31ef),314 ...range(0x321d, 0x321f),315 ...range(0x3244, 0x3250),316 ...range(0x327c, 0x327e),317 ...range(0x32cc, 0x32cf),318 0x32ff,319 ...range(0x3377, 0x337a),320 ...range(0x33de, 0x33df),321 0x33ff,322 ...range(0x4db6, 0x4dff),323 ...range(0x9fa6, 0x9fff),324 ...range(0xa48d, 0xa48f),325 ...range(0xa4c7, 0xabff),326 ...range(0xd7a4, 0xd7ff),327 ...range(0xfa2e, 0xfa2f),328 ...range(0xfa6b, 0xfaff),329 ...range(0xfb07, 0xfb12),330 ...range(0xfb18, 0xfb1c),331 0xfb37,332 0xfb3d,333 0xfb3f,334 0xfb42,335 0xfb45,336 ...range(0xfbb2, 0xfbd2),337 ...range(0xfd40, 0xfd4f),338 ...range(0xfd90, 0xfd91),339 ...range(0xfdc8, 0xfdcf),340 ...range(0xfdfd, 0xfdff),341 ...range(0xfe10, 0xfe1f),342 ...range(0xfe24, 0xfe2f),343 ...range(0xfe47, 0xfe48),344 0xfe53,345 0xfe67,346 ...range(0xfe6c, 0xfe6f),347 0xfe75,348 ...range(0xfefd, 0xfefe),349 0xff00,350 ...range(0xffbf, 0xffc1),351 ...range(0xffc8, 0xffc9),352 ...range(0xffd0, 0xffd1),353 ...range(0xffd8, 0xffd9),354 ...range(0xffdd, 0xffdf),355 0xffe7,356 ...range(0xffef, 0xfff8),357 ...range(0x10000, 0x102ff),358 0x1031f,359 ...range(0x10324, 0x1032f),360 ...range(0x1034b, 0x103ff),361 ...range(0x10426, 0x10427),362 ...range(0x1044e, 0x1cfff),363 ...range(0x1d0f6, 0x1d0ff),364 ...range(0x1d127, 0x1d129),365 ...range(0x1d1de, 0x1d3ff),366 0x1d455,367 0x1d49d,368 ...range(0x1d4a0, 0x1d4a1),369 ...range(0x1d4a3, 0x1d4a4),370 ...range(0x1d4a7, 0x1d4a8),371 0x1d4ad,372 0x1d4ba,373 0x1d4bc,374 0x1d4c1,375 0x1d4c4,376 0x1d506,377 ...range(0x1d50b, 0x1d50c),378 0x1d515,379 0x1d51d,380 0x1d53a,381 0x1d53f,382 0x1d545,383 ...range(0x1d547, 0x1d549),384 0x1d551,385 ...range(0x1d6a4, 0x1d6a7),386 ...range(0x1d7ca, 0x1d7cd),387 ...range(0x1d800, 0x1fffd),388 ...range(0x2a6d7, 0x2f7ff),389 ...range(0x2fa1e, 0x2fffd),390 ...range(0x30000, 0x3fffd),391 ...range(0x40000, 0x4fffd),392 ...range(0x50000, 0x5fffd),393 ...range(0x60000, 0x6fffd),394 ...range(0x70000, 0x7fffd),395 ...range(0x80000, 0x8fffd),396 ...range(0x90000, 0x9fffd),397 ...range(0xa0000, 0xafffd),398 ...range(0xb0000, 0xbfffd),399 ...range(0xc0000, 0xcfffd),400 ...range(0xd0000, 0xdfffd),401 0xe0000,402 ...range(0xe0002, 0xe001f),403 ...range(0xe0080, 0xefffd),404]);405/**406 * B.1 Commonly mapped to nothing407 * @link https://tools.ietf.org/html/rfc3454#appendix-B.1408 */409const commonly_mapped_to_nothing = new Set([410 0x00ad,411 0x034f,412 0x1806,413 0x180b,414 0x180c,415 0x180d,416 0x200b,417 0x200c,418 0x200d,419 0x2060,420 0xfe00,421 0xfe01,422 0xfe02,423 0xfe03,424 0xfe04,425 0xfe05,426 0xfe06,427 0xfe07,428 0xfe08,429 0xfe09,430 0xfe0a,431 0xfe0b,432 0xfe0c,433 0xfe0d,434 0xfe0e,435 0xfe0f,436 0xfeff,437]);438/**439 * C.1.2 Non-ASCII space characters440 * @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2441 */442const non_ASCII_space_characters = new Set([443 0x00a0 /* NO-BREAK SPACE */,444 0x1680 /* OGHAM SPACE MARK */,445 0x2000 /* EN QUAD */,446 0x2001 /* EM QUAD */,447 0x2002 /* EN SPACE */,448 0x2003 /* EM SPACE */,449 0x2004 /* THREE-PER-EM SPACE */,450 0x2005 /* FOUR-PER-EM SPACE */,451 0x2006 /* SIX-PER-EM SPACE */,452 0x2007 /* FIGURE SPACE */,453 0x2008 /* PUNCTUATION SPACE */,454 0x2009 /* THIN SPACE */,455 0x200a /* HAIR SPACE */,456 0x200b /* ZERO WIDTH SPACE */,457 0x202f /* NARROW NO-BREAK SPACE */,458 0x205f /* MEDIUM MATHEMATICAL SPACE */,459 0x3000 /* IDEOGRAPHIC SPACE */,460]);461/**462 * 2.3. Prohibited Output463 * @type {Set}464 */465const prohibited_characters = new Set([466 ...non_ASCII_space_characters,467 /**468 * C.2.1 ASCII control characters469 * @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1470 */471 ...range(0, 0x001f) /* [CONTROL CHARACTERS] */,472 0x007f /* DELETE */,473 /**474 * C.2.2 Non-ASCII control characters475 * @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2476 */477 ...range(0x0080, 0x009f) /* [CONTROL CHARACTERS] */,478 0x06dd /* ARABIC END OF AYAH */,479 0x070f /* SYRIAC ABBREVIATION MARK */,480 0x180e /* MONGOLIAN VOWEL SEPARATOR */,481 0x200c /* ZERO WIDTH NON-JOINER */,482 0x200d /* ZERO WIDTH JOINER */,483 0x2028 /* LINE SEPARATOR */,484 0x2029 /* PARAGRAPH SEPARATOR */,485 0x2060 /* WORD JOINER */,486 0x2061 /* FUNCTION APPLICATION */,487 0x2062 /* INVISIBLE TIMES */,488 0x2063 /* INVISIBLE SEPARATOR */,489 ...range(0x206a, 0x206f) /* [CONTROL CHARACTERS] */,490 0xfeff /* ZERO WIDTH NO-BREAK SPACE */,491 ...range(0xfff9, 0xfffc) /* [CONTROL CHARACTERS] */,492 ...range(0x1d173, 0x1d17a) /* [MUSICAL CONTROL CHARACTERS] */,493 /**494 * C.3 Private use495 * @link https://tools.ietf.org/html/rfc3454#appendix-C.3496 */497 ...range(0xe000, 0xf8ff) /* [PRIVATE USE, PLANE 0] */,498 ...range(0xf0000, 0xffffd) /* [PRIVATE USE, PLANE 15] */,499 ...range(0x100000, 0x10fffd) /* [PRIVATE USE, PLANE 16] */,500 /**501 * C.4 Non-character code points502 * @link https://tools.ietf.org/html/rfc3454#appendix-C.4503 */504 ...range(0xfdd0, 0xfdef) /* [NONCHARACTER CODE POINTS] */,505 ...range(0xfffe, 0xffff) /* [NONCHARACTER CODE POINTS] */,506 ...range(0x1fffe, 0x1ffff) /* [NONCHARACTER CODE POINTS] */,507 ...range(0x2fffe, 0x2ffff) /* [NONCHARACTER CODE POINTS] */,508 ...range(0x3fffe, 0x3ffff) /* [NONCHARACTER CODE POINTS] */,509 ...range(0x4fffe, 0x4ffff) /* [NONCHARACTER CODE POINTS] */,510 ...range(0x5fffe, 0x5ffff) /* [NONCHARACTER CODE POINTS] */,511 ...range(0x6fffe, 0x6ffff) /* [NONCHARACTER CODE POINTS] */,512 ...range(0x7fffe, 0x7ffff) /* [NONCHARACTER CODE POINTS] */,513 ...range(0x8fffe, 0x8ffff) /* [NONCHARACTER CODE POINTS] */,514 ...range(0x9fffe, 0x9ffff) /* [NONCHARACTER CODE POINTS] */,515 ...range(0xafffe, 0xaffff) /* [NONCHARACTER CODE POINTS] */,516 ...range(0xbfffe, 0xbffff) /* [NONCHARACTER CODE POINTS] */,517 ...range(0xcfffe, 0xcffff) /* [NONCHARACTER CODE POINTS] */,518 ...range(0xdfffe, 0xdffff) /* [NONCHARACTER CODE POINTS] */,519 ...range(0xefffe, 0xeffff) /* [NONCHARACTER CODE POINTS] */,520 ...range(0x10fffe, 0x10ffff) /* [NONCHARACTER CODE POINTS] */,521 /**522 * C.5 Surrogate codes523 * @link https://tools.ietf.org/html/rfc3454#appendix-C.5524 */525 ...range(0xd800, 0xdfff),526 /**527 * C.6 Inappropriate for plain text528 * @link https://tools.ietf.org/html/rfc3454#appendix-C.6529 */530 0xfff9 /* INTERLINEAR ANNOTATION ANCHOR */,531 0xfffa /* INTERLINEAR ANNOTATION SEPARATOR */,532 0xfffb /* INTERLINEAR ANNOTATION TERMINATOR */,533 0xfffc /* OBJECT REPLACEMENT CHARACTER */,534 0xfffd /* REPLACEMENT CHARACTER */,535 /**536 * C.7 Inappropriate for canonical representation537 * @link https://tools.ietf.org/html/rfc3454#appendix-C.7538 */539 ...range(0x2ff0, 0x2ffb) /* [IDEOGRAPHIC DESCRIPTION CHARACTERS] */,540 /**541 * C.8 Change display properties or are deprecated542 * @link https://tools.ietf.org/html/rfc3454#appendix-C.8543 */544 0x0340 /* COMBINING GRAVE TONE MARK */,545 0x0341 /* COMBINING ACUTE TONE MARK */,546 0x200e /* LEFT-TO-RIGHT MARK */,547 0x200f /* RIGHT-TO-LEFT MARK */,548 0x202a /* LEFT-TO-RIGHT EMBEDDING */,549 0x202b /* RIGHT-TO-LEFT EMBEDDING */,550 0x202c /* POP DIRECTIONAL FORMATTING */,551 0x202d /* LEFT-TO-RIGHT OVERRIDE */,552 0x202e /* RIGHT-TO-LEFT OVERRIDE */,553 0x206a /* INHIBIT SYMMETRIC SWAPPING */,554 0x206b /* ACTIVATE SYMMETRIC SWAPPING */,555 0x206c /* INHIBIT ARABIC FORM SHAPING */,556 0x206d /* ACTIVATE ARABIC FORM SHAPING */,557 0x206e /* NATIONAL DIGIT SHAPES */,558 0x206f /* NOMINAL DIGIT SHAPES */,559 /**560 * C.9 Tagging characters561 * @link https://tools.ietf.org/html/rfc3454#appendix-C.9562 */563 0xe0001 /* LANGUAGE TAG */,564 ...range(0xe0020, 0xe007f) /* [TAGGING CHARACTERS] */,565]);566/**567 * D.1 Characters with bidirectional property "R" or "AL"568 * @link https://tools.ietf.org/html/rfc3454#appendix-D.1569 */570const bidirectional_r_al = new Set([571 0x05be,572 0x05c0,573 0x05c3,574 ...range(0x05d0, 0x05ea),575 ...range(0x05f0, 0x05f4),576 0x061b,577 0x061f,578 ...range(0x0621, 0x063a),579 ...range(0x0640, 0x064a),580 ...range(0x066d, 0x066f),581 ...range(0x0671, 0x06d5),582 0x06dd,583 ...range(0x06e5, 0x06e6),584 ...range(0x06fa, 0x06fe),585 ...range(0x0700, 0x070d),586 0x0710,587 ...range(0x0712, 0x072c),588 ...range(0x0780, 0x07a5),589 0x07b1,590 0x200f,591 0xfb1d,592 ...range(0xfb1f, 0xfb28),593 ...range(0xfb2a, 0xfb36),594 ...range(0xfb38, 0xfb3c),595 0xfb3e,596 ...range(0xfb40, 0xfb41),597 ...range(0xfb43, 0xfb44),598 ...range(0xfb46, 0xfbb1),599 ...range(0xfbd3, 0xfd3d),600 ...range(0xfd50, 0xfd8f),601 ...range(0xfd92, 0xfdc7),602 ...range(0xfdf0, 0xfdfc),603 ...range(0xfe70, 0xfe74),604 ...range(0xfe76, 0xfefc),605]);606/**607 * D.2 Characters with bidirectional property "L"608 * @link https://tools.ietf.org/html/rfc3454#appendix-D.2609 */610const bidirectional_l = new Set([611 ...range(0x0041, 0x005a),612 ...range(0x0061, 0x007a),613 0x00aa,614 0x00b5,615 0x00ba,616 ...range(0x00c0, 0x00d6),617 ...range(0x00d8, 0x00f6),618 ...range(0x00f8, 0x0220),619 ...range(0x0222, 0x0233),620 ...range(0x0250, 0x02ad),621 ...range(0x02b0, 0x02b8),622 ...range(0x02bb, 0x02c1),623 ...range(0x02d0, 0x02d1),624 ...range(0x02e0, 0x02e4),625 0x02ee,626 0x037a,627 0x0386,628 ...range(0x0388, 0x038a),629 0x038c,630 ...range(0x038e, 0x03a1),631 ...range(0x03a3, 0x03ce),632 ...range(0x03d0, 0x03f5),633 ...range(0x0400, 0x0482),634 ...range(0x048a, 0x04ce),635 ...range(0x04d0, 0x04f5),636 ...range(0x04f8, 0x04f9),637 ...range(0x0500, 0x050f),638 ...range(0x0531, 0x0556),639 ...range(0x0559, 0x055f),640 ...range(0x0561, 0x0587),641 0x0589,642 0x0903,643 ...range(0x0905, 0x0939),644 ...range(0x093d, 0x0940),645 ...range(0x0949, 0x094c),646 0x0950,647 ...range(0x0958, 0x0961),648 ...range(0x0964, 0x0970),649 ...range(0x0982, 0x0983),650 ...range(0x0985, 0x098c),651 ...range(0x098f, 0x0990),652 ...range(0x0993, 0x09a8),653 ...range(0x09aa, 0x09b0),654 0x09b2,655 ...range(0x09b6, 0x09b9),656 ...range(0x09be, 0x09c0),657 ...range(0x09c7, 0x09c8),658 ...range(0x09cb, 0x09cc),659 0x09d7,660 ...range(0x09dc, 0x09dd),661 ...range(0x09df, 0x09e1),662 ...range(0x09e6, 0x09f1),663 ...range(0x09f4, 0x09fa),664 ...range(0x0a05, 0x0a0a),665 ...range(0x0a0f, 0x0a10),666 ...range(0x0a13, 0x0a28),667 ...range(0x0a2a, 0x0a30),668 ...range(0x0a32, 0x0a33),669 ...range(0x0a35, 0x0a36),670 ...range(0x0a38, 0x0a39),671 ...range(0x0a3e, 0x0a40),672 ...range(0x0a59, 0x0a5c),673 0x0a5e,674 ...range(0x0a66, 0x0a6f),675 ...range(0x0a72, 0x0a74),676 0x0a83,677 ...range(0x0a85, 0x0a8b),678 0x0a8d,679 ...range(0x0a8f, 0x0a91),680 ...range(0x0a93, 0x0aa8),681 ...range(0x0aaa, 0x0ab0),682 ...range(0x0ab2, 0x0ab3),683 ...range(0x0ab5, 0x0ab9),684 ...range(0x0abd, 0x0ac0),685 0x0ac9,686 ...range(0x0acb, 0x0acc),687 0x0ad0,688 0x0ae0,689 ...range(0x0ae6, 0x0aef),690 ...range(0x0b02, 0x0b03),691 ...range(0x0b05, 0x0b0c),692 ...range(0x0b0f, 0x0b10),693 ...range(0x0b13, 0x0b28),694 ...range(0x0b2a, 0x0b30),695 ...range(0x0b32, 0x0b33),696 ...range(0x0b36, 0x0b39),697 ...range(0x0b3d, 0x0b3e),698 0x0b40,699 ...range(0x0b47, 0x0b48),700 ...range(0x0b4b, 0x0b4c),701 0x0b57,702 ...range(0x0b5c, 0x0b5d),703 ...range(0x0b5f, 0x0b61),704 ...range(0x0b66, 0x0b70),705 0x0b83,706 ...range(0x0b85, 0x0b8a),707 ...range(0x0b8e, 0x0b90),708 ...range(0x0b92, 0x0b95),709 ...range(0x0b99, 0x0b9a),710 0x0b9c,711 ...range(0x0b9e, 0x0b9f),712 ...range(0x0ba3, 0x0ba4),713 ...range(0x0ba8, 0x0baa),714 ...range(0x0bae, 0x0bb5),715 ...range(0x0bb7, 0x0bb9),716 ...range(0x0bbe, 0x0bbf),717 ...range(0x0bc1, 0x0bc2),718 ...range(0x0bc6, 0x0bc8),719 ...range(0x0bca, 0x0bcc),720 0x0bd7,721 ...range(0x0be7, 0x0bf2),722 ...range(0x0c01, 0x0c03),723 ...range(0x0c05, 0x0c0c),724 ...range(0x0c0e, 0x0c10),725 ...range(0x0c12, 0x0c28),726 ...range(0x0c2a, 0x0c33),727 ...range(0x0c35, 0x0c39),728 ...range(0x0c41, 0x0c44),729 ...range(0x0c60, 0x0c61),730 ...range(0x0c66, 0x0c6f),731 ...range(0x0c82, 0x0c83),732 ...range(0x0c85, 0x0c8c),733 ...range(0x0c8e, 0x0c90),734 ...range(0x0c92, 0x0ca8),735 ...range(0x0caa, 0x0cb3),736 ...range(0x0cb5, 0x0cb9),737 0x0cbe,738 ...range(0x0cc0, 0x0cc4),739 ...range(0x0cc7, 0x0cc8),740 ...range(0x0cca, 0x0ccb),741 ...range(0x0cd5, 0x0cd6),742 0x0cde,743 ...range(0x0ce0, 0x0ce1),744 ...range(0x0ce6, 0x0cef),745 ...range(0x0d02, 0x0d03),746 ...range(0x0d05, 0x0d0c),747 ...range(0x0d0e, 0x0d10),748 ...range(0x0d12, 0x0d28),749 ...range(0x0d2a, 0x0d39),750 ...range(0x0d3e, 0x0d40),751 ...range(0x0d46, 0x0d48),752 ...range(0x0d4a, 0x0d4c),753 0x0d57,754 ...range(0x0d60, 0x0d61),755 ...range(0x0d66, 0x0d6f),756 ...range(0x0d82, 0x0d83),757 ...range(0x0d85, 0x0d96),758 ...range(0x0d9a, 0x0db1),759 ...range(0x0db3, 0x0dbb),760 0x0dbd,761 ...range(0x0dc0, 0x0dc6),762 ...range(0x0dcf, 0x0dd1),763 ...range(0x0dd8, 0x0ddf),764 ...range(0x0df2, 0x0df4),765 ...range(0x0e01, 0x0e30),766 ...range(0x0e32, 0x0e33),767 ...range(0x0e40, 0x0e46),768 ...range(0x0e4f, 0x0e5b),769 ...range(0x0e81, 0x0e82),770 0x0e84,771 ...range(0x0e87, 0x0e88),772 0x0e8a,773 0x0e8d,774 ...range(0x0e94, 0x0e97),775 ...range(0x0e99, 0x0e9f),776 ...range(0x0ea1, 0x0ea3),777 0x0ea5,778 0x0ea7,779 ...range(0x0eaa, 0x0eab),780 ...range(0x0ead, 0x0eb0),781 ...range(0x0eb2, 0x0eb3),782 0x0ebd,783 ...range(0x0ec0, 0x0ec4),784 0x0ec6,785 ...range(0x0ed0, 0x0ed9),786 ...range(0x0edc, 0x0edd),787 ...range(0x0f00, 0x0f17),788 ...range(0x0f1a, 0x0f34),789 0x0f36,790 0x0f38,791 ...range(0x0f3e, 0x0f47),792 ...range(0x0f49, 0x0f6a),793 0x0f7f,794 0x0f85,795 ...range(0x0f88, 0x0f8b),796 ...range(0x0fbe, 0x0fc5),797 ...range(0x0fc7, 0x0fcc),798 0x0fcf,799 ...range(0x1000, 0x1021),800 ...range(0x1023, 0x1027),801 ...range(0x1029, 0x102a),802 0x102c,803 0x1031,804 0x1038,805 ...range(0x1040, 0x1057),806 ...range(0x10a0, 0x10c5),807 ...range(0x10d0, 0x10f8),808 0x10fb,809 ...range(0x1100, 0x1159),810 ...range(0x115f, 0x11a2),811 ...range(0x11a8, 0x11f9),812 ...range(0x1200, 0x1206),813 ...range(0x1208, 0x1246),814 0x1248,815 ...range(0x124a, 0x124d),816 ...range(0x1250, 0x1256),817 0x1258,818 ...range(0x125a, 0x125d),819 ...range(0x1260, 0x1286),820 0x1288,821 ...range(0x128a, 0x128d),822 ...range(0x1290, 0x12ae),823 0x12b0,824 ...range(0x12b2, 0x12b5),825 ...range(0x12b8, 0x12be),826 0x12c0,827 ...range(0x12c2, 0x12c5),828 ...range(0x12c8, 0x12ce),829 ...range(0x12d0, 0x12d6),830 ...range(0x12d8, 0x12ee),831 ...range(0x12f0, 0x130e),832 0x1310,833 ...range(0x1312, 0x1315),834 ...range(0x1318, 0x131e),835 ...range(0x1320, 0x1346),836 ...range(0x1348, 0x135a),837 ...range(0x1361, 0x137c),838 ...range(0x13a0, 0x13f4),839 ...range(0x1401, 0x1676),840 ...range(0x1681, 0x169a),841 ...range(0x16a0, 0x16f0),842 ...range(0x1700, 0x170c),843 ...range(0x170e, 0x1711),844 ...range(0x1720, 0x1731),845 ...range(0x1735, 0x1736),846 ...range(0x1740, 0x1751),847 ...range(0x1760, 0x176c),848 ...range(0x176e, 0x1770),849 ...range(0x1780, 0x17b6),850 ...range(0x17be, 0x17c5),851 ...range(0x17c7, 0x17c8),852 ...range(0x17d4, 0x17da),853 0x17dc,854 ...range(0x17e0, 0x17e9),855 ...range(0x1810, 0x1819),856 ...range(0x1820, 0x1877),857 ...range(0x1880, 0x18a8),858 ...range(0x1e00, 0x1e9b),859 ...range(0x1ea0, 0x1ef9),860 ...range(0x1f00, 0x1f15),861 ...range(0x1f18, 0x1f1d),862 ...range(0x1f20, 0x1f45),863 ...range(0x1f48, 0x1f4d),864 ...range(0x1f50, 0x1f57),865 0x1f59,866 0x1f5b,867 0x1f5d,868 ...range(0x1f5f, 0x1f7d),869 ...range(0x1f80, 0x1fb4),870 ...range(0x1fb6, 0x1fbc),871 0x1fbe,872 ...range(0x1fc2, 0x1fc4),873 ...range(0x1fc6, 0x1fcc),874 ...range(0x1fd0, 0x1fd3),875 ...range(0x1fd6, 0x1fdb),876 ...range(0x1fe0, 0x1fec),877 ...range(0x1ff2, 0x1ff4),878 ...range(0x1ff6, 0x1ffc),879 0x200e,880 0x2071,881 0x207f,882 0x2102,883 0x2107,884 ...range(0x210a, 0x2113),885 0x2115,886 ...range(0x2119, 0x211d),887 0x2124,888 0x2126,889 0x2128,890 ...range(0x212a, 0x212d),891 ...range(0x212f, 0x2131),892 ...range(0x2133, 0x2139),893 ...range(0x213d, 0x213f),894 ...range(0x2145, 0x2149),895 ...range(0x2160, 0x2183),896 ...range(0x2336, 0x237a),897 0x2395,898 ...range(0x249c, 0x24e9),899 ...range(0x3005, 0x3007),900 ...range(0x3021, 0x3029),901 ...range(0x3031, 0x3035),902 ...range(0x3038, 0x303c),903 ...range(0x3041, 0x3096),904 ...range(0x309d, 0x309f),905 ...range(0x30a1, 0x30fa),906 ...range(0x30fc, 0x30ff),907 ...range(0x3105, 0x312c),908 ...range(0x3131, 0x318e),909 ...range(0x3190, 0x31b7),910 ...range(0x31f0, 0x321c),911 ...range(0x3220, 0x3243),912 ...range(0x3260, 0x327b),913 ...range(0x327f, 0x32b0),914 ...range(0x32c0, 0x32cb),915 ...range(0x32d0, 0x32fe),916 ...range(0x3300, 0x3376),917 ...range(0x337b, 0x33dd),918 ...range(0x33e0, 0x33fe),919 ...range(0x3400, 0x4db5),920 ...range(0x4e00, 0x9fa5),921 ...range(0xa000, 0xa48c),922 ...range(0xac00, 0xd7a3),923 ...range(0xd800, 0xfa2d),924 ...range(0xfa30, 0xfa6a),925 ...range(0xfb00, 0xfb06),926 ...range(0xfb13, 0xfb17),927 ...range(0xff21, 0xff3a),928 ...range(0xff41, 0xff5a),929 ...range(0xff66, 0xffbe),930 ...range(0xffc2, 0xffc7),931 ...range(0xffca, 0xffcf),932 ...range(0xffd2, 0xffd7),933 ...range(0xffda, 0xffdc),934 ...range(0x10300, 0x1031e),935 ...range(0x10320, 0x10323),936 ...range(0x10330, 0x1034a),937 ...range(0x10400, 0x10425),938 ...range(0x10428, 0x1044d),939 ...range(0x1d000, 0x1d0f5),940 ...range(0x1d100, 0x1d126),941 ...range(0x1d12a, 0x1d166),942 ...range(0x1d16a, 0x1d172),943 ...range(0x1d183, 0x1d184),944 ...range(0x1d18c, 0x1d1a9),945 ...range(0x1d1ae, 0x1d1dd),946 ...range(0x1d400, 0x1d454),947 ...range(0x1d456, 0x1d49c),948 ...range(0x1d49e, 0x1d49f),949 0x1d4a2,950 ...range(0x1d4a5, 0x1d4a6),951 ...range(0x1d4a9, 0x1d4ac),952 ...range(0x1d4ae, 0x1d4b9),953 0x1d4bb,954 ...range(0x1d4bd, 0x1d4c0),955 ...range(0x1d4c2, 0x1d4c3),956 ...range(0x1d4c5, 0x1d505),957 ...range(0x1d507, 0x1d50a),958 ...range(0x1d50d, 0x1d514),959 ...range(0x1d516, 0x1d51c),960 ...range(0x1d51e, 0x1d539),961 ...range(0x1d53b, 0x1d53e),962 ...range(0x1d540, 0x1d544),963 0x1d546,964 ...range(0x1d54a, 0x1d550),965 ...range(0x1d552, 0x1d6a3),966 ...range(0x1d6a8, 0x1d7c9),967 ...range(0x20000, 0x2a6d6),968 ...range(0x2f800, 0x2fa1d),969 ...range(0xf0000, 0xffffd),970 ...range(0x100000, 0x10fffd),971]);972module.exports = {973 unassigned_code_points,974 commonly_mapped_to_nothing,975 non_ASCII_space_characters,976 prohibited_characters,977 bidirectional_r_al,978 bidirectional_l,...

Full Screen

Full Screen

range-class.js

Source:range-class.js Github

copy

Full Screen

1import $ from 'dom7';2import Utils from '../../utils/utils';3import Framework7Class from '../../utils/class';4import Support from '../../utils/support';5class Range extends Framework7Class {6 constructor(app, params) {7 super(params, [app]);8 const range = this;9 const defaults = {10 el: null,11 inputEl: null,12 dual: false,13 step: 1,14 label: false,15 min: 0,16 max: 100,17 value: 0,18 draggableBar: true,19 };20 // Extend defaults with modules params21 range.useModulesParams(defaults);22 range.params = Utils.extend(defaults, params);23 const el = range.params.el;24 if (!el) return range;25 const $el = $(el);26 if ($el.length === 0) return range;27 if ($el[0].f7Range) return $el[0].f7Range;28 const dataset = $el.dataset();29 ('step min max value').split(' ').forEach((paramName) => {30 if (typeof params[paramName] === 'undefined' && typeof dataset[paramName] !== 'undefined') {31 range.params[paramName] = parseFloat(dataset[paramName]);32 }33 });34 ('dual label').split(' ').forEach((paramName) => {35 if (typeof params[paramName] === 'undefined' && typeof dataset[paramName] !== 'undefined') {36 range.params[paramName] = dataset[paramName];37 }38 });39 if (!range.params.value) {40 if (typeof dataset.value !== 'undefined') range.params.value = dataset.value;41 if (typeof dataset.valueLeft !== 'undefined' && typeof dataset.valueRight !== 'undefined') {42 range.params.value = [parseFloat(dataset.valueLeft), parseFloat(dataset.valueRight)];43 }44 }45 let $inputEl;46 if (!range.params.dual) {47 if (range.params.inputEl) {48 $inputEl = $(range.params.inputEl);49 } else if ($el.find('input[type="range"]').length) {50 $inputEl = $el.find('input[type="range"]').eq(0);51 }52 }53 const { dual, step, label, min, max, value } = range.params;54 Utils.extend(range, {55 $el,56 el: $el[0],57 $inputEl,58 inputEl: $inputEl ? $inputEl[0] : undefined,59 dual,60 step,61 label,62 min,63 max,64 value,65 previousValue: value,66 });67 if ($inputEl) {68 ('step min max').split(' ').forEach((paramName) => {69 if (!params[paramName] && $inputEl.attr(paramName)) {70 range.params[paramName] = parseFloat($inputEl.attr(paramName));71 range[paramName] = parseFloat($inputEl.attr(paramName));72 }73 });74 if (typeof $inputEl.val() !== 'undefined') {75 range.params.value = parseFloat($inputEl.val());76 range.value = parseFloat($inputEl.val());77 }78 }79 // Dual80 if (range.dual) {81 $el.addClass('range-slider-dual');82 }83 if (range.label) {84 $el.addClass('range-slider-label');85 }86 // Check for layout87 const $barEl = $('<div class="range-bar"></div>');88 const $barActiveEl = $('<div class="range-bar-active"></div>');89 $barEl.append($barActiveEl);90 // Create Knobs91 const knobHTML = `92 <div class="range-knob-wrap">93 <div class="range-knob"></div>94 ${range.label ? '<div class="range-knob-label"></div>' : ''}95 </div>96 `;97 const knobs = [$(knobHTML)];98 const labels = [];99 if (range.dual) {100 knobs.push($(knobHTML));101 }102 $el.append($barEl);103 knobs.forEach(($knobEl) => {104 $el.append($knobEl);105 });106 // Labels107 if (range.label) {108 labels.push(knobs[0].find('.range-knob-label'));109 if (range.dual) {110 labels.push(knobs[1].find('.range-knob-label'));111 }112 }113 Utils.extend(range, {114 app,115 knobs,116 labels,117 $barEl,118 $barActiveEl,119 });120 $el[0].f7Range = range;121 // Touch Events122 let isTouched;123 const touchesStart = {};124 let isScrolling;125 let rangeOffsetLeft;126 let $touchedKnobEl;127 let dualValueIndex;128 let valueChangedByTouch;129 function onTouchChange() {130 valueChangedByTouch = true;131 }132 function handleTouchStart(e) {133 if (isTouched) return;134 if (!range.params.draggableBar) {135 if ($(e.target).closest('.range-knob').length === 0) {136 return;137 }138 }139 valueChangedByTouch = false;140 touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;141 touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;142 isTouched = true;143 isScrolling = undefined;144 rangeOffsetLeft = $el.offset().left;145 let progress;146 if (range.app.rtl) {147 progress = ((rangeOffsetLeft + range.rangeWidth) - touchesStart.x) / range.rangeWidth;148 } else {149 progress = (touchesStart.x - rangeOffsetLeft) / range.rangeWidth;150 }151 let newValue = (progress * (range.max - range.min)) + range.min;152 if (range.dual) {153 if (Math.abs(range.value[0] - newValue) < Math.abs(range.value[1] - newValue)) {154 dualValueIndex = 0;155 $touchedKnobEl = range.knobs[0];156 newValue = [newValue, range.value[1]];157 } else {158 dualValueIndex = 1;159 $touchedKnobEl = range.knobs[1];160 newValue = [range.value[0], newValue];161 }162 } else {163 $touchedKnobEl = range.knobs[0];164 newValue = (progress * (range.max - range.min)) + range.min;165 }166 Utils.nextTick(() => {167 if (isTouched) $touchedKnobEl.addClass('range-knob-active-state');168 }, 70);169 range.on('change', onTouchChange);170 range.setValue(newValue, true);171 }172 function handleTouchMove(e) {173 if (!isTouched) return;174 const pageX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;175 const pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;176 if (typeof isScrolling === 'undefined') {177 isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) > Math.abs(pageX - touchesStart.x));178 }179 if (isScrolling) {180 isTouched = false;181 return;182 }183 e.preventDefault();184 let progress;185 if (range.app.rtl) {186 progress = ((rangeOffsetLeft + range.rangeWidth) - pageX) / range.rangeWidth;187 } else {188 progress = (pageX - rangeOffsetLeft) / range.rangeWidth;189 }190 let newValue = (progress * (range.max - range.min)) + range.min;191 if (range.dual) {192 let leftValue;193 let rightValue;194 if (dualValueIndex === 0) {195 leftValue = newValue;196 rightValue = range.value[1];197 if (leftValue > rightValue) {198 rightValue = leftValue;199 }200 } else {201 leftValue = range.value[0];202 rightValue = newValue;203 if (rightValue < leftValue) {204 leftValue = rightValue;205 }206 }207 newValue = [leftValue, rightValue];208 }209 range.setValue(newValue, true);210 }211 function handleTouchEnd() {212 if (!isTouched) {213 if (isScrolling) $touchedKnobEl.removeClass('range-knob-active-state');214 isTouched = false;215 return;216 }217 range.off('change', onTouchChange);218 isTouched = false;219 $touchedKnobEl.removeClass('range-knob-active-state');220 if (valueChangedByTouch && range.$inputEl && !range.dual) {221 range.$inputEl.trigger('change');222 }223 valueChangedByTouch = false;224 if (typeof range.previousValue !== 'undefined') {225 if (226 (227 range.dual228 && (229 range.previousValue[0] !== range.value[0]230 || range.previousValue[1] !== range.value[1]231 )232 )233 || (234 !range.dual235 && range.previousValue !== range.value236 )237 ) {238 range.$el.trigger('range:changed', range, range.value);239 range.emit('local::changed rangeChanged', range, range.value);240 }241 }242 }243 function handleResize() {244 range.calcSize();245 range.layout();246 }247 range.attachEvents = function attachEvents() {248 const passive = Support.passiveListener ? { passive: true } : false;249 range.$el.on(app.touchEvents.start, handleTouchStart, passive);250 app.on('touchmove', handleTouchMove);251 app.on('touchend:passive', handleTouchEnd);252 app.on('tabShow', handleResize);253 app.on('resize', handleResize);254 range.$el255 .parents('.sheet-modal, .actions-modal, .popup, .popover, .login-screen, .dialog, .toast')256 .on('modal:open', handleResize);257 range.$el258 .parents('.panel')259 .on('panel:open', handleResize);260 };261 range.detachEvents = function detachEvents() {262 const passive = Support.passiveListener ? { passive: true } : false;263 range.$el.off(app.touchEvents.start, handleTouchStart, passive);264 app.off('touchmove', handleTouchMove);265 app.off('touchend:passive', handleTouchEnd);266 app.off('tabShow', handleResize);267 app.off('resize', handleResize);268 range.$el269 .parents('.sheet-modal, .actions-modal, .popup, .popover, .login-screen, .dialog, .toast')270 .off('modal:open', handleResize);271 range.$el272 .parents('.panel')273 .off('panel:open', handleResize);274 };275 // Install Modules276 range.useModules();277 // Init278 range.init();279 return range;280 }281 calcSize() {282 const range = this;283 const width = range.$el.outerWidth();284 if (width === 0) return;285 range.rangeWidth = width;286 range.knobWidth = range.knobs[0].outerWidth();287 }288 layout() {289 const range = this;290 const {291 app,292 knobWidth,293 rangeWidth,294 min,295 max,296 knobs,297 $barActiveEl,298 value,299 label,300 labels,301 } = range;302 const positionProperty = app.rtl ? 'right' : 'left';303 if (range.dual) {304 const progress = [((value[0] - min) / (max - min)), ((value[1] - min) / (max - min))];305 $barActiveEl.css({306 [positionProperty]: `${progress[0] * 100}%`,307 width: `${(progress[1] - progress[0]) * 100}%`,308 });309 knobs.forEach(($knobEl, knobIndex) => {310 let leftPos = rangeWidth * progress[knobIndex];311 const realLeft = (rangeWidth * progress[knobIndex]) - (knobWidth / 2);312 if (realLeft < 0) leftPos = knobWidth / 2;313 if ((realLeft + knobWidth) > rangeWidth) leftPos = rangeWidth - (knobWidth / 2);314 $knobEl.css(positionProperty, `${leftPos}px`);315 if (label) labels[knobIndex].text(value[knobIndex]);316 });317 } else {318 const progress = ((value - min) / (max - min));319 $barActiveEl.css('width', `${progress * 100}%`);320 let leftPos = rangeWidth * progress;321 const realLeft = (rangeWidth * progress) - (knobWidth / 2);322 if (realLeft < 0) leftPos = knobWidth / 2;323 if ((realLeft + knobWidth) > rangeWidth) leftPos = rangeWidth - (knobWidth / 2);324 knobs[0].css(positionProperty, `${leftPos}px`);325 if (label) labels[0].text(value);326 }327 if ((range.dual && value.indexOf(min) >= 0) || (!range.dual && value === min)) {328 range.$el.addClass('range-slider-min');329 } else {330 range.$el.removeClass('range-slider-min');331 }332 if ((range.dual && value.indexOf(max) >= 0) || (!range.dual && value === max)) {333 range.$el.addClass('range-slider-max');334 } else {335 range.$el.removeClass('range-slider-max');336 }337 }338 setValue(newValue, byTouchMove) {339 const range = this;340 const { step, min, max } = range;341 let valueChanged;342 let oldValue;343 if (range.dual) {344 oldValue = [range.value[0], range.value[1]];345 let newValues = newValue;346 if (!Array.isArray(newValues)) newValues = [newValue, newValue];347 if (newValue[0] > newValue[1]) {348 newValues = [newValues[0], newValues[0]];349 }350 newValues = newValues.map(value => Math.max(Math.min(Math.round(value / step) * step, max), min));351 if (newValues[0] === range.value[0] && newValues[1] === range.value[1]) {352 return range;353 }354 newValues.forEach((value, valueIndex) => {355 range.value[valueIndex] = value;356 });357 valueChanged = oldValue[0] !== newValues[0] || oldValue[1] !== newValues[1];358 range.layout();359 } else {360 oldValue = range.value;361 const value = Math.max(Math.min(Math.round(newValue / step) * step, max), min);362 range.value = value;363 range.layout();364 valueChanged = oldValue !== value;365 }366 if (valueChanged) {367 range.previousValue = oldValue;368 }369 // Events370 if (!valueChanged) return range;371 range.$el.trigger('range:change', range, range.value);372 if (range.$inputEl && !range.dual) {373 range.$inputEl.val(range.value);374 if (!byTouchMove) {375 range.$inputEl.trigger('input change');376 } else {377 range.$inputEl.trigger('input');378 }379 }380 if (!byTouchMove) {381 range.$el.trigger('range:changed', range, range.value);382 range.emit('local::changed rangeChanged', range, range.value);383 }384 range.emit('local::change rangeChange', range, range.value);385 return range;386 }387 getValue() {388 return this.value;389 }390 init() {391 const range = this;392 range.calcSize();393 range.layout();394 range.attachEvents();395 return range;396 }397 destroy() {398 let range = this;399 range.$el.trigger('range:beforedestroy', range);400 range.emit('local::beforeDestroy rangeBeforeDestroy', range);401 delete range.$el[0].f7Range;402 range.detachEvents();403 Utils.deleteProps(range);404 range = null;405 }406}...

Full Screen

Full Screen

rangeDragger.js

Source:rangeDragger.js Github

copy

Full Screen

...46 Range_dragger.parent.labelElement().attr("transform") === "translate(0,-15)") {47 var prop = Range_dragger.parent;48 Range_dragger.parent.inverse().inverse(null);49 Range_dragger.parent.inverse(null);50 prop.range(newRange);51 } else {52 Range_dragger.parent.range(newRange);53 }54 // update the position of the new range55 var rX = newRange.x;56 var rY = newRange.y;57 var dX = Range_dragger.parent.domain().x;58 var dY = Range_dragger.parent.domain().y;59 // center60 var cX = 0.49 * (dX + rX);61 var cY = 0.49 * (dY + rY);62 // put position there;63 Range_dragger.parent.labelElement().x = cX;64 Range_dragger.parent.labelElement().px = cX;65 Range_dragger.parent.labelElement().y = cY;66 Range_dragger.parent.labelElement().py = cY;67 };68 Range_dragger.setParentProperty = function(parentProperty, inversed) {69 Range_dragger.parent = parentProperty;70 var iP;71 var renElem;72 Range_dragger.isLoopProperty = false;73 if (parentProperty.domain() === parentProperty.range()) Range_dragger.isLoopProperty = true;74 Range_dragger.parent = parentProperty;75 renElem = parentProperty.labelObject();76 if (inversed === true) {77 if (parentProperty.labelElement() && parentProperty.labelElement().attr("transform") === "translate(0,15)") {78 iP = renElem.linkDomainIntersection;79 if (renElem.linkDomainIntersection) {80 Range_dragger.x = iP.x;81 Range_dragger.y = iP.y;82 }83 } else {84 iP = renElem.linkRangeIntersection;85 if (renElem.linkRangeIntersection) {86 Range_dragger.x = iP.x;87 Range_dragger.y = iP.y;88 }89 }90 } else {91 iP = renElem.linkRangeIntersection;92 if (renElem.linkRangeIntersection) {93 Range_dragger.x = iP.x;94 Range_dragger.y = iP.y;95 }96 }97 Range_dragger.updateElement();98 };99 /** BASE HANDLING FUNCTIONS ------------------------------------------------- **/100 Range_dragger.id = function(index) {101 if (!arguments.length) {102 return Range_dragger.nodeId;103 }104 Range_dragger.nodeId = index;105 };106 Range_dragger.svgPathLayer = function(layer) {107 Range_dragger.pathLayer = layer.append('g');108 };109 Range_dragger.svgRoot = function(root) {110 if (!arguments.length)111 return Range_dragger.rootElement;112 Range_dragger.rootElement = root;113 Range_dragger.rootNodeLayer = Range_dragger.rootElement.append('g');114 Range_dragger.addMouseEvents();115 };116 /** DRAWING FUNCTIONS ------------------------------------------------- **/117 Range_dragger.drawNode = function() {118 Range_dragger.pathElement = Range_dragger.pathLayer.append('line')119 .classed("classNodeDragPath", true);120 Range_dragger.pathElement.attr("x1", 0)121 .attr("y1", 0)122 .attr("x2", 0)123 .attr("y2", 0);124 // var lineData = [125 // {"x": 0, "y": 0},126 // {"x": 0, "y": 40},127 // {"x": -40, "y": 0},128 // {"x": 0, "y": -40},129 // {"x": 0, "y": 0}130 // ];131 var lineData = [132 { "x": -40, "y": 0 }, // start133 { "x": -20, "y": -10 },134 { "x": 20, "y": -50 },135 { "x": -10, "y": 0 }, // center136 { "x": 20, "y": 50 },137 { "x": -20, "y": 10 },138 { "x": -40, "y": 0 }139 ];140 var lineFunction = d3.svg.line()141 .x(function(d) {142 return d.x;143 })144 .y(function(d) {145 return d.y;146 })147 .interpolate("basis-closed");148 var pathData = "M 61,40 C 41,15 41,-15 61,-40 L 1,0 Z";149 Range_dragger.nodeElement = Range_dragger.rootNodeLayer.append('path').attr("d", pathData);150 Range_dragger.nodeElement.classed("classDraggerNode", true);151 if (graph.options().useAccuracyHelper()) {152 Range_dragger.draggerObject = Range_dragger.rootNodeLayer.append("circle");153 Range_dragger.draggerObject.attr("r", 40)154 .attr("cx", 0)155 .attr("cy", 0)156 .classed("superHiddenElement", true);157 Range_dragger.draggerObject.classed("superOpacityElement", !graph.options().showDraggerObject());158 }159 };160 Range_dragger.updateElementViaDomainDragger = function(x, y) {161 var range_x = x;162 var range_y = y;163 var dex = Range_dragger.parent.range().x;164 var dey = Range_dragger.parent.range().y;165 var dir_X = x - dex;166 var dir_Y = y - dey;167 var len = Math.sqrt(dir_X * dir_X + dir_Y * dir_Y);168 var nX = dir_X / len;169 var nY = dir_Y / len;170 var ep_range_x = dex + nX * Range_dragger.parent.range().actualRadius();171 var ep_range_y = dey + nY * Range_dragger.parent.range().actualRadius();172 var dx = range_x - ep_range_x;173 var dy = range_y - ep_range_y;174 len = Math.sqrt(dx * dx + dy * dy);175 nX = dx / len;176 nY = dy / len;177 var angle = Math.atan2(ep_range_y - range_y, ep_range_x - range_x) * 180 / Math.PI + 180;178 Range_dragger.nodeElement.attr("transform", "translate(" + ep_range_x + "," + ep_range_y + ")" + "rotate(" + angle + ")");179 var doX = ep_range_x + nX * 40;180 var doY = ep_range_y + nY * 40;181 Range_dragger.draggerObject.attr("transform", "translate(" + doX + "," + doY + ")");182 };183 Range_dragger.updateElement = function() {184 if (Range_dragger.mouseButtonPressed === true || Range_dragger.parent === undefined) return;185 var range = Range_dragger.parent.range();186 var iP = Range_dragger.parent.labelObject().linkRangeIntersection;187 if (Range_dragger.parent.labelElement() === undefined) return;188 var offsetForLoop = 48;189 if (Range_dragger.parent.labelElement().attr("transform") === "translate(0,15)") {190 range = Range_dragger.parent.inverse().domain();191 iP = Range_dragger.parent.labelObject().linkDomainIntersection;192 offsetForLoop = -48;193 }194 if (iP === undefined) return;195 var range_x = range.x;196 var range_y = range.y;197 var ep_range_x = iP.x;198 var ep_range_y = iP.y;199 // offset for dragger object...

Full Screen

Full Screen

walkToolsEditorSliderRanges.js

Source:walkToolsEditorSliderRanges.js Github

copy

Full Screen

1//2// walkToolsEditorSliderRanges.js3// version 0.14//5// Created by David Wooldridge, Summer 20156// Copyright © 2015 David Wooldridge.7//8// All the sliders in walkToolsEditor have a range (with the exception of phase controls that are always +-180)9// Two sets of slider ranges are given here; one for editing, one for joint troubleshooting / experimentation10//11// Editing tools available here: https://s3-us-west-2.amazonaws.com/davedub/high-fidelity/walkTools/walk.js12//13// Distributed under the Apache License, Version 2.0.14// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html15//1617// these slider ranges are best for troubleshooting avi joint orientations etc18fullScaleRanges = {19 "name": "Full Range",20 "Hips": {21 "pitchRange": 180,22 "yawRange": 180,23 "rollRange": 180,24 "pitchOffsetRange": 180,25 "yawOffsetRange": 180,26 "rollOffsetRange": 180,27 "swayRange": 0.5,28 "bobRange": 0.5,29 "thrustRange": 0.5,30 "swayOffsetRange": 1,31 "bobOffsetRange": 1,32 "thrustOffsetRange": 133 },34 "LeftUpLeg": {35 "pitchRange": 180,36 "yawRange": 180,37 "rollRange": 180,38 "pitchOffsetRange": 180,39 "yawOffsetRange": 180,40 "rollOffsetRange": 18041 },42 "RightUpLeg": {43 "pitchRange": 180,44 "yawRange": 180,45 "rollRange": 180,46 "pitchOffsetRange": 180,47 "yawOffsetRange": 180,48 "rollOffsetRange": 18049 },50 "LeftLeg": {51 "pitchRange": 180,52 "yawRange": 180,53 "rollRange": 180,54 "pitchOffsetRange": 180,55 "yawOffsetRange": 180,56 "rollOffsetRange": 18057 },58 "RightLeg": {59 "pitchRange": 180,60 "yawRange": 180,61 "rollRange": 180,62 "pitchOffsetRange": 180,63 "yawOffsetRange": 180,64 "rollOffsetRange": 18065 },66 "LeftFoot": {67 "pitchRange": 180,68 "yawRange": 180,69 "rollRange": 180,70 "pitchOffsetRange": 180,71 "yawOffsetRange": 180,72 "rollOffsetRange": 18073 },74 "RightFoot": {75 "pitchRange": 180,76 "yawRange": 180,77 "rollRange": 180,78 "pitchOffsetRange": 180,79 "yawOffsetRange": 180,80 "rollOffsetRange": 18081 },82 "LeftToeBase": {83 "pitchRange": 180,84 "yawRange": 180,85 "rollRange": 180,86 "pitchOffsetRange": 180,87 "yawOffsetRange": 180,88 "rollOffsetRange": 18089 },90 "RightToeBase": {91 "pitchRange": 180,92 "yawRange": 180,93 "rollRange": 180,94 "pitchOffsetRange": 180,95 "yawOffsetRange": 180,96 "rollOffsetRange": 18097 },98 "Spine": {99 "pitchRange": 180,100 "yawRange": 180,101 "rollRange": 180,102 "pitchOffsetRange": 180,103 "yawOffsetRange": 180,104 "rollOffsetRange": 180105 },106 "Spine1": {107 "pitchRange": 180,108 "yawRange": 180,109 "rollRange": 180,110 "pitchOffsetRange": 180,111 "yawOffsetRange": 180,112 "rollOffsetRange": 180113 },114 "Spine2": {115 "pitchRange": 180,116 "yawRange": 180,117 "rollRange": 180,118 "pitchOffsetRange": 180,119 "yawOffsetRange": 180,120 "rollOffsetRange": 180121 },122 "LeftShoulder": {123 "pitchRange": 180,124 "yawRange": 180,125 "rollRange": 180,126 "pitchOffsetRange": 180,127 "yawOffsetRange": 180,128 "rollOffsetRange": 180129 },130 "RightShoulder": {131 "pitchRange": 180,132 "yawRange": 180,133 "rollRange": 180,134 "pitchOffsetRange": 180,135 "yawOffsetRange": 180,136 "rollOffsetRange": 180137 },138 "LeftArm": {139 "pitchRange": 180,140 "yawRange": 180,141 "rollRange": 180,142 "pitchOffsetRange": 180,143 "yawOffsetRange": 180,144 "rollOffsetRange": 180145 },146 "RightArm": {147 "pitchRange": 180,148 "yawRange": 180,149 "rollRange": 180,150 "pitchOffsetRange": 180,151 "yawOffsetRange": 180,152 "rollOffsetRange": 180153 },154 "LeftForeArm": {155 "pitchRange": 180,156 "yawRange": 180,157 "rollRange": 180,158 "pitchOffsetRange": 180,159 "yawOffsetRange": 180,160 "rollOffsetRange": 180161 },162 "RightForeArm": {163 "pitchRange": 180,164 "yawRange": 180,165 "rollRange": 120,166 "pitchOffsetRange": 180,167 "yawOffsetRange": 180,168 "rollOffsetRange": 180169 },170 "LeftHand": {171 "pitchRange": 180,172 "yawRange": 180,173 "rollRange": 180,174 "pitchOffsetRange": 180,175 "yawOffsetRange": 180,176 "rollOffsetRange": 180177 },178 "RightHand": {179 "pitchRange": 180,180 "yawRange": 180,181 "rollRange": 180,182 "pitchOffsetRange": 180,183 "yawOffsetRange": 180,184 "rollOffsetRange": 180185 },186 "Neck": {187 "pitchRange": 180,188 "yawRange": 180,189 "rollRange": 180,190 "pitchOffsetRange": 180,191 "yawOffsetRange":180,192 "rollOffsetRange": 180193 },194 "Head": {195 "pitchRange": 180,196 "yawRange": 180,197 "rollRange": 180,198 "pitchOffsetRange": 180,199 "yawOffsetRange": 180,200 "rollOffsetRange": 180201 }202}203204// these slider ranges are best for editing205editingScaleRanges = {206 "name": "Animation",207 "Hips" : {208 "pitchRange": 12,209 "yawRange": 90,210 "rollRange": 12,211 "pitchOffsetRange": 90,212 "yawOffsetRange": 90,213 "rollOffsetRange": 90,214 "swayRange": 0.5,215 "bobRange": 0.5,216 "thrustRange": 0.5,217 "swayOffsetRange": 0.25,218 "bobOffsetRange": 0.25,219 "thrustOffsetRange": 0.25220 },221 "LeftUpLeg": {222 "pitchRange": 30,223 "yawRange": 35,224 "rollRange": 35,225 "pitchOffsetRange": 50,226 "yawOffsetRange": 20,227 "rollOffsetRange": 20228 },229 "RightUpLeg": {230 "pitchRange": 30,231 "yawRange": 35,232 "rollRange": 35,233 "pitchOffsetRange": 50,234 "yawOffsetRange": 20,235 "rollOffsetRange": 20236 },237 "LeftLeg": {238 "pitchRange": 90,239 "yawRange": 20,240 "rollRange": 20,241 "pitchOffsetRange": 180,242 "yawOffsetRange": 20,243 "rollOffsetRange": 20244 },245 "RightLeg": {246 "pitchRange": 90,247 "yawRange": 20,248 "rollRange": 20,249 "pitchOffsetRange": 180,250 "yawOffsetRange": 20,251 "rollOffsetRange": 20252 },253 "LeftFoot": {254 "pitchRange": 90,255 "yawRange": 20,256 "rollRange": 20,257 "pitchOffsetRange": 90,258 "yawOffsetRange": 50,259 "rollOffsetRange": 50260 },261 "RightFoot": {262 "pitchRange": 90,263 "yawRange": 20,264 "rollRange": 20,265 "pitchOffsetRange": 90,266 "yawOffsetRange": 50,267 "rollOffsetRange": 50268 },269 "LeftToeBase": {270 "pitchRange": 90,271 "yawRange": 20,272 "rollRange": 20,273 "pitchOffsetRange": 90,274 "yawOffsetRange": 20,275 "rollOffsetRange": 20276 },277 "RightToeBase": {278 "pitchRange": 90,279 "yawRange": 20,280 "rollRange": 20,281 "pitchOffsetRange": 90,282 "yawOffsetRange": 20,283 "rollOffsetRange": 20284 },285 "Spine": {286 "pitchRange": 40,287 "yawRange": 40,288 "rollRange": 40,289 "pitchOffsetRange": 90,290 "yawOffsetRange": 50,291 "rollOffsetRange": 50292 },293 "Spine1": {294 "pitchRange": 20,295 "yawRange": 40,296 "rollRange": 20,297 "pitchOffsetRange": 90,298 "yawOffsetRange": 50,299 "rollOffsetRange": 50300 },301 "Spine2": {302 "pitchRange": 20,303 "yawRange": 40,304 "rollRange": 20,305 "pitchOffsetRange": 90,306 "yawOffsetRange": 50,307 "rollOffsetRange": 50308 },309 "LeftShoulder": {310 "pitchRange": 35,311 "yawRange": 40,312 "rollRange": 20,313 "pitchOffsetRange": 180,314 "yawOffsetRange": 180,315 "rollOffsetRange": 180316 },317 "RightShoulder": {318 "pitchRange": 35,319 "yawRange": 40,320 "rollRange": 20,321 "pitchOffsetRange": 180,322 "yawOffsetRange": 180,323 "rollOffsetRange": 180324 },325 "LeftArm": {326 "pitchRange": 90,327 "yawRange": 90,328 "rollRange": 90,329 "pitchOffsetRange": 180,330 "yawOffsetRange": 180,331 "rollOffsetRange": 180332 },333 "RightArm": {334 "pitchRange": 90,335 "yawRange": 90,336 "rollRange": 90,337 "pitchOffsetRange": 180,338 "yawOffsetRange": 180,339 "rollOffsetRange": 180340 },341 "LeftForeArm": {342 "pitchRange": 90,343 "yawRange": 90,344 "rollRange": 120,345 "pitchOffsetRange": 180,346 "yawOffsetRange": 180,347 "rollOffsetRange": 180348 },349 "RightForeArm": {350 "pitchRange": 90,351 "yawRange": 90,352 "rollRange": 120,353 "pitchOffsetRange": 180,354 "yawOffsetRange": 180,355 "rollOffsetRange": 180356 },357 "LeftHand": {358 "pitchRange": 90,359 "yawRange": 180,360 "rollRange": 90,361 "pitchOffsetRange": 180,362 "yawOffsetRange": 180,363 "rollOffsetRange": 180364 },365 "RightHand": {366 "pitchRange": 90,367 "yawRange": 180,368 "rollRange": 90,369 "pitchOffsetRange": 180,370 "yawOffsetRange": 180,371 "rollOffsetRange": 180372 },373 "Neck": {374 "pitchRange": 20,375 "yawRange": 20,376 "rollRange": 20,377 "pitchOffsetRange": 90,378 "yawOffsetRange": 90,379 "rollOffsetRange": 90380 },381 "Head": {382 "pitchRange": 20,383 "yawRange": 20,384 "rollRange": 20,385 "pitchOffsetRange": 90,386 "yawOffsetRange": 90,387 "rollOffsetRange": 90388 } ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { openBrowser, goto, range, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await range("Enable").exists();6 await range("Enable").exists(2);7 await range("Enable").exists(3);8 await range("Enable").exists(4);9 await range("Enable").exists(5);10 await range("Enable").exists(6);11 await range("Enable").exists(7);12 await range("Enable").exists(8);13 await range("Enable").exists(9);14 await range("Enable").exists(10);15 await range("Enable").exists(11);16 await range("Enable").exists(12);17 await range("Enable").exists(13);18 await range("Enable").exists(14);19 await range("Enable").exists(15);20 await range("Enable").exists(16);21 await range("Enable").exists(17);22 await range("Enable").exists(18);23 await range("Enable").exists(19);24 await range("Enable").exists(20);25 await range("Enable").exists(21);26 await range("Enable").exists(22);27 await range("Enable").exists(23);28 await range("Enable").exists(24);29 await range("Enable").exists(25);30 await range("Enable").exists(26);31 await range("Enable").exists(27);32 await range("Enable").exists(28);33 await range("Enable").exists(29);34 await range("Enable").exists(30);35 await range("Enable").exists(31);36 await range("Enable").exists(32);37 await range("Enable").exists(33);38 await range("Enable").exists(34);39 await range("Enable").exists(35);40 await range("Enable").exists(36);41 await range("Enable").exists(37);42 await range("Enable").exists(38);43 await range("Enable").exists(39);44 await range("Enable").exists(40);45 await range("Enable").exists(41);46 await range("Enable").exists(42);47 await range("Enable").exists(43);48 await range("Enable").exists(44);49 await range("Enable").exists(45);50 await range("Enable

Full Screen

Using AI Code Generation

copy

Full Screen

1const { range } = require('taiko');2const { range } = require('taiko');3const { range } = require('taiko');4const { range } = require('taiko');5const { range } = require('taiko');6const { range } = require('taiko');7const { range } = require('taiko');8const { range } = require('taiko');9const { range } = require('taiko');10const { range } = require('taiko');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { range } = require('taiko');2const { openBrowser, goto } = require('taiko');3const { click } = require('taiko');4const { write } = require('taiko');5const { closeBrowser } = require('taiko');6const { button } = require('taiko');7const { into } = require('taiko');8const { textBox } = require('taiko');9const { dropDown } = require('taiko');10const { evaluate } = require('taiko');11const { below } = require('taiko');12const { text } = require('taiko');13const { link } = require('taiko');14const { to } = require('taiko');15const { image } = require('taiko');16const { near } = require('taiko');17const { waitFor } = require('taiko');18const { below } = require('taiko');19const { above } = require('taiko');20const { toRightOf } = require('taiko');21const { toLeftOf } = require('taiko');22const { near } = require('taiko');23const { waitFor } = require('taiko');24const { below } = require('taiko');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { openBrowser, goto, range, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await range(1, 5).forEach(async (i) => {6 await click("Documentation");7 await click("Get Started");8 await click("API Reference");9 await click("Examples");10 await click("Plugins");11 await click("Contributing");12 await click("Blog");13 await click("Community");14 await click("About");15 await click("Home");16 });17 } catch (e) {18 console.error(e);19 } finally {20 await closeBrowser();21 }22})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { openBrowser, goto, closeBrowser, button, click, text, into, textBox, write, link, dropDown, toRightOf, radioButton, attach, evaluate, focus, hover, $ } = require('taiko');2(async () => {3 try {4 await openBrowser({ headless: false });5 await click("Gmail");6 await click("Sign in");7 await write("

Full Screen

Using AI Code Generation

copy

Full Screen

1const { openBrowser, goto, closeBrowser, textBox, button, write, toRightOf, text, click, waitFor, $, toLeftOf, below, above, link, evaluate, image, focus, toLeftOf, near, intercept } = require('taiko');2(async () => {3 try {4 await openBrowser({ headless: false });5 await click("Hello World");6 await waitFor(5000);7 await closeBrowser();8 } catch (error) {9 console.error(error);10 } finally {11 }12})();13const { openBrowser, goto, closeBrowser, textBox, button, write, toRightOf, text, click, waitFor, $, toLeftOf, below, above, link, evaluate, image, focus, toLeftOf, near, intercept } = require('taiko');14(async () => {15 try {16 await openBrowser({ headless: false });17 await click("Hello World");18 await waitFor(5000);19 await closeBrowser();20 } catch (error) {21 console.error(error);22 } finally {23 }24})();25const { openBrowser, goto, closeBrowser, textBox, button, write, toRightOf, text, click, waitFor, $, toLeftOf, below, above, link, evaluate, image, focus, toLeftOf, near, intercept } = require('taiko');26(async () => {27 try {28 await openBrowser({ headless: false });

Full Screen

Using AI Code Generation

copy

Full Screen

1const { openBrowser, goto, closeBrowser, click, dropDown, write, textBox, button, toRightOf, image, below, link, listItem, toLeftOf, text, $, waitFor, focus, evaluate, intercept, below, above, near, accept, dismiss, toLeftOf, toRightOf, waitForNavigation, reload, range } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await click("Range");6 await range({id:"range1"}).select(100);7 await range({id:"range2"}).select(100);8 await range({id:"range3"}).select(100);9 await range({id:"range4"}).select(100);10 await range({id:"range5"}).select(100);11 await range({id:"range6"}).select(100);12 await range({id:"range7"}).select(100);13 await range({id:"range8"}).select(100);14 await range({id:"range9"}).select(100);15 await range({id:"range10"}).select(100);16 await range({id:"range11"}).select(100);17 await range({id:"range12"}).select(100);18 await range({id:"range13"}).select(100);19 await range({id:"range14"}).select(100);20 await range({id:"range15"}).select(100);21 await range({id:"range16"}).select(100);22 await range({id:"range17"}).select(100);23 await range({id:"range18"}).select(100);24 await range({id:"range19"}).select(100);25 await range({id:"range20"}).select(100);26 await range({id:"range21"}).select(100);27 await range({id:"range22"}).select(100);28 await range({id:"range23"}).select(100);29 await range({id:"range24"}).select(100);30 await range({id:"range25"}).select(100);31 await range({id:"range26"}).select(100);32 await range({id:"range27"}).select(100);33 await range({

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run taiko automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful