Best JavaScript code snippet using playwright-internal
SEA3D.js
Source:SEA3D.js
...2399 // progress2400 } else if ( xhr.readyState === 4 ) {2401 if ( xhr.status === 200 || xhr.status === 0 ) {2402 // complete2403 file.read( this.response );2404 } else {2405 this.dispatchError( 1001, "Couldn't load [" + url + "] [" + xhr.status + "]" );2406 }2407 }2408 }2409 xhr.send();...
attributes.js
Source:attributes.js
1function getProperty(propertyName) {2 return el => el[propertyName];3}4function getAttribute(attributeName) {5 return el => {6 if (el.namespaceURI === '') {7 throw new Error('Not an HTML element.');8 }9 return el.getAttribute(attributeName);10 };11}12function getSVGProperty(propertyName) {13 return el => el[propertyName];14}15function getSVGAttribute(attributeName) {16 return el => {17 if (el.namespaceURI !== 'http://www.w3.org/2000/svg') {18 throw new Error('Not an SVG element.');19 }20 return el.getAttribute(attributeName);21 };22}23const attributes = [24 {name: 'about', read: getAttribute('about')},25 {name: 'aBoUt', read: getAttribute('about')},26 {27 name: 'accent-Height',28 containerTagName: 'svg',29 tagName: 'font-face',30 read: getSVGAttribute('accent-height'),31 },32 {33 name: 'accent-height',34 containerTagName: 'svg',35 tagName: 'font-face',36 read: getSVGAttribute('accent-height'),37 },38 {39 name: 'accentHeight',40 containerTagName: 'svg',41 tagName: 'font-face',42 read: getSVGAttribute('accent-height'),43 },44 {name: 'accept', tagName: 'input'},45 {name: 'accept-charset', tagName: 'form', read: getProperty('acceptCharset')},46 {name: 'accept-Charset', tagName: 'form', read: getProperty('acceptCharset')},47 {name: 'acceptCharset', tagName: 'form'},48 {name: 'accessKey'},49 {50 name: 'accumulate',51 containerTagName: 'svg',52 tagName: 'animate',53 read: getSVGAttribute('accumulate'),54 },55 {name: 'action', tagName: 'form', overrideStringValue: 'https://reactjs.com'},56 {57 name: 'additive',58 containerTagName: 'svg',59 tagName: 'animate',60 read: getSVGAttribute('additive'),61 },62 {63 name: 'alignment-baseline',64 containerTagName: 'svg',65 tagName: 'textPath',66 read: getSVGAttribute('alignment-baseline'),67 },68 {69 name: 'alignmentBaseline',70 containerTagName: 'svg',71 tagName: 'textPath',72 read: getSVGAttribute('alignment-baseline'),73 },74 {75 name: 'allowFullScreen',76 tagName: 'iframe',77 read: getProperty('allowFullscreen'),78 },79 {80 name: 'allowfullscreen',81 tagName: 'iframe',82 read: getProperty('allowFullscreen'),83 },84 {name: 'allowFullscreen', tagName: 'iframe'},85 {86 name: 'allowReorder',87 containerTagName: 'svg',88 tagName: 'switch',89 read: getSVGAttribute('allowReorder'),90 },91 {92 name: 'alphabetic',93 containerTagName: 'svg',94 tagName: 'font-face',95 read: getSVGAttribute('alphabetic'),96 },97 {name: 'alt', tagName: 'img'},98 {99 name: 'amplitude',100 containerTagName: 'svg',101 tagName: 'feFuncA',102 read: getSVGProperty('amplitude'),103 },104 {105 name: 'arabic-form',106 containerTagName: 'svg',107 tagName: 'glyph',108 read: getSVGAttribute('arabic-form'),109 },110 {111 name: 'arabicForm',112 containerTagName: 'svg',113 tagName: 'glyph',114 read: getSVGAttribute('arabic-form'),115 },116 {name: 'aria', read: getAttribute('aria')},117 {name: 'aria-', read: getAttribute('aria-')},118 {name: 'aria-invalidattribute', read: getAttribute('aria-invalidattribute')},119 {name: 'as', tagName: 'link'},120 {121 name: 'ascent',122 containerTagName: 'svg',123 tagName: 'font-face',124 read: getSVGAttribute('ascent'),125 },126 {name: 'async', tagName: 'script'},127 {128 name: 'attributeName',129 containerTagName: 'svg',130 tagName: 'animate',131 read: getSVGAttribute('attributeName'),132 },133 {134 name: 'attributeType',135 containerTagName: 'svg',136 tagName: 'animate',137 read: getSVGAttribute('attributeType'),138 },139 {140 name: 'autoCapitalize',141 tagName: 'input',142 read: getProperty('autocapitalize'),143 overrideStringValue: 'words',144 },145 {146 name: 'autoComplete',147 tagName: 'input',148 overrideStringValue: 'email',149 read: getProperty('autocomplete'),150 },151 {152 name: 'autoCorrect',153 tagName: 'input',154 overrideStringValue: 'off',155 read: getAttribute('autocorrect'),156 },157 {name: 'autoPlay', tagName: 'video', read: getProperty('autoplay')},158 {159 name: 'autoReverse',160 containerTagName: 'svg',161 tagName: 'animate',162 read: getSVGAttribute('autoreverse'),163 },164 {name: 'autoSave', tagName: 'input', read: getAttribute('autosave')},165 {166 name: 'azimuth',167 containerTagName: 'svg',168 tagName: 'feDistantLight',169 read: getSVGProperty('azimuth'),170 },171 {172 name: 'baseFrequency',173 containerTagName: 'svg',174 tagName: 'feTurbulence',175 read: getSVGAttribute('baseFrequency'),176 },177 {178 name: 'baseline-shift',179 containerTagName: 'svg',180 tagName: 'textPath',181 read: getSVGAttribute('baseline-shift'),182 },183 {184 name: 'baselineShift',185 containerTagName: 'svg',186 tagName: 'textPath',187 read: getSVGAttribute('baseline-shift'),188 },189 {name: 'baseProfile', tagName: 'svg', read: getSVGAttribute('baseProfile')},190 {191 name: 'bbox',192 containerTagName: 'svg',193 tagName: 'font-face',194 read: getSVGAttribute('bbox'),195 },196 {197 name: 'begin',198 containerTagName: 'svg',199 tagName: 'animate',200 read: getSVGAttribute('begin'),201 },202 {203 name: 'bias',204 containerTagName: 'svg',205 tagName: 'feConvolveMatrix',206 read: getSVGProperty('bias'),207 },208 {209 name: 'by',210 containerTagName: 'svg',211 tagName: 'animate',212 read: getSVGAttribute('by'),213 },214 {215 name: 'calcMode',216 containerTagName: 'svg',217 tagName: 'animate',218 overrideStringValue: 'discrete',219 read: getSVGAttribute('calcMode'),220 },221 {222 name: 'cap-height',223 containerTagName: 'svg',224 tagName: 'font-face',225 read: getSVGAttribute('cap-height'),226 },227 {228 name: 'capHeight',229 containerTagName: 'svg',230 tagName: 'font-face',231 read: getSVGAttribute('cap-height'),232 },233 {234 name: 'capture',235 tagName: 'input',236 overrideStringValue: 'environment',237 read: getAttribute('capture'),238 },239 {name: 'cellPadding', tagName: 'table'},240 {name: 'cellSpacing', tagName: 'table'},241 {242 name: 'challenge',243 tagName: 'keygen',244 read: getAttribute('challenge'), // The property is not supported in Chrome.245 },246 {name: 'charSet', tagName: 'script', read: getProperty('charset')},247 {name: 'checked', tagName: 'input', extraProps: {onChange() {}}},248 {name: 'Checked', tagName: 'input', read: getAttribute('Checked')},249 {name: 'Children', read: getAttribute('children')},250 {name: 'children'},251 {252 name: 'cite',253 tagName: 'blockquote',254 overrideStringValue: 'http://reactjs.com/',255 },256 {name: 'class', read: getAttribute('class')},257 {name: 'classID', tagName: 'object', read: getAttribute('classid')},258 {name: 'className'},259 {name: 'clip', tagName: 'svg', read: getAttribute('clip')},260 {261 name: 'clip-path',262 containerTagName: 'svg',263 tagName: 'path',264 read: getSVGAttribute('clip-path'),265 },266 {267 name: 'clipPath',268 containerTagName: 'svg',269 tagName: 'path',270 read: getSVGAttribute('clip-path'),271 },272 {273 name: 'clipPathUnits',274 containerTagName: 'svg',275 tagName: 'clipPath',276 overrideStringValue: 'objectBoundingBox',277 read: getSVGProperty('clipPathUnits'),278 },279 {280 name: 'clip-rule',281 containerTagName: 'svg',282 tagName: 'path',283 read: getSVGAttribute('clip-rule'),284 },285 {286 name: 'clipRule',287 containerTagName: 'svg',288 tagName: 'path',289 read: getSVGAttribute('clip-rule'),290 },291 {292 name: 'color',293 containerTagName: 'svg',294 tagName: 'text',295 read: getSVGAttribute('color'),296 },297 {298 name: 'color-interpolation',299 containerTagName: 'svg',300 tagName: 'animate',301 overrideStringValue: 'sRGB',302 read: getSVGAttribute('color-interpolation'),303 },304 {305 name: 'colorInterpolation',306 containerTagName: 'svg',307 tagName: 'animate',308 overrideStringValue: 'sRGB',309 read: getSVGAttribute('color-interpolation'),310 },311 {312 name: 'color-interpolation-filters',313 containerTagName: 'svg',314 tagName: 'feComposite',315 overrideStringValue: 'sRGB',316 read: getSVGAttribute('color-interpolation-filters'),317 },318 {319 name: 'colorInterpolationFilters',320 containerTagName: 'svg',321 tagName: 'feComposite',322 overrideStringValue: 'sRGB',323 read: getSVGAttribute('color-interpolation-filters'),324 },325 {326 name: 'color-profile',327 containerTagName: 'svg',328 tagName: 'image',329 overrideStringValue: 'sRGB',330 read: getSVGAttribute('color-profile'),331 },332 {333 name: 'colorProfile',334 containerTagName: 'svg',335 tagName: 'image',336 overrideStringValue: 'sRGB',337 read: getSVGAttribute('color-profile'),338 },339 {340 name: 'color-rendering',341 containerTagName: 'svg',342 tagName: 'animate',343 overrideStringValue: 'optimizeSpeed',344 read: getSVGAttribute('color-rendering'),345 },346 {347 name: 'colorRendering',348 containerTagName: 'svg',349 tagName: 'animate',350 overrideStringValue: 'optimizeSpeed',351 read: getSVGAttribute('color-rendering'),352 },353 {name: 'cols', tagName: 'textarea'},354 {name: 'colSpan', containerTagName: 'tr', tagName: 'td'},355 {name: 'content', tagName: 'meta'},356 {name: 'contentEditable'},357 {358 name: 'contentScriptType',359 tagName: 'svg',360 read: getSVGAttribute('contentScriptType'),361 },362 {363 name: 'contentStyleType',364 tagName: 'svg',365 read: getSVGAttribute('contentStyleType'),366 },367 {name: 'contextMenu', read: getAttribute('contextmenu')}, // TODO: Read the property by rendering a menu with the ID.368 {name: 'controls', tagName: 'video'},369 {name: 'coords', tagName: 'a'},370 {name: 'crossOrigin', tagName: 'script'},371 {name: 'cursor', tag: 'svg', read: getAttribute('cursor')},372 {373 name: 'cx',374 containerTagName: 'svg',375 tagName: 'circle',376 overrideStringValue: '10px',377 read: getSVGProperty('cx'),378 },379 {380 name: 'cy',381 containerTagName: 'svg',382 tagName: 'circle',383 overrideStringValue: '10%',384 read: getSVGProperty('cy'),385 },386 {387 name: 'd',388 containerTagName: 'svg',389 tagName: 'path',390 read: getSVGAttribute('d'),391 },392 {393 name: 'dangerouslySetInnerHTML',394 read: getAttribute('dangerouslySetInnerHTML'),395 },396 {397 name: 'DangerouslySetInnerHTML',398 read: getAttribute('DangerouslySetInnerHTML'),399 },400 {name: 'data', read: getAttribute('data')},401 {name: 'data-', read: getAttribute('data-')},402 {name: 'data-unknownattribute', read: getAttribute('data-unknownattribute')},403 {name: 'datatype', read: getAttribute('datatype')},404 {405 name: 'dateTime',406 tagName: 'time',407 overrideStringValue: '2001-05-15T19:00',408 read: getAttribute('datetime'),409 },410 {411 name: 'decelerate',412 containerTagName: 'svg',413 tagName: 'animate',414 read: getSVGAttribute('decelerate'),415 },416 {name: 'default', tagName: 'track'},417 {418 name: 'defaultchecked',419 tagName: 'input',420 read: getAttribute('defaultchecked'),421 },422 {name: 'defaultChecked', tagName: 'input'},423 {name: 'defaultValue', tagName: 'input'},424 {name: 'defaultValuE', tagName: 'input', read: getAttribute('defaultValuE')},425 {name: 'defer', tagName: 'script'},426 {427 name: 'descent',428 containerTagName: 'svg',429 tagName: 'font-face',430 read: getSVGAttribute('descent'),431 },432 {433 name: 'diffuseConstant',434 containerTagName: 'svg',435 tagName: 'feDiffuseLighting',436 read: getSVGProperty('diffuseConstant'),437 },438 {name: 'dir', overrideStringValue: 'rtl'},439 {440 name: 'direction',441 containerTagName: 'svg',442 tagName: 'text',443 overrideStringValue: 'rtl',444 read: getSVGAttribute('direction'),445 },446 {name: 'disabled', tagName: 'input'},447 {448 name: 'display',449 tagName: 'svg',450 overrideStringValue: 'list-item',451 read: getAttribute('display'),452 },453 {454 name: 'divisor',455 containerTagName: 'svg',456 tagName: 'feConvolveMatrix',457 read: getSVGProperty('divisor'),458 },459 {460 name: 'dominant-baseline',461 containerTagName: 'svg',462 tagName: 'text',463 read: getSVGAttribute('dominant-baseline'),464 },465 {466 name: 'dominantBaseline',467 containerTagName: 'svg',468 tagName: 'text',469 read: getSVGAttribute('dominant-baseline'),470 },471 {name: 'download', tagName: 'a'},472 {name: 'dOwNlOaD', tagName: 'a', read: getAttribute('dOwNlOaD')},473 {name: 'draggable'},474 {475 name: 'dur',476 containerTagName: 'svg',477 tagName: 'animate',478 read: getSVGAttribute('dur'),479 },480 {481 name: 'dx',482 containerTagName: 'svg',483 tagName: 'text',484 overrideStringValue: '1pt 2px 3em',485 read: getSVGProperty('dx'),486 },487 {488 name: 'dX',489 containerTagName: 'svg',490 tagName: 'text',491 overrideStringValue: '1pt 2px 3em',492 read: getSVGProperty('dx'),493 },494 {495 name: 'dy',496 containerTagName: 'svg',497 tagName: 'text',498 overrideStringValue: '1 2 3',499 read: getSVGProperty('dy'),500 },501 {502 name: 'dY',503 containerTagName: 'svg',504 tagName: 'text',505 overrideStringValue: '1 2 3',506 read: getSVGProperty('dy'),507 },508 {509 name: 'edgeMode',510 containerTagName: 'svg',511 tagName: 'feConvolveMatrix',512 overrideStringValue: 'wrap',513 read: getSVGProperty('edgeMode'),514 },515 {516 name: 'elevation',517 containerTagName: 'svg',518 tagName: 'feDistantLight',519 read: getSVGProperty('elevation'),520 },521 {522 name: 'enable-background',523 containerTagName: 'svg',524 tagName: 'path',525 read: getSVGAttribute('enable-background'),526 },527 {528 name: 'enableBackground',529 containerTagName: 'svg',530 tagName: 'path',531 read: getSVGAttribute('enable-background'),532 },533 {534 name: 'encType',535 tagName: 'form',536 overrideStringValue: 'text/plain',537 read: getProperty('enctype'),538 },539 {540 name: 'end',541 containerTagName: 'svg',542 tagName: 'animate',543 read: getSVGAttribute('end'),544 },545 {546 name: 'exponent',547 read: getSVGProperty('exponent'),548 containerTagName: 'svg',549 tagName: 'feFuncA',550 },551 {552 name: 'externalResourcesRequired',553 containerTagName: 'svg',554 tagName: 'path',555 read: getSVGAttribute('externalResourcesRequired'),556 },557 {558 name: 'fill',559 containerTagName: 'svg',560 tagName: 'path',561 read: getSVGAttribute('fill'),562 },563 {564 name: 'fillOpacity',565 containerTagName: 'svg',566 tagName: 'circle',567 read: getSVGAttribute('fill-opacity'),568 },569 {570 name: 'fill-opacity',571 containerTagName: 'svg',572 tagName: 'circle',573 read: getSVGAttribute('fill-opacity'),574 },575 {576 name: 'fillRule',577 containerTagName: 'svg',578 tagName: 'circle',579 read: getSVGAttribute('fill-rule'),580 },581 {582 name: 'fill-rule',583 containerTagName: 'svg',584 tagName: 'circle',585 read: getSVGAttribute('fill-rule'),586 },587 {588 name: 'filter',589 containerTagName: 'svg',590 tagName: 'g',591 read: getSVGAttribute('filter'),592 },593 {594 name: 'filterRes',595 containerTagName: 'svg',596 tagName: 'filter',597 read: getSVGAttribute('filterRes'),598 },599 {600 name: 'filterUnits',601 containerTagName: 'svg',602 tagName: 'filter',603 overrideStringValue: 'userSpaceOnUse',604 read: getSVGProperty('filterUnits'),605 },606 {607 name: 'flood-color',608 containerTagName: 'svg',609 tagName: 'feflood',610 overrideStringValue: 'currentColor',611 read: getSVGAttribute('flood-color'),612 },613 {614 name: 'floodColor',615 containerTagName: 'svg',616 tagName: 'feflood',617 overrideStringValue: 'currentColor',618 read: getSVGAttribute('flood-color'),619 },620 {621 name: 'flood-opacity',622 containerTagName: 'svg',623 tagName: 'feflood',624 overrideStringValue: 'inherit',625 read: getSVGAttribute('flood-opacity'),626 },627 {628 name: 'floodOpacity',629 containerTagName: 'svg',630 tagName: 'feflood',631 overrideStringValue: 'inherit',632 read: getSVGAttribute('flood-opacity'),633 },634 {name: 'focusable', tagName: 'p', read: getAttribute('focusable')},635 {636 name: 'font-family',637 read: getSVGAttribute('font-family'),638 containerTagName: 'svg',639 tagName: 'font-face',640 },641 {642 name: 'font-size',643 read: getSVGAttribute('font-size'),644 containerTagName: 'svg',645 tagName: 'font-face',646 },647 {648 name: 'font-size-adjust',649 containerTagName: 'svg',650 tagName: 'text',651 read: getSVGAttribute('font-size-adjust'),652 },653 {654 name: 'font-stretch',655 read: getSVGAttribute('font-stretch'),656 containerTagName: 'svg',657 tagName: 'font-face',658 },659 {660 name: 'font-style',661 read: getSVGAttribute('font-style'),662 containerTagName: 'svg',663 tagName: 'font-face',664 },665 {666 name: 'font-variant',667 read: getSVGAttribute('font-variant'),668 containerTagName: 'svg',669 tagName: 'font-face',670 },671 {672 name: 'font-weight',673 read: getSVGAttribute('font-weight'),674 containerTagName: 'svg',675 tagName: 'font-face',676 },677 {678 name: 'fontFamily',679 read: getSVGAttribute('font-family'),680 containerTagName: 'svg',681 tagName: 'font-face',682 },683 {684 name: 'fontSize',685 read: getSVGAttribute('font-size'),686 containerTagName: 'svg',687 tagName: 'font-face',688 },689 {690 name: 'fontSizeAdjust',691 containerTagName: 'svg',692 tagName: 'text',693 read: getSVGAttribute('font-size-adjust'),694 },695 {696 name: 'fontStretch',697 read: getSVGAttribute('font-stretch'),698 containerTagName: 'svg',699 tagName: 'font-face',700 },701 {702 name: 'fontStyle',703 read: getSVGAttribute('font-style'),704 containerTagName: 'svg',705 tagName: 'font-face',706 },707 {708 name: 'fontVariant',709 read: getSVGAttribute('font-variant'),710 containerTagName: 'svg',711 tagName: 'font-face',712 },713 {714 name: 'fontWeight',715 read: getSVGAttribute('font-weight'),716 containerTagName: 'svg',717 tagName: 'font-face',718 },719 {name: 'for', tagName: 'label', read: getProperty('htmlFor')},720 {name: 'fOr', tagName: 'label', read: getProperty('htmlFor')},721 {name: 'form', read: getAttribute('form')}, // TODO: Read the property by rendering into a form with i722 {723 name: 'formAction',724 tagName: 'input',725 overrideStringValue: 'https://reactjs.com',726 },727 {728 name: 'format',729 read: getSVGAttribute('format'),730 containerTagName: 'svg',731 tagName: 'altGlyph',732 },733 {name: 'formEncType', tagName: 'input', read: getProperty('formEnctype')},734 {name: 'formMethod', tagName: 'input', overrideStringValue: 'POST'},735 {name: 'formNoValidate', tagName: 'input'},736 {name: 'formTarget', tagName: 'input'},737 {name: 'frameBorder', tagName: 'iframe'},738 {739 name: 'from',740 read: getSVGAttribute('from'),741 containerTagName: 'svg',742 tagName: 'animate',743 },744 {745 name: 'fx',746 read: getSVGProperty('fx'),747 containerTagName: 'svg',748 overrideStringValue: '10px',749 tagName: 'radialGradient',750 },751 {752 name: 'fX',753 containerTagName: 'svg',754 tagName: 'radialGradient',755 overrideStringValue: '10px',756 read: getSVGProperty('fx'),757 },758 {759 name: 'fY',760 containerTagName: 'svg',761 tagName: 'radialGradient',762 overrideStringValue: '20em',763 read: getSVGProperty('fy'),764 },765 {766 name: 'fy',767 read: getSVGProperty('fy'),768 containerTagName: 'svg',769 overrideStringValue: '20em',770 tagName: 'radialGradient',771 },772 {773 name: 'G1',774 containerTagName: 'svg',775 tagName: 'hkern',776 read: getSVGAttribute('g1'),777 },778 {779 name: 'g1',780 read: getSVGAttribute('g1'),781 containerTagName: 'svg',782 tagName: 'hkern',783 },784 {785 name: 'G2',786 containerTagName: 'svg',787 tagName: 'hkern',788 read: getSVGAttribute('g2'),789 },790 {791 name: 'g2',792 read: getSVGAttribute('g2'),793 containerTagName: 'svg',794 tagName: 'hkern',795 },796 {797 name: 'glyph-name',798 read: getSVGAttribute('glyph-name'),799 containerTagName: 'svg',800 tagName: 'glyph',801 },802 {803 name: 'glyph-orientation-horizontal',804 containerTagName: 'svg',805 tagName: 'text',806 read: getSVGAttribute('glyph-orientation-horizontal'),807 },808 {809 name: 'glyph-orientation-vertical',810 containerTagName: 'svg',811 tagName: 'text',812 read: getSVGAttribute('glyph-orientation-vertical'),813 },814 {815 name: 'glyphName',816 read: getSVGAttribute('glyph-name'),817 containerTagName: 'svg',818 tagName: 'glyph',819 },820 {821 name: 'glyphOrientationHorizontal',822 containerTagName: 'svg',823 tagName: 'text',824 read: getSVGAttribute('glyph-orientation-horizontal'),825 },826 {827 name: 'glyphOrientationVertical',828 containerTagName: 'svg',829 tagName: 'text',830 read: getSVGAttribute('glyph-orientation-vertical'),831 },832 {833 name: 'glyphRef',834 read: getSVGAttribute('glyph-ref'),835 containerTagName: 'svg',836 tagName: 'altGlyph',837 },838 {839 name: 'gradientTransform',840 read: getSVGProperty('gradientTransform'),841 containerTagName: 'svg',842 overrideStringValue:843 'translate(-10,-20) scale(2) rotate(45) translate(5,10)',844 tagName: 'linearGradient',845 },846 {847 name: 'gradientUnits',848 read: getSVGProperty('gradientUnits'),849 containerTagName: 'svg',850 overrideStringValue: 'userSpaceOnUse',851 tagName: 'linearGradient',852 },853 {854 name: 'hanging',855 read: getSVGAttribute('hanging'),856 containerTagName: 'svg',857 tagName: 'font-face',858 },859 // Disabled because it crashes other tests with React 15.860 // TODO: re-enable when we no longer compare to 15.861 // {name: 'hasOwnProperty', read: getAttribute('hasOwnProperty')},862 {name: 'headers', containerTagName: 'tr', tagName: 'td'},863 {name: 'height', tagName: 'img'},864 {865 name: 'height',866 containerTagName: 'svg',867 tagName: 'rect',868 read: getSVGProperty('height'),869 overrideStringValue: '100%',870 },871 {name: 'hidden'},872 {name: 'high', tagName: 'meter'},873 {874 name: 'horiz-adv-x',875 read: getSVGAttribute('horiz-adv-x'),876 containerTagName: 'svg',877 tagName: 'font',878 },879 {880 name: 'horiz-origin-x',881 read: getSVGAttribute('horiz-origin-x'),882 containerTagName: 'svg',883 tagName: 'font',884 },885 {886 name: 'horizAdvX',887 read: getSVGAttribute('horiz-adv-x'),888 containerTagName: 'svg',889 tagName: 'font',890 },891 {892 name: 'horizOriginX',893 read: getSVGAttribute('horiz-origin-x'),894 containerTagName: 'svg',895 tagName: 'font',896 },897 {name: 'href', tagName: 'a', overrideStringValue: 'https://reactjs.com'},898 {name: 'hrefLang', read: getAttribute('hreflang')},899 {name: 'htmlFor', tagName: 'label'},900 {name: 'http-equiv', tagName: 'meta', read: getProperty('httpEquiv')},901 {name: 'httpEquiv', tagName: 'meta'},902 {name: 'icon', tagName: 'command', read: getAttribute('icon')},903 {name: 'id'},904 {name: 'ID', read: getProperty('id')},905 {906 name: 'ideographic',907 read: getSVGAttribute('ideographic'),908 containerTagName: 'svg',909 tagName: 'font-face',910 },911 {912 name: 'image-rendering',913 tagName: 'svg',914 read: getSVGAttribute('image-rendering'),915 },916 {917 name: 'imageRendering',918 tagName: 'svg',919 read: getSVGAttribute('image-rendering'),920 },921 {922 name: 'in',923 read: getSVGAttribute('in'),924 containerTagName: 'svg',925 tagName: 'feBlend',926 },927 {928 name: 'in2',929 read: getSVGProperty('in2'),930 containerTagName: 'svg',931 tagName: 'feBlend',932 },933 {name: 'initialChecked', read: getAttribute('initialchecked')},934 {name: 'initialValue', read: getAttribute('initialvalue')},935 {name: 'inlist', read: getAttribute('inlist')},936 {name: 'inputMode', tagName: 'input', read: getAttribute('inputmode')}, // TODO: Should use property but it's not implemented in Chrome937 {name: 'integrity', tagName: 'script'},938 {939 name: 'intercept',940 read: getSVGProperty('intercept'),941 containerTagName: 'svg',942 tagName: 'feFuncA',943 },944 {945 name: 'is',946 tagName: 'button',947 overrideStringValue: 'x-test-element',948 read: getAttribute('is'), // TODO: This could check if this is an extended custom element but this is a controversial spec.949 },950 {name: 'itemID', read: getAttribute('itemid')},951 {name: 'itemProp', read: getAttribute('itemprop')},952 {name: 'itemRef', read: getAttribute('itemref')},953 {name: 'itemScope', read: getAttribute('itemscope')},954 {name: 'itemType', read: getAttribute('itemtype')},955 {956 name: 'k',957 read: getSVGAttribute('k'),958 containerTagName: 'svg',959 tagName: 'hkern',960 },961 {962 name: 'K',963 containerTagName: 'svg',964 tagName: 'hkern',965 read: getSVGAttribute('k'),966 },967 {968 name: 'K1',969 containerTagName: 'svg',970 tagName: 'feComposite',971 read: getSVGProperty('k1'),972 },973 {974 name: 'k1',975 read: getSVGProperty('k1'),976 containerTagName: 'svg',977 tagName: 'feComposite',978 },979 {980 name: 'k2',981 read: getSVGProperty('k2'),982 containerTagName: 'svg',983 tagName: 'feComposite',984 },985 {986 name: 'k3',987 read: getSVGProperty('k3'),988 containerTagName: 'svg',989 tagName: 'feComposite',990 },991 {992 name: 'k4',993 read: getSVGProperty('k4'),994 containerTagName: 'svg',995 tagName: 'feComposite',996 },997 {998 name: 'kernelMatrix',999 read: getSVGProperty('kernelMatrix'),1000 containerTagName: 'svg',1001 tagName: 'feConvolveMatrix',1002 overrideStringValue: '1 2 3,4',1003 },1004 {1005 name: 'kernelUnitLength',1006 read: getSVGAttribute('kernelUnitLength'),1007 containerTagName: 'svg',1008 tagName: 'feConvolveMatrix',1009 },1010 {1011 name: 'kerning',1012 containerTagName: 'svg',1013 tagName: 'text',1014 read: getSVGAttribute('kerning'),1015 },1016 {name: 'keyParams', read: getAttribute('keyParams')},1017 {1018 name: 'keyPoints',1019 read: getSVGAttribute('keyPoints'),1020 containerTagName: 'svg',1021 tagName: 'animateMotion',1022 },1023 {1024 name: 'keySplines',1025 read: getSVGAttribute('keySplines'),1026 containerTagName: 'svg',1027 tagName: 'animate',1028 },1029 {1030 name: 'keyTimes',1031 read: getSVGAttribute('keyTimes'),1032 containerTagName: 'svg',1033 tagName: 'animate',1034 },1035 {name: 'keyType', read: getAttribute('keyType')},1036 {name: 'kind', tagName: 'track', overrideStringValue: 'captions'},1037 {name: 'label', tagName: 'track'},1038 {name: 'LANG', read: getProperty('lang')},1039 {name: 'lang'},1040 {name: 'length', read: getAttribute('length')},1041 {1042 name: 'lengthAdjust',1043 read: getSVGProperty('lengthAdjust'),1044 containerTagName: 'svg',1045 tagName: 'text',1046 overrideStringValue: 'spacingAndGlyphs',1047 },1048 {1049 name: 'letter-spacing',1050 containerTagName: 'svg',1051 tagName: 'text',1052 read: getSVGAttribute('letter-spacing'),1053 },1054 {1055 name: 'letterSpacing',1056 containerTagName: 'svg',1057 tagName: 'text',1058 read: getSVGAttribute('letter-spacing'),1059 },1060 {1061 name: 'lighting-color',1062 containerTagName: 'svg',1063 tagName: 'feDiffuseLighting',1064 read: getSVGAttribute('lighting-color'),1065 },1066 {1067 name: 'lightingColor',1068 containerTagName: 'svg',1069 tagName: 'feDiffuseLighting',1070 read: getSVGAttribute('lighting-color'),1071 },1072 {1073 name: 'limitingConeAngle',1074 read: getSVGProperty('limitingConeAngle'),1075 containerTagName: 'svg',1076 tagName: 'feSpotLight',1077 },1078 {name: 'list', read: getAttribute('list')}, // TODO: This should match the ID of a datalist element and then read property.1079 {1080 name: 'local',1081 read: getSVGAttribute('local'),1082 containerTagName: 'svg',1083 tagName: 'color-profile',1084 },1085 {name: 'loop', tagName: 'audio'},1086 {name: 'low', tagName: 'meter'},1087 {name: 'manifest', read: getAttribute('manifest')},1088 {name: 'marginHeight', containerTagName: 'frameset', tagName: 'frame'},1089 {name: 'marginWidth', containerTagName: 'frameset', tagName: 'frame'},1090 {1091 name: 'marker-end',1092 containerTagName: 'svg',1093 tagName: 'line',1094 read: getSVGAttribute('marker-end'),1095 },1096 {1097 name: 'marker-mid',1098 containerTagName: 'svg',1099 tagName: 'line',1100 read: getSVGAttribute('marker-mid'),1101 },1102 {1103 name: 'marker-start',1104 containerTagName: 'svg',1105 tagName: 'line',1106 read: getSVGAttribute('marker-start'),1107 },1108 {1109 name: 'markerEnd',1110 containerTagName: 'svg',1111 tagName: 'line',1112 read: getSVGAttribute('marker-end'),1113 },1114 {1115 name: 'markerHeight',1116 read: getSVGProperty('markerHeight'),1117 containerTagName: 'svg',1118 tagName: 'marker',1119 },1120 {1121 name: 'markerMid',1122 containerTagName: 'svg',1123 tagName: 'line',1124 read: getSVGAttribute('marker-mid'),1125 },1126 {1127 name: 'markerStart',1128 containerTagName: 'svg',1129 tagName: 'line',1130 read: getSVGAttribute('marker-start'),1131 },1132 {1133 name: 'markerUnits',1134 read: getSVGProperty('markerUnits'),1135 containerTagName: 'svg',1136 tagName: 'marker',1137 },1138 {1139 name: 'markerWidth',1140 read: getSVGProperty('markerWidth'),1141 containerTagName: 'svg',1142 tagName: 'marker',1143 },1144 {1145 name: 'mask',1146 containerTagName: 'svg',1147 tagName: 'path',1148 read: getSVGAttribute('mask'),1149 },1150 {1151 name: 'maskContentUnits',1152 read: getSVGProperty('maskContentUnits'),1153 containerTagName: 'svg',1154 tagName: 'mask',1155 overrideStringValue: 'objectBoundingBox',1156 },1157 {1158 name: 'maskUnits',1159 read: getSVGProperty('maskUnits'),1160 containerTagName: 'svg',1161 tagName: 'mask',1162 overrideStringValue: 'userSpaceOnUse',1163 },1164 {1165 name: 'mathematical',1166 read: getSVGAttribute('mathematical'),1167 containerTagName: 'svg',1168 tagName: 'font-face',1169 },1170 {name: 'max', tagName: 'input'},1171 {name: 'max', tagName: 'meter'},1172 {name: 'max', tagName: 'progress'},1173 {1174 name: 'max',1175 containerTagName: 'svg',1176 tagName: 'animate',1177 read: getSVGAttribute('max'),1178 },1179 {name: 'maxLength', tagName: 'textarea'},1180 {name: 'media', tagName: 'link'},1181 {1182 name: 'media',1183 containerTagName: 'svg',1184 tagName: 'style',1185 read: getSVGProperty('media'),1186 },1187 {name: 'mediaGroup', tagName: 'video', read: getAttribute('mediagroup')}, // TODO: Not yet implemented in Chrome.1188 {name: 'method', tagName: 'form', overrideStringValue: 'POST'},1189 {1190 name: 'method',1191 containerTagName: 'svg',1192 tagName: 'textPath',1193 read: getSVGProperty('method'),1194 overrideStringValue: 'stretch',1195 },1196 {name: 'min', tagName: 'input'},1197 {name: 'min', tagName: 'meter'},1198 {1199 name: 'min',1200 containerTagName: 'svg',1201 tagName: 'animate',1202 read: getSVGAttribute('min'),1203 },1204 {name: 'minLength', tagName: 'input'},1205 {1206 name: 'mode',1207 read: getSVGProperty('mode'),1208 containerTagName: 'svg',1209 tagName: 'feBlend',1210 overrideStringValue: 'multiply',1211 },1212 {name: 'multiple', tagName: 'select'},1213 {name: 'muted', tagName: 'video'},1214 {name: 'name', tagName: 'input'},1215 {1216 name: 'name',1217 containerTagName: 'svg',1218 tagName: 'color-profile',1219 read: getSVGAttribute('color-profile'),1220 },1221 {name: 'noModule', tagName: 'script'},1222 {name: 'nonce', read: getAttribute('nonce')},1223 {name: 'noValidate', tagName: 'form'},1224 {1225 name: 'numOctaves',1226 read: getSVGProperty('numOctaves'),1227 containerTagName: 'svg',1228 tagName: 'feTurbulence',1229 },1230 {1231 name: 'offset',1232 read: getSVGProperty('offset'),1233 containerTagName: 'svg',1234 tagName: 'stop',1235 },1236 {name: 'on-click'}, // TODO: Check for event subscriptions1237 {name: 'on-unknownevent'}, // TODO: Check for event subscriptions1238 {name: 'onclick'}, // TODO: Check for event subscriptions1239 {name: 'onClick'}, // TODO: Check for event subscriptions1240 {name: 'onunknownevent'}, // TODO: Check for event subscriptions1241 {name: 'onUnknownEvent'}, // TODO: Check for event subscriptions1242 {1243 name: 'opacity',1244 containerTagName: 'svg',1245 tagName: 'path',1246 read: getSVGAttribute('opacity'),1247 },1248 {name: 'open', tagName: 'details'},1249 {1250 name: 'operator',1251 read: getSVGProperty('operator'),1252 containerTagName: 'svg',1253 tagName: 'feComposite',1254 overrideStringValue: 'xor',1255 },1256 {name: 'optimum', tagName: 'meter'},1257 {1258 name: 'order',1259 read: getSVGAttribute('order'),1260 containerTagName: 'svg',1261 tagName: 'feConvolveMatrix',1262 },1263 {1264 name: 'orient',1265 read: getSVGAttribute('orient'),1266 containerTagName: 'svg',1267 tagName: 'marker',1268 },1269 {1270 name: 'orientation',1271 read: getSVGAttribute('orientation'),1272 containerTagName: 'svg',1273 tagName: 'glyph',1274 },1275 {1276 name: 'origin',1277 read: getSVGAttribute('origin'),1278 containerTagName: 'svg',1279 tagName: 'animateMotion',1280 },1281 {1282 name: 'overflow',1283 containerTagName: 'svg',1284 tagName: 'path',1285 read: getSVGAttribute('overflow'),1286 },1287 {1288 name: 'overline-position',1289 read: getSVGAttribute('overline-position'),1290 containerTagName: 'svg',1291 tagName: 'font-face',1292 },1293 {1294 name: 'overline-thickness',1295 read: getSVGAttribute('overline-thickness'),1296 containerTagName: 'svg',1297 tagName: 'font-face',1298 },1299 {1300 name: 'overlinePosition',1301 read: getSVGAttribute('overline-position'),1302 containerTagName: 'svg',1303 tagName: 'font-face',1304 },1305 {1306 name: 'overlineThickness',1307 read: getSVGAttribute('overline-thickness'),1308 containerTagName: 'svg',1309 tagName: 'font-face',1310 },1311 {1312 name: 'paint-order',1313 containerTagName: 'svg',1314 tagName: 'path',1315 read: getSVGAttribute('paint-order'),1316 },1317 {1318 name: 'paintOrder',1319 containerTagName: 'svg',1320 tagName: 'path',1321 read: getSVGAttribute('paint-order'),1322 },1323 {1324 name: 'panose-1',1325 read: getSVGAttribute('panose-1'),1326 containerTagName: 'svg',1327 tagName: 'font-face',1328 },1329 {1330 name: 'panose1',1331 containerTagName: 'svg',1332 tagName: 'font-face',1333 read: getSVGAttribute('panose-1'),1334 },1335 {1336 name: 'pathLength',1337 read: getSVGProperty('pathLength'),1338 containerTagName: 'svg',1339 tagName: 'path',1340 },1341 {name: 'pattern', tagName: 'input'},1342 {1343 name: 'patternContentUnits',1344 read: getSVGProperty('patternContentUnits'),1345 containerTagName: 'svg',1346 tagName: 'pattern',1347 overrideStringValue: 'objectBoundingBox',1348 },1349 {1350 name: 'patternTransform',1351 read: getSVGProperty('patternTransform'),1352 containerTagName: 'svg',1353 tagName: 'pattern',1354 overrideStringValue:1355 'translate(-10,-20) scale(2) rotate(45) translate(5,10)',1356 },1357 {1358 name: 'patternUnits',1359 read: getSVGProperty('patternUnits'),1360 containerTagName: 'svg',1361 tagName: 'pattern',1362 overrideStringValue: 'userSpaceOnUse',1363 },1364 {name: 'placeholder', tagName: 'input'},1365 {name: 'playsInline', read: getAttribute('playsinline')},1366 {1367 name: 'pointer-events',1368 containerTagName: 'svg',1369 tagName: 'path',1370 read: getSVGAttribute('pointer-events'),1371 },1372 {1373 name: 'pointerEvents',1374 containerTagName: 'svg',1375 tagName: 'path',1376 read: getSVGAttribute('pointer-events'),1377 },1378 {1379 name: 'points',1380 read: getSVGProperty('points'),1381 containerTagName: 'svg',1382 tagName: 'polygon',1383 overrideStringValue: '350,75 379,161 469,161',1384 },1385 {1386 name: 'pointsAtX',1387 read: getSVGProperty('pointsAtX'),1388 containerTagName: 'svg',1389 tagName: 'feSpotLight',1390 },1391 {1392 name: 'pointsAtY',1393 read: getSVGProperty('pointsAtY'),1394 containerTagName: 'svg',1395 tagName: 'feSpotLight',1396 },1397 {1398 name: 'pointsAtZ',1399 read: getSVGProperty('pointsAtZ'),1400 containerTagName: 'svg',1401 tagName: 'feSpotLight',1402 },1403 {1404 name: 'poster',1405 tagName: 'video',1406 overrideStringValue: 'https://reactjs.com',1407 },1408 {name: 'prefix', read: getAttribute('prefix')},1409 {name: 'preload', tagName: 'video', overrideStringValue: 'none'},1410 {1411 name: 'preserveAlpha',1412 read: getSVGProperty('preserveAlpha'),1413 containerTagName: 'svg',1414 tagName: 'feConvolveMatrix',1415 },1416 {1417 name: 'preserveAspectRatio',1418 read: getSVGProperty('preserveAspectRatio'),1419 containerTagName: 'svg',1420 tagName: 'feImage',1421 overrideStringValue: 'xMinYMin slice',1422 },1423 {1424 name: 'primitiveUnits',1425 read: getSVGProperty('primitiveUnits'),1426 containerTagName: 'svg',1427 tagName: 'filter',1428 overrideStringValue: 'objectBoundingBox',1429 },1430 {name: 'profile', read: getAttribute('profile')},1431 {name: 'property', read: getAttribute('property')},1432 {name: 'props', read: getAttribute('props')},1433 {1434 name: 'r',1435 read: getSVGProperty('r'),1436 containerTagName: 'svg',1437 tagName: 'circle',1438 overrideStringValue: '10pt',1439 },1440 {name: 'radioGroup', tagName: 'command', read: getAttribute('radiogroup')},1441 {1442 name: 'radius',1443 read: getSVGAttribute('radius'),1444 containerTagName: 'svg',1445 tagName: 'feMorphology',1446 },1447 {name: 'readOnly', tagName: 'input'},1448 {name: 'referrerPolicy', tagName: 'iframe'},1449 {1450 name: 'refX',1451 read: getSVGProperty('refX'),1452 containerTagName: 'svg',1453 tagName: 'marker',1454 overrideStringValue: '5em',1455 },1456 {1457 name: 'refY',1458 read: getSVGProperty('refY'),1459 containerTagName: 'svg',1460 tagName: 'marker',1461 overrideStringValue: '6em',1462 },1463 {name: 'rel', tagName: 'a'},1464 {1465 name: 'rendering-intent',1466 read: getSVGAttribute('rendering-intent'),1467 containerTagName: 'svg',1468 tagName: 'color-profile',1469 },1470 {1471 name: 'renderingIntent',1472 read: getSVGAttribute('rendering-intent'),1473 containerTagName: 'svg',1474 tagName: 'color-profile',1475 },1476 {1477 name: 'repeatCount',1478 read: getSVGAttribute('repeatcount'),1479 containerTagName: 'svg',1480 tagName: 'animate',1481 },1482 {1483 name: 'repeatDur',1484 read: getSVGAttribute('repeatdur'),1485 containerTagName: 'svg',1486 tagName: 'animate',1487 },1488 {name: 'required', tagName: 'input'},1489 {1490 name: 'requiredExtensions',1491 read: getSVGProperty('requiredExtensions'),1492 containerTagName: 'svg',1493 tagName: 'a',1494 },1495 {1496 name: 'requiredFeatures',1497 read: getSVGAttribute('requiredFeatures'),1498 containerTagName: 'svg',1499 tagName: 'a',1500 },1501 {name: 'resource', read: getAttribute('resource')},1502 {1503 name: 'restart',1504 read: getSVGAttribute('resource'),1505 containerTagName: 'svg',1506 tagName: 'animate',1507 },1508 {1509 name: 'result',1510 read: getSVGProperty('result'),1511 containerTagName: 'svg',1512 tagName: 'feBlend',1513 },1514 {name: 'results', tagName: 'input', read: getAttribute('results')}, // TODO: Should use property but it's not supported in Chrome.1515 {name: 'reversed', tagName: 'ol'},1516 {name: 'role', read: getAttribute('role')},1517 {1518 name: 'rotate',1519 read: getSVGAttribute('role'),1520 containerTagName: 'svg',1521 tagName: 'altGlyph',1522 },1523 {name: 'rows', tagName: 'textarea'},1524 {name: 'rowSpan', containerTagName: 'tr', tagName: 'td'},1525 {1526 name: 'rx',1527 read: getSVGProperty('rx'),1528 containerTagName: 'svg',1529 tagName: 'ellipse',1530 overrideStringValue: '1px',1531 },1532 {1533 name: 'ry',1534 read: getSVGProperty('ry'),1535 containerTagName: 'svg',1536 tagName: 'ellipse',1537 overrideStringValue: '2px',1538 },1539 {1540 name: 'sandbox',1541 tagName: 'iframe',1542 overrideStringValue: 'allow-forms allow-scripts',1543 },1544 {1545 name: 'scale',1546 read: getSVGProperty('scale'),1547 containerTagName: 'svg',1548 tagName: 'feDisplacementMap',1549 },1550 {1551 name: 'scope',1552 containerTagName: 'tr',1553 tagName: 'th',1554 overrideStringValue: 'row',1555 },1556 {name: 'scoped', tagName: 'style', read: getAttribute('scoped')},1557 {name: 'scrolling', tagName: 'iframe', overrideStringValue: 'no'},1558 {name: 'seamless', tagName: 'iframe', read: getAttribute('seamless')},1559 {name: 'security', tagName: 'iframe', read: getAttribute('security')},1560 {1561 name: 'seed',1562 read: getSVGProperty('seed'),1563 containerTagName: 'svg',1564 tagName: 'feTurbulence',1565 },1566 {name: 'selected', tagName: 'option', containerTagName: 'select'},1567 {name: 'selectedIndex', tagName: 'select'},1568 {name: 'shape', tagName: 'a'},1569 {1570 name: 'shape-rendering',1571 tagName: 'svg',1572 read: getSVGAttribute('shape-rendering'),1573 },1574 {1575 name: 'shapeRendering',1576 tagName: 'svg',1577 read: getSVGAttribute('shape-rendering'),1578 },1579 {name: 'size', tagName: 'input'},1580 {name: 'sizes', tagName: 'link'},1581 {1582 name: 'slope',1583 read: getSVGAttribute('slope'),1584 containerTagName: 'svg',1585 tagName: 'font-face',1586 },1587 {1588 name: 'spacing',1589 read: getSVGProperty('spacing'),1590 containerTagName: 'svg',1591 tagName: 'textPath',1592 overrideStringValue: 'auto',1593 },1594 {name: 'span', containerTagName: 'colgroup', tagName: 'col'},1595 {1596 name: 'specularConstant',1597 read: getSVGProperty('specularConstant'),1598 containerTagName: 'svg',1599 tagName: 'feSpecularLighting',1600 },1601 {1602 name: 'specularExponent',1603 read: getSVGProperty('specularConstant'),1604 containerTagName: 'svg',1605 tagName: 'feSpecularLighting',1606 },1607 {name: 'speed', read: getAttribute('speed')},1608 {1609 name: 'spellCheck',1610 overrideStringValue: 'false',1611 tagName: 'input',1612 read: getProperty('spellcheck'),1613 },1614 {1615 name: 'spellcheck',1616 overrideStringValue: 'false',1617 tagName: 'input',1618 read: getProperty('spellcheck'),1619 },1620 {1621 name: 'spreadMethod',1622 read: getSVGProperty('spreadMethod'),1623 containerTagName: 'svg',1624 tagName: 'linearGradient',1625 overrideStringValue: 'reflect',1626 },1627 {name: 'src', tagName: 'img', overrideStringValue: 'https://reactjs.com'},1628 {1629 name: 'srcDoc',1630 tagName: 'iframe',1631 overrideStringValue: '<p>Hi</p>',1632 read: getProperty('srcdoc'),1633 },1634 {1635 name: 'srcdoc',1636 tagName: 'iframe',1637 overrideStringValue: '<p>Hi</p>',1638 read: getProperty('srcdoc'),1639 },1640 {1641 name: 'srcLang',1642 containerTagName: 'audio',1643 tagName: 'track',1644 overrideStringValue: 'en',1645 read: getProperty('srclang'),1646 },1647 {1648 name: 'srclang',1649 containerTagName: 'audio',1650 tagName: 'track',1651 overrideStringValue: 'en',1652 read: getProperty('srclang'),1653 },1654 {name: 'srcSet', tagName: 'img'},1655 {name: 'srcset', tagName: 'img'},1656 {name: 'start', tagName: 'ol'},1657 {1658 name: 'startOffset',1659 read: getSVGProperty('startOffset'),1660 containerTagName: 'svg',1661 tagName: 'textPath',1662 },1663 {name: 'state', read: getAttribute('state')},1664 {1665 name: 'stdDeviation',1666 read: getSVGAttribute('stdDeviation'),1667 containerTagName: 'svg',1668 tagName: 'feGaussianBlur',1669 },1670 {1671 name: 'stemh',1672 read: getSVGAttribute('stemh'),1673 containerTagName: 'svg',1674 tagName: 'font-face',1675 },1676 {1677 name: 'stemv',1678 read: getSVGAttribute('stemv'),1679 containerTagName: 'svg',1680 tagName: 'font-face',1681 },1682 {name: 'step', read: getAttribute('step')},1683 {1684 name: 'stitchTiles',1685 read: getSVGProperty('stitchTiles'),1686 containerTagName: 'svg',1687 tagName: 'feTurbulence',1688 overrideStringValue: 'stitch',1689 },1690 {1691 name: 'stop-color',1692 containerTagName: 'svg',1693 tagName: 'stop',1694 read: getSVGAttribute('stop-color'),1695 },1696 {1697 name: 'stop-opacity',1698 containerTagName: 'svg',1699 tagName: 'stop',1700 read: getSVGAttribute('stop-opacity'),1701 },1702 {1703 name: 'stopColor',1704 containerTagName: 'svg',1705 tagName: 'stop',1706 read: getSVGAttribute('stop-color'),1707 },1708 {1709 name: 'stopOpacity',1710 containerTagName: 'svg',1711 tagName: 'stop',1712 read: getSVGAttribute('stop-opacity'),1713 },1714 {1715 name: 'strikethrough-position',1716 read: getSVGAttribute('strikethrough-position'),1717 containerTagName: 'svg',1718 tagName: 'font-face',1719 },1720 {1721 name: 'strikethrough-thickness',1722 read: getSVGAttribute('strikethrough-thickness'),1723 containerTagName: 'svg',1724 tagName: 'font-face',1725 },1726 {1727 name: 'strikethroughPosition',1728 read: getSVGAttribute('strikethrough-position'),1729 containerTagName: 'svg',1730 tagName: 'font-face',1731 },1732 {1733 name: 'strikethroughThickness',1734 read: getSVGAttribute('strikethrough-thickness'),1735 containerTagName: 'svg',1736 tagName: 'font-face',1737 },1738 {1739 name: 'string',1740 read: getSVGAttribute('string'),1741 containerTagName: 'svg',1742 tagName: 'font-face-format',1743 },1744 {1745 name: 'stroke',1746 containerTagName: 'svg',1747 tagName: 'path',1748 read: getSVGAttribute('stroke'),1749 },1750 {1751 name: 'stroke-dasharray',1752 containerTagName: 'svg',1753 tagName: 'path',1754 read: getSVGAttribute('stroke-dasharray'),1755 },1756 {1757 name: 'stroke-Dasharray',1758 containerTagName: 'svg',1759 tagName: 'path',1760 read: getSVGAttribute('stroke-dasharray'),1761 },1762 {1763 name: 'stroke-dashoffset',1764 containerTagName: 'svg',1765 tagName: 'path',1766 read: getSVGAttribute('stroke-dashoffset'),1767 },1768 {1769 name: 'stroke-linecap',1770 containerTagName: 'svg',1771 tagName: 'path',1772 read: getSVGAttribute('stroke-linecap'),1773 },1774 {1775 name: 'stroke-linejoin',1776 containerTagName: 'svg',1777 tagName: 'path',1778 read: getSVGAttribute('stroke-linejoin'),1779 },1780 {1781 name: 'stroke-miterlimit',1782 containerTagName: 'svg',1783 tagName: 'path',1784 read: getSVGAttribute('stroke-miterlimit'),1785 },1786 {1787 name: 'stroke-opacity',1788 containerTagName: 'svg',1789 tagName: 'path',1790 read: getSVGAttribute('stroke-opacity'),1791 },1792 {1793 name: 'stroke-width',1794 containerTagName: 'svg',1795 tagName: 'path',1796 read: getSVGAttribute('stroke-width'),1797 },1798 {1799 name: 'strokeDasharray',1800 containerTagName: 'svg',1801 tagName: 'path',1802 read: getSVGAttribute('stroke-dasharray'),1803 },1804 {1805 name: 'strokeDashoffset',1806 containerTagName: 'svg',1807 tagName: 'path',1808 read: getSVGAttribute('stroke-dashoffset'),1809 },1810 {1811 name: 'strokeLinecap',1812 containerTagName: 'svg',1813 tagName: 'path',1814 read: getSVGAttribute('stroke-linecap'),1815 },1816 {1817 name: 'strokeLinejoin',1818 containerTagName: 'svg',1819 tagName: 'path',1820 read: getSVGAttribute('stroke-linejoin'),1821 },1822 {1823 name: 'strokeMiterlimit',1824 containerTagName: 'svg',1825 tagName: 'path',1826 read: getSVGAttribute('stroke-miterlimit'),1827 },1828 {1829 name: 'strokeOpacity',1830 containerTagName: 'svg',1831 tagName: 'path',1832 read: getSVGAttribute('stroke-opacity'),1833 },1834 {1835 name: 'strokeWidth',1836 containerTagName: 'svg',1837 tagName: 'path',1838 read: getSVGAttribute('stroke-width'),1839 },1840 {name: 'style'},1841 {name: 'summary', tagName: 'table'},1842 {1843 name: 'suppressContentEditableWarning',1844 read: getAttribute('suppresscontenteditablewarning'),1845 },1846 {1847 name: 'surfaceScale',1848 read: getSVGProperty('surfaceScale'),1849 containerTagName: 'svg',1850 tagName: 'feDiffuseLighting',1851 },1852 {1853 name: 'systemLanguage',1854 overrideStringValue: 'en',1855 read: getSVGProperty('systemLanguage'),1856 containerTagName: 'svg',1857 tagName: 'a',1858 },1859 {name: 'tabIndex'},1860 {1861 name: 'tabIndex',1862 read: getSVGProperty('tabIndex'),1863 tagName: 'svg',1864 },1865 {1866 name: 'tableValues',1867 read: getSVGProperty('tableValues'),1868 containerTagName: 'svg',1869 tagName: 'feFuncA',1870 overrideStringValue: '0 1 2 3',1871 },1872 {1873 name: 'target',1874 read: getSVGProperty('target'),1875 containerTagName: 'svg',1876 tagName: 'a',1877 },1878 {1879 name: 'targetX',1880 read: getSVGProperty('targetX'),1881 containerTagName: 'svg',1882 tagName: 'feConvolveMatrix',1883 },1884 {1885 name: 'targetY',1886 read: getSVGProperty('targetY'),1887 containerTagName: 'svg',1888 tagName: 'feConvolveMatrix',1889 },1890 {1891 name: 'text-anchor',1892 containerTagName: 'svg',1893 tagName: 'text',1894 read: getSVGAttribute('text-anchor'),1895 },1896 {1897 name: 'text-decoration',1898 containerTagName: 'svg',1899 tagName: 'text',1900 read: getSVGAttribute('text-decoration'),1901 },1902 {1903 name: 'text-rendering',1904 tagName: 'svg',1905 read: getSVGAttribute('text-rendering'),1906 },1907 {1908 name: 'textAnchor',1909 containerTagName: 'svg',1910 tagName: 'text',1911 read: getSVGAttribute('text-anchor'),1912 },1913 {1914 name: 'textDecoration',1915 containerTagName: 'svg',1916 tagName: 'text',1917 read: getSVGAttribute('text-decoration'),1918 },1919 {1920 name: 'textLength',1921 read: getSVGProperty('textLength'),1922 containerTagName: 'svg',1923 tagName: 'text',1924 },1925 {1926 name: 'textRendering',1927 tagName: 'svg',1928 read: getSVGAttribute('text-rendering'),1929 },1930 {name: 'title'},1931 {1932 name: 'to',1933 read: getSVGAttribute('to'),1934 containerTagName: 'svg',1935 tagName: 'set',1936 },1937 {1938 name: 'transform',1939 read: getSVGProperty('transform'),1940 containerTagName: 'svg',1941 tagName: 'a',1942 overrideStringValue:1943 'translate(-10,-20) scale(2) rotate(45) translate(5,10)',1944 },1945 {name: 'type', tagName: 'button', overrideStringValue: 'reset'},1946 {1947 name: 'type',1948 containerTagName: 'svg',1949 tagName: 'feFuncA',1950 read: getSVGProperty('type'),1951 overrideStringValue: 'discrete',1952 },1953 {name: 'typeof', read: getAttribute('typeof')},1954 {1955 name: 'u1',1956 read: getSVGAttribute('u1'),1957 containerTagName: 'svg',1958 tagName: 'hkern',1959 },1960 {1961 name: 'u2',1962 read: getSVGAttribute('u2'),1963 containerTagName: 'svg',1964 tagName: 'hkern',1965 },1966 {1967 name: 'underline-position',1968 read: getSVGAttribute('underline-position'),1969 containerTagName: 'svg',1970 tagName: 'font-face',1971 },1972 {1973 name: 'underline-thickness',1974 read: getSVGAttribute('underline-thickness'),1975 containerTagName: 'svg',1976 tagName: 'font-face',1977 },1978 {1979 name: 'underlinePosition',1980 read: getSVGAttribute('underline-position'),1981 containerTagName: 'svg',1982 tagName: 'font-face',1983 },1984 {1985 name: 'underlineThickness',1986 read: getSVGAttribute('underline-thickness'),1987 containerTagName: 'svg',1988 tagName: 'font-face',1989 },1990 {1991 name: 'unicode',1992 read: getSVGAttribute('unicode'),1993 containerTagName: 'svg',1994 tagName: 'glyph',1995 },1996 {1997 name: 'unicode-bidi',1998 containerTagName: 'svg',1999 tagName: 'text',2000 read: getSVGAttribute('unicode-bidi'),2001 },2002 {2003 name: 'unicode-range',2004 read: getSVGAttribute('unicode-range'),2005 containerTagName: 'svg',2006 tagName: 'font-face',2007 },2008 {2009 name: 'unicodeBidi',2010 containerTagName: 'svg',2011 tagName: 'text',2012 read: getSVGAttribute('unicode-bidi'),2013 },2014 {2015 name: 'unicodeRange',2016 read: getSVGAttribute('unicode-range'),2017 containerTagName: 'svg',2018 tagName: 'font-face',2019 },2020 {2021 name: 'units-per-em',2022 read: getSVGAttribute('units-per-em'),2023 containerTagName: 'svg',2024 tagName: 'font-face',2025 },2026 {2027 name: 'unitsPerEm',2028 read: getSVGAttribute('unites-per-em'),2029 containerTagName: 'svg',2030 tagName: 'font-face',2031 },2032 {name: 'unknown', read: getAttribute('unknown')},2033 {2034 name: 'unselectable',2035 read: getAttribute('unselectable'),2036 tagName: 'span',2037 overrideStringValue: 'on',2038 },2039 {name: 'useMap', tagName: 'img'},2040 {2041 name: 'v-alphabetic',2042 read: getSVGAttribute('v-alphabetic'),2043 containerTagName: 'svg',2044 tagName: 'font-face',2045 },2046 {2047 name: 'v-hanging',2048 read: getSVGAttribute('v-hanging'),2049 containerTagName: 'svg',2050 tagName: 'font-face',2051 },2052 {2053 name: 'v-ideographic',2054 read: getSVGAttribute('v-ideographic'),2055 containerTagName: 'svg',2056 tagName: 'font-face',2057 },2058 {2059 name: 'v-mathematical',2060 read: getSVGAttribute('v-mathematical'),2061 containerTagName: 'svg',2062 tagName: 'font-face',2063 },2064 {2065 name: 'vAlphabetic',2066 read: getSVGAttribute('v-alphabetic'),2067 containerTagName: 'svg',2068 tagName: 'font-face',2069 },2070 {name: 'value', tagName: 'input', extraProps: {onChange() {}}},2071 {name: 'value', tagName: 'input', type: 'email', extraProps: {onChange() {}}},2072 {2073 name: 'value',2074 tagName: 'input',2075 type: 'number',2076 extraProps: {onChange() {}},2077 },2078 {name: 'value', tagName: 'textarea', extraProps: {onChange() {}}},2079 {2080 name: 'value',2081 containerTagName: 'select',2082 tagName: 'option',2083 extraProps: {onChange() {}},2084 },2085 {2086 name: 'Value',2087 containerTagName: 'select',2088 tagName: 'option',2089 read: getProperty('value'),2090 },2091 {2092 name: 'values',2093 read: getSVGProperty('values'),2094 containerTagName: 'svg',2095 tagName: 'feColorMatrix',2096 overrideStringValue: '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0',2097 },2098 {2099 name: 'vector-effect',2100 containerTagName: 'svg',2101 tagName: 'line',2102 read: getSVGAttribute('vector-effect'),2103 },2104 {2105 name: 'vectorEffect',2106 containerTagName: 'svg',2107 tagName: 'line',2108 read: getSVGAttribute('vector-effect'),2109 },2110 {name: 'version', containerTagName: 'document', tagName: 'html'},2111 {name: 'version', tagName: 'svg', read: getSVGAttribute('version')},2112 {2113 name: 'vert-adv-y',2114 read: getSVGAttribute('vert-origin-y'),2115 containerTagName: 'svg',2116 tagName: 'font',2117 },2118 {2119 name: 'vert-origin-x',2120 read: getSVGAttribute('vert-origin-y'),2121 containerTagName: 'svg',2122 tagName: 'font',2123 },2124 {2125 name: 'vert-origin-y',2126 read: getSVGAttribute('vert-origin-y'),2127 containerTagName: 'svg',2128 tagName: 'font',2129 },2130 {2131 name: 'vertAdvY',2132 read: getSVGAttribute('vert-adv-y'),2133 containerTagName: 'svg',2134 tagName: 'font',2135 },2136 {2137 name: 'vertOriginX',2138 read: getSVGAttribute('vert-origin-x'),2139 containerTagName: 'svg',2140 tagName: 'font',2141 },2142 {2143 name: 'vertOriginY',2144 read: getSVGAttribute('vert-origin-y'),2145 containerTagName: 'svg',2146 tagName: 'font',2147 },2148 {2149 name: 'vHanging',2150 read: getSVGAttribute('v-hanging'),2151 containerTagName: 'svg',2152 tagName: 'font-face',2153 },2154 {2155 name: 'vIdeographic',2156 read: getSVGAttribute('v-ideographic'),2157 containerTagName: 'svg',2158 tagName: 'font-face',2159 },2160 {2161 name: 'viewBox',2162 read: getSVGProperty('viewBox'),2163 containerTagName: 'svg',2164 tagName: 'marker',2165 overrideStringValue: '0 0 1500 1000',2166 },2167 {2168 name: 'viewTarget',2169 read: getSVGAttribute('viewTarget'),2170 containerTagName: 'svg',2171 tagName: 'view',2172 },2173 {name: 'visibility', read: getAttribute('visibility')},2174 {2175 name: 'visibility',2176 containerTagName: 'svg',2177 tagName: 'path',2178 read: getSVGAttribute('visibility'),2179 },2180 {2181 name: 'vMathematical',2182 read: getSVGAttribute('v-mathematical'),2183 containerTagName: 'svg',2184 tagName: 'font-face',2185 },2186 {name: 'vocab', read: getAttribute('vocab')},2187 {name: 'width', tagName: 'img'},2188 {2189 name: 'width',2190 containerTagName: 'svg',2191 tagName: 'rect',2192 read: getSVGProperty('width'),2193 },2194 {2195 name: 'widths',2196 read: getSVGAttribute('widths'),2197 containerTagName: 'svg',2198 tagName: 'font-face',2199 },2200 {name: 'wmode', read: getAttribute('wmode'), tagName: 'embed'},2201 {2202 name: 'word-spacing',2203 containerTagName: 'svg',2204 tagName: 'text',2205 read: getSVGAttribute('word-spacing'),2206 },2207 {2208 name: 'wordSpacing',2209 containerTagName: 'svg',2210 tagName: 'text',2211 read: getSVGAttribute('word-spacing'),2212 },2213 {name: 'wrap', tagName: 'textarea'},2214 {2215 name: 'writing-mode',2216 containerTagName: 'svg',2217 tagName: 'text',2218 read: getSVGAttribute('writing-mode'),2219 },2220 {2221 name: 'writingMode',2222 containerTagName: 'svg',2223 tagName: 'text',2224 read: getSVGAttribute('writing-mode'),2225 },2226 {2227 name: 'x',2228 read: getSVGAttribute('x'),2229 containerTagName: 'svg',2230 tagName: 'altGlyph',2231 },2232 {2233 name: 'x-height',2234 read: getSVGAttribute('x-height'),2235 containerTagName: 'svg',2236 tagName: 'font-face',2237 },2238 {2239 name: 'x1',2240 read: getSVGProperty('x1'),2241 containerTagName: 'svg',2242 tagName: 'line',2243 },2244 {2245 name: 'x2',2246 read: getSVGProperty('x2'),2247 containerTagName: 'svg',2248 tagName: 'line',2249 },2250 {2251 name: 'xChannelSelector',2252 read: getSVGProperty('xChannelSelector'),2253 containerTagName: 'svg',2254 tagName: 'feDisplacementMap',2255 overrideStringValue: 'R',2256 },2257 {2258 name: 'xHeight',2259 read: getSVGAttribute('x-height'),2260 containerTagName: 'svg',2261 tagName: 'font-face',2262 },2263 {name: 'XLink:Actuate', read: getAttribute('XLink:Actuate')},2264 {name: 'xlink:actuate', read: getAttribute('xlink:actuate')},2265 {name: 'xlink:arcrole', read: getAttribute('xlink:arcrole')},2266 {name: 'xlink:href', read: getAttribute('xlink:href')},2267 {name: 'xlink:role', read: getAttribute('xlink:role')},2268 {name: 'xlink:show', read: getAttribute('xlink:show')},2269 {name: 'xlink:title', read: getAttribute('xlink:title')},2270 {name: 'xlink:type', read: getAttribute('xlink:type')},2271 {name: 'xlinkActuate', read: getAttribute('xlink:actuate')},2272 {name: 'XlinkActuate', read: getAttribute('Xlink:actuate')},2273 {name: 'xlinkArcrole', read: getAttribute('xlink:arcrole')},2274 {name: 'xlinkHref', read: getAttribute('xlink:href')},2275 {name: 'xlinkRole', read: getAttribute('xlink:role')},2276 {name: 'xlinkShow', read: getAttribute('xlink:show')},2277 {name: 'xlinkTitle', read: getAttribute('xlink:title')},2278 {name: 'xlinkType', read: getAttribute('xlink:type')},2279 {name: 'xml:base', read: getAttribute('xml:base')},2280 {name: 'xml:lang', read: getAttribute('xml:lang')},2281 {name: 'xml:space', read: getAttribute('xml:space')},2282 {name: 'xmlBase', read: getAttribute('xml:base')},2283 {name: 'xmlLang', read: getAttribute('xml:lang')},2284 {name: 'xmlns', read: getProperty('namespaceURI'), tagName: 'svg'},2285 {name: 'xmlns:xlink', read: getAttribute('xmlns:xlink')},2286 {name: 'xmlnsXlink', read: getAttribute('xmlns:xlink')},2287 {name: 'xmlSpace', read: getAttribute('xml:space')},2288 {2289 name: 'y',2290 read: getSVGAttribute('y'),2291 containerTagName: 'svg',2292 tagName: 'altGlyph',2293 },2294 {2295 name: 'y1',2296 read: getSVGProperty('y1'),2297 containerTagName: 'svg',2298 tagName: 'line',2299 },2300 {2301 name: 'y2',2302 read: getSVGProperty('y2'),2303 containerTagName: 'svg',2304 tagName: 'line',2305 },2306 {2307 name: 'yChannelSelector',2308 read: getSVGProperty('yChannelSelector'),2309 containerTagName: 'svg',2310 tagName: 'feDisplacementMap',2311 overrideStringValue: 'B',2312 },2313 {2314 name: 'z',2315 read: getSVGProperty('z'),2316 containerTagName: 'svg',2317 tagName: 'fePointLight',2318 },2319 {name: 'zoomAndPan', read: getSVGProperty('zoomAndPan'), tagName: 'svg'},2320];2321attributes.forEach(attr => {2322 attr.read = attr.read || getProperty(attr.name);2323});...
replset_read_preference.test.js
Source:replset_read_preference.test.js
...262 new GridStore(db, doc._id, 'r', {263 readPreference: ReadPreference.SECONDARY264 }).open(function (err, gridStore) {265 test.equal(null, err);266 gridStore.read(function (err, data2) {267 test.equal(null, err);268 test.equal(data.toString('base64'), data2.toString('base64'));269 client.close();270 restartAndDone(done);271 });272 });273 });274 });275 });276 });277 });278 client.connect(function (err) {279 test.equal(null, err);280 });...
parse.js
Source:parse.js
...99 case '\n':100 case '\r':101 case '\u2028':102 case '\u2029':103 read()104 return105 case '/':106 read()107 lexState = 'comment'108 return109 case undefined:110 read()111 return newToken('eof')112 }113 if (util.isSpaceSeparator(c)) {114 read()115 return116 }117 // This code is unreachable.118 // if (!lexStates[parseState]) {119 // throw invalidLexState(parseState)120 // }121 return lexStates[parseState]()122 },123 comment () {124 switch (c) {125 case '*':126 read()127 lexState = 'multiLineComment'128 return129 case '/':130 read()131 lexState = 'singleLineComment'132 return133 }134 throw invalidChar(read())135 },136 multiLineComment () {137 switch (c) {138 case '*':139 read()140 lexState = 'multiLineCommentAsterisk'141 return142 case undefined:143 throw invalidChar(read())144 }145 read()146 },147 multiLineCommentAsterisk () {148 switch (c) {149 case '*':150 read()151 return152 case '/':153 read()154 lexState = 'default'155 return156 case undefined:157 throw invalidChar(read())158 }159 read()160 lexState = 'multiLineComment'161 },162 singleLineComment () {163 switch (c) {164 case '\n':165 case '\r':166 case '\u2028':167 case '\u2029':168 read()169 lexState = 'default'170 return171 case undefined:172 read()173 return newToken('eof')174 }175 read()176 },177 value () {178 switch (c) {179 case '{':180 case '[':181 return newToken('punctuator', read())182 case 'n':183 read()184 literal('ull')185 return newToken('null', null)186 case 't':187 read()188 literal('rue')189 return newToken('boolean', true)190 case 'f':191 read()192 literal('alse')193 return newToken('boolean', false)194 case '-':195 case '+':196 if (read() === '-') {197 sign = -1198 }199 lexState = 'sign'200 return201 case '.':202 buffer = read()203 lexState = 'decimalPointLeading'204 return205 case '0':206 buffer = read()207 lexState = 'zero'208 return209 case '1':210 case '2':211 case '3':212 case '4':213 case '5':214 case '6':215 case '7':216 case '8':217 case '9':218 buffer = read()219 lexState = 'decimalInteger'220 return221 case 'I':222 read()223 literal('nfinity')224 return newToken('numeric', Infinity)225 case 'N':226 read()227 literal('aN')228 return newToken('numeric', NaN)229 case '"':230 case "'":231 doubleQuote = (read() === '"')232 buffer = ''233 lexState = 'string'234 return235 }236 throw invalidChar(read())237 },238 identifierNameStartEscape () {239 if (c !== 'u') {240 throw invalidChar(read())241 }242 read()243 const u = unicodeEscape()244 switch (u) {245 case '$':246 case '_':247 break248 default:249 if (!util.isIdStartChar(u)) {250 throw invalidIdentifier()251 }252 break253 }254 buffer += u255 lexState = 'identifierName'256 },257 identifierName () {258 switch (c) {259 case '$':260 case '_':261 case '\u200C':262 case '\u200D':263 buffer += read()264 return265 case '\\':266 read()267 lexState = 'identifierNameEscape'268 return269 }270 if (util.isIdContinueChar(c)) {271 buffer += read()272 return273 }274 return newToken('identifier', buffer)275 },276 identifierNameEscape () {277 if (c !== 'u') {278 throw invalidChar(read())279 }280 read()281 const u = unicodeEscape()282 switch (u) {283 case '$':284 case '_':285 case '\u200C':286 case '\u200D':287 break288 default:289 if (!util.isIdContinueChar(u)) {290 throw invalidIdentifier()291 }292 break293 }294 buffer += u295 lexState = 'identifierName'296 },297 sign () {298 switch (c) {299 case '.':300 buffer = read()301 lexState = 'decimalPointLeading'302 return303 case '0':304 buffer = read()305 lexState = 'zero'306 return307 case '1':308 case '2':309 case '3':310 case '4':311 case '5':312 case '6':313 case '7':314 case '8':315 case '9':316 buffer = read()317 lexState = 'decimalInteger'318 return319 case 'I':320 read()321 literal('nfinity')322 return newToken('numeric', sign * Infinity)323 case 'N':324 read()325 literal('aN')326 return newToken('numeric', NaN)327 }328 throw invalidChar(read())329 },330 zero () {331 switch (c) {332 case '.':333 buffer += read()334 lexState = 'decimalPoint'335 return336 case 'e':337 case 'E':338 buffer += read()339 lexState = 'decimalExponent'340 return341 case 'x':342 case 'X':343 buffer += read()344 lexState = 'hexadecimal'345 return346 }347 return newToken('numeric', sign * 0)348 },349 decimalInteger () {350 switch (c) {351 case '.':352 buffer += read()353 lexState = 'decimalPoint'354 return355 case 'e':356 case 'E':357 buffer += read()358 lexState = 'decimalExponent'359 return360 }361 if (util.isDigit(c)) {362 buffer += read()363 return364 }365 return newToken('numeric', sign * Number(buffer))366 },367 decimalPointLeading () {368 if (util.isDigit(c)) {369 buffer += read()370 lexState = 'decimalFraction'371 return372 }373 throw invalidChar(read())374 },375 decimalPoint () {376 switch (c) {377 case 'e':378 case 'E':379 buffer += read()380 lexState = 'decimalExponent'381 return382 }383 if (util.isDigit(c)) {384 buffer += read()385 lexState = 'decimalFraction'386 return387 }388 return newToken('numeric', sign * Number(buffer))389 },390 decimalFraction () {391 switch (c) {392 case 'e':393 case 'E':394 buffer += read()395 lexState = 'decimalExponent'396 return397 }398 if (util.isDigit(c)) {399 buffer += read()400 return401 }402 return newToken('numeric', sign * Number(buffer))403 },404 decimalExponent () {405 switch (c) {406 case '+':407 case '-':408 buffer += read()409 lexState = 'decimalExponentSign'410 return411 }412 if (util.isDigit(c)) {413 buffer += read()414 lexState = 'decimalExponentInteger'415 return416 }417 throw invalidChar(read())418 },419 decimalExponentSign () {420 if (util.isDigit(c)) {421 buffer += read()422 lexState = 'decimalExponentInteger'423 return424 }425 throw invalidChar(read())426 },427 decimalExponentInteger () {428 if (util.isDigit(c)) {429 buffer += read()430 return431 }432 return newToken('numeric', sign * Number(buffer))433 },434 hexadecimal () {435 if (util.isHexDigit(c)) {436 buffer += read()437 lexState = 'hexadecimalInteger'438 return439 }440 throw invalidChar(read())441 },442 hexadecimalInteger () {443 if (util.isHexDigit(c)) {444 buffer += read()445 return446 }447 return newToken('numeric', sign * Number(buffer))448 },449 string () {450 switch (c) {451 case '\\':452 read()453 buffer += escape()454 return455 case '"':456 if (doubleQuote) {457 read()458 return newToken('string', buffer)459 }460 buffer += read()461 return462 case "'":463 if (!doubleQuote) {464 read()465 return newToken('string', buffer)466 }467 buffer += read()468 return469 case '\n':470 case '\r':471 throw invalidChar(read())472 case '\u2028':473 case '\u2029':474 separatorChar(c)475 break476 case undefined:477 throw invalidChar(read())478 }479 buffer += read()480 },481 start () {482 switch (c) {483 case '{':484 case '[':485 return newToken('punctuator', read())486 // This code is unreachable since the default lexState handles eof.487 // case undefined:488 // return newToken('eof')489 }490 lexState = 'value'491 },492 beforePropertyName () {493 switch (c) {494 case '$':495 case '_':496 buffer = read()497 lexState = 'identifierName'498 return499 case '\\':500 read()501 lexState = 'identifierNameStartEscape'502 return503 case '}':504 return newToken('punctuator', read())505 case '"':506 case "'":507 doubleQuote = (read() === '"')508 lexState = 'string'509 return510 }511 if (util.isIdStartChar(c)) {512 buffer += read()513 lexState = 'identifierName'514 return515 }516 throw invalidChar(read())517 },518 afterPropertyName () {519 if (c === ':') {520 return newToken('punctuator', read())521 }522 throw invalidChar(read())523 },524 beforePropertyValue () {525 lexState = 'value'526 },527 afterPropertyValue () {528 switch (c) {529 case ',':530 case '}':531 return newToken('punctuator', read())532 }533 throw invalidChar(read())534 },535 beforeArrayValue () {536 if (c === ']') {537 return newToken('punctuator', read())538 }539 lexState = 'value'540 },541 afterArrayValue () {542 switch (c) {543 case ',':544 case ']':545 return newToken('punctuator', read())546 }547 throw invalidChar(read())548 },549 end () {550 // This code is unreachable since it's handled by the default lexState.551 // if (c === undefined) {552 // read()553 // return newToken('eof')554 // }555 throw invalidChar(read())556 },557}558function newToken (type, value) {559 return {560 type,561 value,562 line,563 column,564 }565}566function literal (s) {567 for (const c of s) {568 const p = peek()569 if (p !== c) {570 throw invalidChar(read())571 }572 read()573 }574}575function escape () {576 const c = peek()577 switch (c) {578 case 'b':579 read()580 return '\b'581 case 'f':582 read()583 return '\f'584 case 'n':585 read()586 return '\n'587 case 'r':588 read()589 return '\r'590 case 't':591 read()592 return '\t'593 case 'v':594 read()595 return '\v'596 case '0':597 read()598 if (util.isDigit(peek())) {599 throw invalidChar(read())600 }601 return '\0'602 case 'x':603 read()604 return hexEscape()605 case 'u':606 read()607 return unicodeEscape()608 case '\n':609 case '\u2028':610 case '\u2029':611 read()612 return ''613 case '\r':614 read()615 if (peek() === '\n') {616 read()617 }618 return ''619 case '1':620 case '2':621 case '3':622 case '4':623 case '5':624 case '6':625 case '7':626 case '8':627 case '9':628 throw invalidChar(read())629 case undefined:630 throw invalidChar(read())631 }632 return read()633}634function hexEscape () {635 let buffer = ''636 let c = peek()637 if (!util.isHexDigit(c)) {638 throw invalidChar(read())639 }640 buffer += read()641 c = peek()642 if (!util.isHexDigit(c)) {643 throw invalidChar(read())644 }645 buffer += read()646 return String.fromCodePoint(parseInt(buffer, 16))647}648function unicodeEscape () {649 let buffer = ''650 let count = 4651 while (count-- > 0) {652 const c = peek()653 if (!util.isHexDigit(c)) {654 throw invalidChar(read())655 }656 buffer += read()657 }658 return String.fromCodePoint(parseInt(buffer, 16))659}660const parseStates = {661 start () {662 if (token.type === 'eof') {663 throw invalidEOF()664 }665 push()666 },667 beforePropertyName () {668 switch (token.type) {669 case 'identifier':670 case 'string':...
uebuffer.js
Source:uebuffer.js
1const UEGUIDCache = require('./ueguidcache')2const logger = require('./logger')3const utils = require('./utils')4const CONSTS = require('./constants')5// the unreal engine bit buffer implementation6const SHIFTS = [7 1, 2, 4, 8, 16, 32, 64, 1288]9const ShortRotationScale = 360.0 / 65536.010const ByteRotationScale = 360.0 / 256.011const ueBufferProto = {12 // copy from underlying buffer to get a new uebuffer, cannot handle linked buffer case13 copyOut (bitsCount) {14 if (bitsCount > this.remainingBits) {15 throw new Error('Not enough data to copy out')16 }17 const currentByteIndex = this.posBits >> 318 const endByteIndex = (this.posBits + bitsCount) >> 319 const newBuffer = Buffer.alloc(endByteIndex - currentByteIndex + 1)20 this.buffer.copy(newBuffer, 0, currentByteIndex, endByteIndex + 1)21 const newUEBuffer = ueBuffer(newBuffer)22 newUEBuffer.skipBits(this.posBits % 8)23 newUEBuffer.remainingBits = bitsCount24 newUEBuffer._localRemainingBits = bitsCount25 return newUEBuffer26 },27 // connect two buffers, just like linked list28 append (nextBuf) {29 this.lastBuffer.nextBuffer = nextBuf30 this.lastBuffer = nextBuf31 this.remainingBits += nextBuf.remainingBits32 },33 ended () {34 return this.remainingBits <= 035 },36 remainingBytes () {37 return (this.remainingBits + 7) >> 338 },39 _readLocalBit () {40 const b = this.buffer[this.posBits >> 3] & SHIFTS[this.posBits & 0b0111] // x & 0111 means x % 8 -> 0..741 this.posBits++42 this._localRemainingBits--43 return b != 044 },45 _moveToNextBuffer () {46 const nextBuf = this.curBuffer.nextBuffer47 if (nextBuf != null) {48 this.curBuffer = nextBuf49 this.buffer = nextBuf.buffer50 this.nextBuffer = nextBuf.nextBuffer51 this.posBits = nextBuf.posBits52 this._localRemainingBits = nextBuf._localRemainingBits53 }54 },55 // return true of false56 readBit () {57 if (this.remainingBits <= 0) {58 //throw new Error('UEBuffer is at end, cannot read more')59 throw new utils.BufferNotEnoughError('UEBuffer is at end, cannot read more')60 }61 if (this._localRemainingBits == 0) { // we need next buffer to come in62 this._moveToNextBuffer()63 }64 this.remainingBits--65 return this._readLocalBit()66 },67 readByte () {68 let ret = 069 for (let i = 0; i < 8; i++) {70 if (this.readBit()) {71 ret = ret | SHIFTS[i & 0b0111]72 }73 }74 return ret75 },76 // returns byte array77 readBytes (sizeBytes) {78 let ret = []79 for (let i = 0; i < sizeBytes; i++) {80 ret.push(this.readByte())81 }82 return ret83 },84 // returns byte array85 readBits (sizeBits = 8) {86 let ret = new Array((sizeBits + 7) >> 3)87 ret.fill(0)88 for (let i = 0; i < sizeBits; i++) {89 if (this.readBit()) {90 const b = i >> 391 ret[b] = ret[b] | SHIFTS[i & 0b0111]92 }93 }94 return ret95 },96 // MAX_PACKETID = 1638497 readInt(maxValue = 16384) {98 let mask = 199 let ret = 0100 while (ret + mask < maxValue) {101 if (this.readBit()) {102 ret = ret + mask103 }104 mask = mask << 1105 }106 return ret107 },108 readIntPacked () {109 let ret = 0110 let count = 0111 let more = 1112 while (more > 0) {113 let nextByte = this.readByte()114 more = nextByte & 1115 nextByte = nextByte >> 1116 ret += (nextByte << (7 * count++)) // 8 << 28 = -2147483648, in KT, same117 }118 // so, ret can actually be negative119 return ret120 },121 readInt8 () {122 // return readByte().toByte().toInt() will this have negative?123 return this.readByte()124 },125 readUInt8 () {126 return this.readByte()127 },128 readInt16 () {129 // ?????130 },131 readUInt32 () {132 let ret = this.readByte()133 ret |= (this.readByte() << 8)134 ret |= (this.readByte() << 16)135 ret |= (this.readByte() << 24)136 return ret137 },138 readString () {139 let saveNum = this.readUInt32()140 const loadUCS2Char = saveNum > 2147483647 // means int32 is negative141 if (loadUCS2Char) {142 saveNum = 4294967296 - saveNum143 }144 if (saveNum > 1024) {145 throw new utils.BufferNotEnoughError(`Too big saveNum: ${saveNum}`)146 }147 if (saveNum === 0) {148 return ''149 }150 if (loadUCS2Char) {151 return new Buffer(this.readBytes(saveNum + 2)).toString('utf-16').replace('\u0000', '')152 } else {153 let bytes = this.readBytes(saveNum)154 return new Buffer(bytes).toString('utf-8').replace('\u0000', '')155 }156 },157 readName () {158 const bHardcoded = this.readBit()159 if (bHardcoded) {160 const nameIndex = this.readInt(CONSTS.MAX_NETWORKED_HARDCODED_NAME + 1)161 return CONSTS.PUBGNAMES[nameIndex]162 } else {163 const inString = this.readString()164 const inNumber = this.readUInt32()165 return inString166 }167 },168 readUInt16 () {169 let ret = this.readByte()170 ret = ret | (this.readByte() << 8)171 return ret172 },173 skipBits (bitsCount) {174 if (bitsCount > this.remainingBits) {175 throw new Error(`only ${this.remainingBits} bits left`)176 }177 this.remainingBits -= bitsCount178 while (bitsCount > this._localRemainingBits) {179 bitsCount -= this._localRemainingBits180 this._moveToNextBuffer()181 }182 this.posBits += bitsCount183 this._localRemainingBits -= bitsCount184 },185 readUEGuid () {186 return this.readIntPacked()187 },188 readObject () {189 const ueguid = this.readUEGuid()190 let obj = null191 const ueguidValid = ueguid > 0192 const ueguidDefault = ueguid === 1193 if (!ueguidValid) {194 return [ueguid, null]195 }196 if (ueguidValid && !ueguidDefault) {197 obj = UEGUIDCache.getObjectFromUEGuid(ueguid)198 }199 if (ueguidDefault || UEGUIDCache.isExportingUEGUIDBunch) { // need to read something from the packet and set to cache200 const exportFlags = this.readUInt8()201 const bHasPath = (exportFlags & 1) > 0202 if (bHasPath) {203 [outerGuid, outerObj] = this.readObject() // [ueguid, obj]204 const pathName = this.readString()205 let networkCheckSum = 0206 if ((exportFlags & 0b100) > 0) {207 networkCheckSum = this.readUInt32()208 }209 const bIsPackage = ((ueguid & 1) === 0) && (outerGuid === 0)210 if (obj != null || ueguidDefault) {211 return [ueguid, obj]212 }213 // register to cache214 UEGUIDCache.registerUEGUIDFromPathClient(ueguid, pathName, outerGuid)215 // try again216 obj = UEGUIDCache.getObjectFromUEGuid(ueguid)217 }218 }219 return [ueguid, obj]220 },221 // return [x, y, z]222 readVector (scaleFactor = 1000, maxBitsPerComponent = 24) {223 const bits = this.readInt(maxBitsPerComponent)224 const bias = 1 << (bits + 1)225 const max = 1 << (bits + 2)226 return [227 (this.readInt(max) - bias) / scaleFactor,228 (this.readInt(max) - bias) / scaleFactor,229 (this.readInt(max) - bias) / scaleFactor230 ]231 },232 readRotationShort () {233 const result = [0, 0, 0]234 if (this.readBit()) {235 result[0] = this.readUInt16() * ShortRotationScale // pitch236 }237 if (this.readBit()) {238 result[1] = this.readUInt16() * ShortRotationScale // yaw239 }240 if (this.readBit()) {241 result[2] = this.readUInt16() * ShortRotationScale // roll242 }243 return result244 },245 readRotation () {246 const result = [0, 0, 0]247 if (this.readBit()) {248 result[0] = this.readUInt8() * ByteRotationScale // pitch249 }250 if (this.readBit()) {251 result[1] = this.readUInt8() * ByteRotationScale // yaw252 }253 if (this.readBit()) {254 result[2] = this.readUInt8() * ByteRotationScale // roll255 }256 return result257 },258 readFloat () {259 var buffer = new ArrayBuffer(4)260 var uint8Array = new Uint8Array(buffer)261 uint8Array[0] = this.readByte()262 uint8Array[1] = this.readByte()263 uint8Array[2] = this.readByte()264 uint8Array[3] = this.readByte()265 return new Float32Array(buffer)[0]266 },267 readPropertyNetId () {268 if (this.readUInt32() > 0) {269 return this.readString()270 }271 return ''272 },273 readFloatVector () {274 return [this.readFloat(), this.readFloat(), this.readFloat()]275 },276 // data to read is [location, rotation, velocity]277 // OPTIMIZATION: we dont care about velocity, we only return [x, y, z, yaw]278 readMovement (isMoving, isPlayer) {279 const bSimulatedPhysicSleep = this.readBit()280 const bRepPhysics = this.readBit()281 const result = [0, 0, 0, 0] // x, y, z, yaw282 let location = [0, 0, 0]283 if (isMoving) {284 location = this.readVector(10000, 30) // location285 } else {286 location = this.readVector(100, 24) // location287 }288 result[0] = location[0]289 result[1] = 8192 - location[1] // Map to my openlayer map290 result[2] = location[2]291 let rotation = [0, 0, 0]292 if (isPlayer) {293 rotation = this.readRotationShort()294 } else {295 rotation = this.readRotation()296 }297 result[3] = rotation[1]298 this.readVector(1000, 24) // velocity299 if (bRepPhysics) {300 this.readVector(1000, 24)301 }302 return result303 },304 readFixedVector (maxValue, numBits) {305 return [306 this.readFixedCompressedFloat(maxValue, numBits),307 this.readFixedCompressedFloat(maxValue, numBits),308 this.readFixedCompressedFloat(maxValue, numBits)309 ]310 },311 readFixedCompressedFloat (maxValue, numBits) {312 const maxBitValue = (1 << (numBits - 1)) - 1 //0111 1111 - Max abs value we will serialize313 const bias = 1 << (numBits - 1) //1000 0000 - Bias to pivot around (in order to support signed314 const serIntMax = 1 << (numBits - 0) // 1 0000 0000 - What we pass into SerializeInt315 const maxDelta = (1 << (numBits - 0)) - 1// 1111 1111 - Max delta is316 const delta = this.readInt(serIntMax)317 const unscaledValue = delta - bias318 if (maxValue > maxBitValue) {319 return unscaledValue * (maxValue / maxBitValue)320 } else {321 const invScale = 1 / (maxBitValue / maxValue)322 return unscaledValue * invScale323 }324 }325}326// create uebuffer from nodejs Buffer327const ueBuffer = buffer => {328 const self = Object.create(ueBufferProto)329 self.buffer = buffer330 self.nextBuffer = null331 self.lastBuffer = self332 self.posBits = 0333 self.remainingBits = buffer.length * 8334 self._localRemainingBits = buffer.length * 8335 self.curBuffer = self336 return self337}...
permissions.js
Source:permissions.js
1let permissions =[2 { permission: "P1",3 object:"I_HOME",4 action:"read",5 },6 { permission: "P2",7 object:"I_PROFILE",8 action:"write",9 },10 { permission: "P3",11 object:"I_PROFILE",12 action:"read",13 },14 { permission: "P4",15 object:"OFFER_COURSE",16 action:"write",17 },18 { permission: "P4",19 object:"I_COURSES",20 action:"read",21 },22 { permission: "P6",23 object:"I_COURSE_DETAILS",24 action:"read",25 },26 { permission: "P7",27 object:"I_COURSE_DETAILS",28 action:"write",29 },30 { permission: "P8",31 object:"OFFER_COURSE",32 action:"read",33 },34 { permission: "P9",35 object:"I_ANNOUNCEMENT",36 action:"read",37 },38 { permission: "P10",39 object:"I_ANNOUNCEMENT",40 action:"write",41 },42 { permission: "P11",43 object:"I_RESOURCES",44 action:"read",45 },46 { permission: "P12",47 object:"I_RESOURCES",48 action:"write",49 },50 { permission: "P13",51 object:"I_RESOURCE",52 action:"read",53 },54 { permission: "P14",55 object:"I_RESOURCE",56 action:"delete",57 },58 { permission: "P15",59 object:"I_TESTS",60 action:"read",61 },62 { permission: "P16",63 object:"I_TEST",64 action:"read",65 },66 { permission: "P17",67 object:"I_TEST",68 action:"write",69 },70 { permission: "P18",71 object:"I_TESTS",72 action:"write",73 },74 { permission: "P19",75 object:"I_TEST_Q",76 action:"read",77 },78 { permission: "P20",79 object:"I_TEST_A",80 action:"read",81 },82 { permission: "P21",83 object:"I_TEST",84 action:"delete",85 },86 { permission: "P22",87 object:"I_TEST_R",88 action:"read",89 },90 { permission: "P23",91 object:"I_TEST_R",92 action:"write",93 },94 { permission: "P24",95 object:"I_ASSIGNMENTS",96 action:"read",97 },98 { permission: "P25",99 object:"I_ASSIGNMENTS",100 action:"write",101 },102 { permission: "P26",103 object:"I_ASSIGNMENT",104 action:"read",105 },106 { permission: "P27",107 object:"I_ASSIGNMENT",108 action:"delete",109 },110 { permission: "P28",111 object:"I_ASSIGNMENT_SUB",112 action:"read",113 },114 { permission: "P29",115 object:"I_COURSE_STUDENTS",116 action:"read",117 },118 { permission: "P30",119 object:"I_COURSE_STUDENTS",120 action:"approve",121 },122 { permission: "P31",123 object:"I_COURSE_ASSISTANTS",124 action:"read",125 },126 { permission: "P32",127 object:"I_COURSE_ASSISTANTS",128 action:"approve",129 },130 { permission: "P33",131 object:"I_QA",132 action:"read",133 },134 { permission: "P34",135 object:"I_QA",136 action:"write",137 },138 { permission: "P35",139 object:"I_ANSWER",140 action:"write",141 },142 { permission: "P36",143 object:"I_ASSIGNMENT_SUBMISSIONS",144 action:"read",145 },146 { permission: "P37",147 object:"I_ANNOUNCEMENTS",148 action:"read",149 },150 { permission: "P38",151 object:"I_ATTANDANCE",152 action:"write",153 },154 { permission: "P39",155 object:"I_ATTANDANCE",156 action:"read",157 },158 { permission: "P40",159 object:"I_ATTANDANCE_DETAILS",160 action:"read",161 },162 { permission: "P41",163 object:"I_ADD_ATTENDANCE",164 action:"read",165 },166 { permission: "P42",167 object:"I_REPLY",168 action:"write",169 },170 { permission: "P43",171 object:"I_EXAMS",172 action:"read",173 },174 { permission: "P44",175 object:"I_ADDEXAM",176 action:"read",177 },178 { permission: "P45",179 object:"I_ADDEXAM",180 action:"write",181 },182 { permission: "P46",183 object:"I_EXAM",184 action:"read",185 },186 { permission: "P47",187 object:"I_RESULT",188 action:"read",189 },190 { permission: "P48",191 object:"I_ALL",192 action:"read",193 },194 { permission: "P49",195 object:"HOD_MESSAGES",196 action:"read",197 },198 { permission: "P50",199 object:"HOD_MESSAGES",200 action:"write",201 },202 { permission: "P51",203 object:"HOME",204 action:"read",205 },206 { permission: "P52",207 object:"COURSE",208 action:"read",209 },210 { permission: "P53",211 object:"ABOUT",212 action:"read",213 },214 { permission: "P54",215 object:"CONTACT",216 action:"read",217 },218 { permission: "P55",219 object:"SERVICES",220 action:"read",221 },222 { permission: "P56",223 object:"SEARCH",224 action:"write",225 },226 { permission: "P57",227 object:"SEARCH_INST",228 action:"read",229 },230 { permission: "P58",231 object:"SEARCH_COURSE",232 action:"read",233 },234 { permission: "P59",235 object:"S_HOME",236 action:"read",237 },238 { permission: "P60",239 object:"S_PROFILE",240 action:"read",241 },242 { permission: "P62",243 object:"S_PROFILE",244 action:"write",245 },246 { permission: "P63",247 object:"S_SEARCH",248 action:"write",249 },250 { permission: "P64",251 object:"S_SEARCH_INST",252 action:"read",253 },254 { permission: "P65",255 object:"S_SEARCH_COURSE",256 action:"read",257 },258 { permission: "P66",259 object:"S_COURSE",260 action:"join",261 },262 { permission: "P67",263 object:"S_COURSES",264 action:"read",265 },266 { permission: "P68",267 object:"S_COURSE_DETAILS",268 action:"read",269 },270 { permission: "P69",271 object:"S_JOIN_COURSES",272 action:"read",273 },274 { permission: "P70",275 object:"S_ASSIGNMENT",276 action:"read",277 },278 { permission: "P72",279 object:"S_RESOURCES",280 action:"read",281 },282 { permission: "P73",283 object:"S_RESOURCE",284 action:"read",285 },286 { permission: "P74",287 object:"S_ASSIGNMENTS",288 action:"read",289 },290 { permission: "P75",291 object:"S_STUDENTS",292 action:"read",293 },294 { permission: "P76",295 object:"S_ANNOUNCEMENT",296 action:"read",297 },298 { permission: "P77",299 object:"S_TESTS",300 action:"read",301 },302 { permission: "P78",303 object:"S_TEST_Q",304 action:"read",305 },306 { permission: "P79",307 object:"S_TEST_ANSWER",308 action:"read",309 },310 { permission: "P80",311 object:"S_QA",312 action:"read",313 },314 { permission: "P81",315 object:"S_QA",316 action:"write",317 },318 { permission: "P82",319 object:"S_ANSWER",320 action:"write",321 },322 { permission: "P83",323 object:"S_ASSIGNMENT_SUBMIT",324 action:"write",325 },326 { permission: "P84",327 object:"S_ASSIGNMENT_SUBMIT",328 action:"read",329 },330 { permission: "P85",331 object:"S_ASSIGNMENT_SUBMISSION",332 action:"read",333 },334 { permission: "P86",335 object:"S_REPLY",336 action:"write",337 },338 { permission: "P87",339 object:"S_EXAMS",340 action:"read",341 },342 { permission: "P88",343 object:"S_EXAM_START",344 action:"write",345 },346 { permission: "P88",347 object:"S_EXAM_RESULT",348 action:"read",349 },350 { permission: "P89",351 object:"S_EXAM_SUBMIT",352 action:"write",353 },354 { permission: "P90",355 object:"S_EXAM_ENTER",356 action:"read",357 },358 { permission: "P61",359 object:"S_INSTRUCTOR_CONTACT",360 action:"read",361 },362 { permission: "P91",363 object:"SECOND",364 action:"read",365 },366 { permission: "P92",367 object:"THIRD",368 action:"read",369 },370 { permission: "P93",371 object:"FOURTH",372 action:"read",373 },374 { permission: "P94",375 object:"A_HOME", 376 action:"read", 377 },378 { permission: "P95",379 object:"A_PROFILE", 380 action:"read", 381 },382 { permission: "P96",383 object:"A_PROFILE", 384 action:"write", 385 },386 { permission: "P97",387 object:"A_SEARCH", 388 action:"write", 389 },390 { permission: "P98",391 object:"A_SEARCH_INST", 392 action:"read", 393 },394 { permission: "P99",395 object:"A_SEARCH", 396 action:"read", 397 },398 { permission: "P100",399 object:"A_JOIN_COURSE", 400 action:"read", 401 },402 { permission: "P101",403 object:"A_JOIN_COURSE", 404 action:"join", 405 },406 { permission: "P102",407 object:"A_COURSES", 408 action:"read", 409 },410 411]...
player.js
Source:player.js
1const CONSTS = require('../constants')2function processPlayer (buf, actor, repObj, waitingHandle, dataOut, iteration) {3 switch (waitingHandle) {4 case 1:5 if (buf.readBit()) {6 // bHidden7 dataOut.hidden = true8 dataOut.disappear = true9 }10 break11 case 2:12 if (!buf.readBit()) {13 // bReplicateMovement14 dataOut.noMovement = true15 dataOut.disappear = true16 }17 break18 case 3:19 if (buf.readBit()) {20 // tearOff21 dataOut.tearoff = true22 dataOut.disappear = true23 }24 break25 case 13:26 buf.readInt(CONSTS.ROLE_MAX) // role27 break28 case 5:29 [ownerGuid, owner] = buf.readObject()30 dataOut.playerOwner = ownerGuid // seems never hit this31 break32 case 14:33 const movement = buf.readMovement(true /* isMoving */, true /* isPlayer */)34 if (movement[0] >= 0 && movement[1] >= 0) { // readVecotr sometime might get me negative value, might be a bug35 dataOut.newLoc = movement36 }37 break38 case 7:39 // when player get into car, we will get40 // [03-02T20:48:09.272 - Symbol(PlayerUpdate) - guid:xxx -- {"noMovement":true,"disappear":true,"playerAttachTo":5140,"pToPS":0} --- (22500)41 // 5140 is the car guid42 [attachGuid, attachName] = buf.readObject()43 dataOut.attachedTo = attachGuid44 // then when he get off the car45 // [03-02T20:49:37.773 - Symbol(PlayerUpdate) - guid:xxx -- {"newLoc":[1165.6766,2849.3476,164.672,8.4759521484375],"playerAttachTo":0,"pToPS":yyy} --- (27454)46 break47 case 8:48 buf.readVector(10000, 30) // locationOffset, not sure what it is49 break50 case 9:51 buf.readVector(10000, 30) // locationOffset, not sure what it is52 break53 case 10:54 buf.readRotationShort()55 break56 case 11:57 buf.readName() // attachSocket58 break59 case 12:60 [attachComponnent, attachName] = buf.readObject()61 break62 case 13:63 buf.readInt(CONSTS.ROLE_MAX) // role64 break65 case 14:66 buf.readBit()67 break68 case 15:69 buf.readObject()70 break71 case 16:72 [playerStateGuid, playerState] = buf.readObject()73 dataOut.pToPS = playerStateGuid // this mapping is imporatnt74 break75 case 17:76 buf.readUInt16() // pitch77 break78 case 18:79 buf.readObject()80 break81 // ACharacter82 case 19:83 buf.readObject()84 break85 case 20:86 buf.readName()87 break88 case 21:89 buf.readVector(10000, 30)90 break91 case 22:92 buf.readRotationShort()93 break94 case 23:95 buf.readBit()96 break97 case 24:98 buf.readBit()99 break100 case 25:101 buf.readBit()102 break103 case 26:104 buf.readFloat()105 break106 case 27:107 buf.readFloat()108 break109 case 28:110 buf.readByte()111 break112 case 29:113 buf.readBit()114 break115 case 30:116 buf.readFloat()117 break118 case 31:119 buf.readUInt32()120 break121 case 32:122 buf.readBit()123 break124 case 33:125 buf.readObject()126 break127 case 34:128 buf.readFloat()129 break130 case 35:131 buf.readVector(10000, 30)132 break133 case 36:134 buf.readRotationShort()135 break136 case 37:137 buf.readObject()138 break139 case 38:140 buf.readName()141 break142 case 39:143 buf.readBit()144 break145 case 40:146 buf.readBit()147 break148 case 41:149 buf.readBit() // bHasAdditiveSources150 buf.readBit() // bHasOverrideSources151 buf.readVector(10, 24) // lastPreAdditiveVelocity152 buf.readBit() // bIsAdditiveVelocityApplied153 buf.readUInt8() // flags154 break155 case 42:156 buf.readVector(10, 24)157 break158 case 43:159 buf.readVector(10, 24)160 break161 // AMutableCharacter162 case 44:163 const arrayNum = buf.readUInt16()164 let index = buf.readIntPacked()165 while (index != 0) {166 buf.readUInt8()167 index = buf.readIntPacked()168 }169 break170 // ATslCharacter171 case 45:172 buf.readInt(8) // Remote_CastAnim173 break174 case 46:175 buf.readBit() // CurrentWeaponZoomLevel176 break177 case 47:178 buf.readFloat() // BuffFinalSpreadFactor179 break180 case 48:181 buf.readObject() // InventoryFacade182 break183 case 49:184 buf.readObject() // WeaponProcessor185 break186 case 50:187 buf.readByte() // CharacterState188 break189 case 51:190 buf.readBit() // bIsScopingRemote191 break192 case 52:193 buf.readBit() // bIsAimingRemote194 break195 case 53:196 buf.readBit() // bIsFirstPersonRemote197 break198 case 54:199 buf.readBit() // bIsInVehicleRemote200 break201 case 55:202 buf.readUInt32() // SpectatedCount203 break204 case 56:205 buf.readObject() // Team206 break207 case 57: // begin FTakeHitInfo208 buf.readFloat() // ActualDamage209 break210 case 58:211 buf.readObject() // DamageType212 break213 case 59:214 buf.readObject() // PlayerInstigator215 break216 case 60:217 buf.readVector(1, 20) // DamageOrigin218 break219 case 61:220 buf.readVector(1, 20) // RelHitLocation221 break222 case 62:223 buf.readName() // BoneName224 break225 case 63:226 buf.readFloat() // DamageMaxRadius227 break228 case 64:229 buf.readByte() // ShotDirPitch230 break231 case 65:232 buf.readByte() // ShotDirYaw233 break234 case 66:235 buf.readBit() // bPointDamage236 break237 case 67:238 buf.readBit() // bRadialDamage239 break240 case 68:241 buf.readBit() // bKilled242 break243 case 69:244 buf.readByte() // EnsureReplicationByte245 break246 case 70:247 buf.readName() // AttackerWeaponName248 break249 case 71:250 buf.readFloatVector() // AttackerLocation251 break // FTakeHitInfo end252 case 72:253 buf.readInt(3) // TargetingType254 break255 case 73:256 buf.readFloat() // ReviveCastingTime257 break258 case 74:259 buf.readBit() // bWantsToRun260 break261 case 75:262 buf.readBit() // bWantsToSprint263 break264 case 76:265 buf.readBit() // bWantsToSprintingAuto266 break267 case 77:268 buf.readBit() // bWantsToRollingLeft269 break270 case 78:271 buf.readBit() // bWantsToRollingRight272 break273 case 79:274 buf.readBit() // bIsPeekLeft275 break276 case 80:277 buf.readBit() // bIsPeekRight278 break279 case 81:280 buf.readBit() // IgnoreRotation281 break282 case 82:283 buf.readBit() // bIsGroggying284 break285 case 83:286 buf.readBit() // bIsThirdPerson287 break288 case 84:289 buf.readBit() // bIsReviving290 break291 case 85:292 buf.readBit() // bIsWeaponObstructed293 break294 case 86:295 buf.readBit() // bIsCoatEquipped296 break297 case 87:298 buf.readBit() // bIsZombie299 break300 case 88:301 buf.readBit() // bIsThrowHigh302 break303 case 89:304 buf.readBit() // bUseRightShoulderAiming305 break306 case 90:307 buf.readRotationShort() // GunDirectionSway308 break309 case 91:310 buf.readFixedVector(1, 16) // AimOffsets311 break312 case 92:313 buf.readObject() // NetOwnerController314 break315 case 93:316 buf.readBit() // bAimStateActive317 break318 case 94:319 buf.readBit() // bIsHoldingBreath320 break321 case 95:322 const health = buf.readFloat() // Health323 dataOut.health = health324 break325 case 96:326 buf.readBit() // HealthMax327 break328 case 97:329 buf.readFloat() // GroggyHealth330 break331 case 98:332 buf.readFloat() // GroggyHealthMax333 break334 case 99:335 buf.readFloat() // BoostGauge336 break337 case 100:338 buf.readFloat() // BoostGaugeMax339 break340 case 101:341 buf.readInt(8) // ShoesSoundType342 break343 case 102:344 buf.readObject() // VehicleRiderComponent345 break346 case 103:347 buf.readBit() // bIsActiveRagdollActive348 break349 case 104:350 buf.readInt(4) // PreReplicatedStanceMode351 break352 case 105:353 buf.readBit() // bServerFinishedVault354 break355 case 106:356 buf.readBit() // bWantsToCancelVault357 break358 case 107:359 buf.readBit() // bIsDemoVaulting_CP360 break361 default:362 return false363 }364 return true365}...
charmove.js
Source:charmove.js
1const CONSTS = require('../constants')2const utils = require('../utils')3const ShortRotationScale = 360.0 / 65536.04// return null or SelfLocEx event5function processCharMove (buf, actor) {6 const dataOut = {}7 while (!buf.ended()) {8 const repIndex = buf.readInt(128)9 const payloadBits = buf.readIntPacked()10 const preReadBitsLeft = buf.remainingBits11 if (payloadBits > preReadBitsLeft) {12 break13 }14 // repIndex can be 110, with payLoadBits = 49, not like loc info15 switch (repIndex) {16 case 29:17 case 33:18 if (buf.readBit()) {19 buf.readFloat() // timestamp20 }21 if (buf.readBit()) {22 buf.readVector(10, 24) // inAccel23 }24 if (buf.readBit()) {25 dataOut.loc = buf.readVector(10000, 30)26 }27 if (buf.readBit()) {28 buf.readUInt8() // compressedMoveFlags29 }30 if (buf.readBit()) {31 buf.readUInt8() // clientRoll32 }33 if (buf.readBit()) {34 const view = buf.readUInt32()35 dataOut.rotation = (view >> 16) * ShortRotationScale36 }37 break38 case 30:39 case 34:40 if (buf.readBit()) {41 buf.readFloat() // timestamp42 }43 if (buf.readBit()) {44 buf.readVector(10, 24) // inAccel45 }46 if (buf.readBit()) {47 buf.readUInt8() // pendingFlags48 }49 if (buf.readBit()) {50 buf.readUInt32() // view51 }52 if (buf.readBit()) {53 buf.readFloat() // timestamp54 }55 if (buf.readBit()) {56 buf.readVector(10, 24) // inAccel57 }58 if (buf.readBit()) {59 dataOut.loc = buf.readVector(10000, 30)60 }61 if (buf.readBit()) {62 buf.readUInt8() // compressedMoveFlags63 }64 if (buf.readBit()) {65 buf.readUInt8() // clientRoll66 }67 if (buf.readBit()) {68 const view = buf.readUInt32()69 dataOut.rotation = (view >> 16) * ShortRotationScale70 }71 break72 default:73 break74 }75 const postReadBitsLeft = buf.remainingBits76 if (preReadBitsLeft - postReadBitsLeft < payloadBits) {77 buf.skipBits(payloadBits - preReadBitsLeft + postReadBitsLeft)78 }79 } // end of while loop80 if (Object.keys(dataOut).length > 0) {81 // EVT_HERE: SELFLOCEX82 return { type: CONSTS.EventTypes.SELFLOCEX, guid: actor.guid, data: dataOut }83 }84 return null85}...
Using AI Code Generation
1const playwright = require('playwright');2(async () => {3 for (const browserType of BROWSER) {4 const browser = await playwright[browserType].launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.screenshot({ path: `example-${browserType}.png` });8 await browser.close();9 }10})();
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch({ headless: false });4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.click('#L2AGLb');7 await page.fill('#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input', 'Playwright');8 await page.click('#tsf > div:nth-child(2) > div > div.FPdoLc.VlcLAe > center > input.gNO89b');9 await page.screenshot({ path: 'google.png' });10 const allElements = await page.$$('a');11 console.log('Number of links on the page: ', allElements.length);12 await browser.close();13})();
Using AI Code Generation
1const fs = require('fs');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch({ headless: false });5 const context = await browser.newContext();6 const page = await context.newPage();7 const [fileChooser] = await Promise.all([8 page.waitForEvent('filechooser'),9 ]);10 await fileChooser.setFiles('/Users/username/Desktop/test.txt');11 await browser.close();12})();13const fs = require('fs');14const { chromium } = require('playwright');15(async () => {16 const browser = await chromium.launch({ headless: false });17 const context = await browser.newContext();18 const page = await context.newPage();19 const fileChooser = await page.$('input[type=file]');20 await fileChooser.setInputFiles('/Users/username/Desktop/test.txt');21 await browser.close();22})();23const fs = require('fs');24const { chromium } = require('playwright');25(async () => {26 const browser = await chromium.launch({ headless: false });27 const context = await browser.newContext();28 const page = await context.newPage();29 await page.setInputFiles('input[type=file]', '/Users/username/Desktop/test.txt');30 await browser.close();31})();32const fs = require('fs');33const { chromium } = require('playwright');34(async () => {35 const browser = await chromium.launch({ headless: false });36 const context = await browser.newContext();37 const page = await context.newPage();38 await page.setInputFiles('input[type=file
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 const data = await page.evaluate(() => {6 return {7 };8 });9 console.log(data);10 await browser.close();11})();
Using AI Code Generation
1const { read } = require('@playwright/test');2const fs = require('fs');3const path = require('path');4(async () => {5 const data = await read(path.join(__dirname, 'data.json'));6 console.log(data);7})();8{
Using AI Code Generation
1const fs = require('fs');2fs.readFile('C:\\Users\\shubh\\Desktop\\test\\test.txt', (err, data) => {3 if (err) throw err;4 console.log(data.toString());5});6fs.writeFile('C:\\Users\\shubh\\Desktop\\test\\test.txt', 'Hello Node.js', (err) => {7 if (err) throw err;8 console.log('File is created successfully.');9});10fs.appendFile('C:\\Users\\shubh\\Desktop\\test\\test.txt', 'Hello Node.js', (err) => {11 if (err) throw err;12 console.log('File is created successfully.');13});14fs.mkdir('C:\\Users\\shubh\\Desktop\\test\\test.txt', (err) => {15 if (err) throw err;16 console.log('File is created successfully.');17});18fs.readdir('C:\\Users\\shubh\\Desktop\\test\\test.txt', (err) => {19 if (err) throw err;20 console.log('File is created successfully.');21});22fs.rmdir('C:\\Users\\shubh\\Desktop\\test\\test.txt', (err) => {23 if (err) throw err;24 console.log('File is created successfully.');25});26fs.unlink('C:\\Users\\shubh\\Desktop\\test\\test.txt', (err) => {27 if (err) throw err;28 console.log('File is created successfully.');29});30fs.rename('C:\\Users\\shubh\\Desktop\\test\\test.txt', 'C:\\Users\\shubh\\Desktop\\test\\test1.txt', (err) => {31 if (err) throw err;32 console.log('File is created successfully.');33});34fs.copyFile('C:\\Users\\shubh\\Desktop\\test\\test.txt
Using AI Code Generation
1const {read, write} = require('@playwright/test');2const fs = require('fs');3const config = read('config');4const data = read('data');5const env = process.env.ENV;6const envConfig = config[env];7const envData = data[env];8write('envConfig', envConfig);9write('envData', envData);10const {read, write} = require('@playwright/test');11const fs = require('fs');12const config = read('config');13const data = read('data');14const env = process.env.ENV;15const envConfig = config[env];16const envData = data[env];17write('envConfig', envConfig);18write('envData', envData);19const { test, expect } = require('@playwright/test');20test('My first test', async ({ page }) => {21 await page.waitForSelector('#twotabsearchtextbox');22 await page.fill('#twotabsearchtextbox', 'iphone 12');23 await page.click('#nav-search-submit-text input');24 await page.waitForSelector('#search');25 await page.waitForTimeout(3000);26 await page.screenshot({ path: `example.png` });27 const title = await page.title();28 expect(title).toBe('Amazon.in : iphone 12');29});30const { test, expect } = require('@playwright/test');31test('My first test', async ({ page }) => {32 await page.waitForSelector('#twotabsearchtextbox');33 await page.fill('#twotabsearchtextbox', 'iphone 12');34 await page.click('#nav-search-submit-text input');35 await page.waitForSelector('#search');36 await page.waitForTimeout(3000);37 await page.screenshot({ path: `example.png` });38 const title = await page.title();39 expect(title).toBe('Amazon.in : iphone 12');40});41const { test, expect } = require('@playwright/test');42test('My first test', async ({ page }) => {43 await page.waitForSelector('#twotabsearchtextbox');44 await page.fill('#twotab
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!