Best JavaScript code snippet using playwright-internal
CesiumInspector.js
Source:CesiumInspector.js
...51 var text = document.createElement('div');52 text.textContent = 'Cesium Inspector';53 text.className = 'cesium-cesiumInspector-button';54 text.setAttribute('data-bind', 'click: toggleDropDown');55 element.appendChild(text);56 element.className = 'cesium-cesiumInspector';57 element.setAttribute('data-bind', 'css: { "cesium-cesiumInspector-visible" : dropDownVisible, "cesium-cesiumInspector-hidden" : !dropDownVisible }');58 container.appendChild(this._element);5960 var panel = document.createElement('div');61 this._panel = panel;62 panel.className = 'cesium-cesiumInspector-dropDown';63 element.appendChild(panel);6465 // General66 var general = document.createElement('div');67 general.className = 'cesium-cesiumInspector-sectionHeader';68 var plus = document.createElement('span');69 plus.className = 'cesium-cesiumInspector-toggleSwitch';70 plus.setAttribute('data-bind', 'click: toggleGeneral, text: generalSwitchText');71 general.appendChild(plus);72 general.appendChild(document.createTextNode('General'));73 panel.appendChild(general);7475 var generalSection = document.createElement('div');76 generalSection.className = 'cesium-cesiumInspector-section';77 generalSection.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : generalVisible, "cesium-cesiumInspector-hide" : !generalVisible}');78 panel.appendChild(generalSection);7980 var debugShowFrustums = document.createElement('div');81 generalSection.appendChild(debugShowFrustums);82 var frustumStatistics = document.createElement('div');83 frustumStatistics.className = 'cesium-cesiumInspector-frustumStatistics';84 frustumStatistics.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : frustums, "cesium-cesiumInspector-hide" : !frustums}, html: frustumStatisticText');85 var frustumsCheckbox = document.createElement('input');86 frustumsCheckbox.type = 'checkbox';87 frustumsCheckbox.setAttribute('data-bind', 'checked: frustums');88 debugShowFrustums.appendChild(frustumsCheckbox);89 debugShowFrustums.appendChild(document.createTextNode('Show Frustums'));90 debugShowFrustums.appendChild(frustumStatistics);9192 var debugShowFrustumPlanes = document.createElement('div');93 generalSection.appendChild(debugShowFrustumPlanes);94 var frustumPlanesCheckbox = document.createElement('input');95 frustumPlanesCheckbox.type = 'checkbox';96 frustumPlanesCheckbox.setAttribute('data-bind', 'checked: frustumPlanes');97 debugShowFrustumPlanes.appendChild(frustumPlanesCheckbox);98 debugShowFrustumPlanes.appendChild(document.createTextNode('Show Frustum Planes'));99100 var performanceDisplay = document.createElement('div');101 generalSection.appendChild(performanceDisplay);102 var pdCheckbox = document.createElement('input');103 pdCheckbox.type = 'checkbox';104 pdCheckbox.setAttribute('data-bind', 'checked: performance');105 performanceDisplay.appendChild(pdCheckbox);106 performanceDisplay.appendChild(document.createTextNode('Performance Display'));107108 performanceContainer.className = 'cesium-cesiumInspector-performanceDisplay';109 generalSection.appendChild(performanceContainer);110111 var shaderCacheDisplay = document.createElement('div');112 shaderCacheDisplay.className = 'cesium-cesiumInspector-shaderCache';113 shaderCacheDisplay.setAttribute('data-bind', 'html: shaderCacheText');114 generalSection.appendChild(shaderCacheDisplay);115116 var globeDepth = document.createElement('div');117 generalSection.appendChild(globeDepth);118 var gCheckbox = document.createElement('input');119 gCheckbox.type = 'checkbox';120 gCheckbox.setAttribute('data-bind', 'checked: globeDepth');121 globeDepth.appendChild(gCheckbox);122 globeDepth.appendChild(document.createTextNode('Show globe depth'));123124 var globeDepthFrustum = document.createElement('div');125 globeDepth.appendChild(globeDepthFrustum);126127 var pickDepth = document.createElement('div');128 generalSection.appendChild(pickDepth);129 var pCheckbox = document.createElement('input');130 pCheckbox.type = 'checkbox';131 pCheckbox.setAttribute('data-bind', 'checked: pickDepth');132 pickDepth.appendChild(pCheckbox);133 pickDepth.appendChild(document.createTextNode('Show pick depth'));134135 var depthFrustum = document.createElement('div');136 generalSection.appendChild(depthFrustum);137138 // Use a span with HTML binding so that we can indent with non-breaking spaces.139 var gLabel = document.createElement('span');140 gLabel.setAttribute('data-bind', 'html: " Frustum:"');141 depthFrustum.appendChild(gLabel);142143 var gText = document.createElement('span');144 gText.setAttribute('data-bind', 'text: depthFrustumText');145 depthFrustum.appendChild(gText);146147 var gMinusButton = document.createElement('input');148 gMinusButton.type = 'button';149 gMinusButton.value = '-';150 gMinusButton.className = 'cesium-cesiumInspector-pickButton';151 gMinusButton.setAttribute('data-bind', 'click: decrementDepthFrustum');152 depthFrustum.appendChild(gMinusButton);153154 var gPlusButton = document.createElement('input');155 gPlusButton.type = 'button';156 gPlusButton.value = '+';157 gPlusButton.className = 'cesium-cesiumInspector-pickButton';158 gPlusButton.setAttribute('data-bind', 'click: incrementDepthFrustum');159 depthFrustum.appendChild(gPlusButton);160161 // Primitives162 var prim = document.createElement('div');163 prim.className = 'cesium-cesiumInspector-sectionHeader';164 plus = document.createElement('span');165 plus.className = 'cesium-cesiumInspector-toggleSwitch';166 plus.setAttribute('data-bind', 'click: togglePrimitives, text: primitivesSwitchText');167 prim.appendChild(plus);168 prim.appendChild(document.createTextNode('Primitives'));169 panel.appendChild(prim);170171 var primitivesSection = document.createElement('div');172 primitivesSection.className = 'cesium-cesiumInspector-section';173 primitivesSection.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : primitivesVisible, "cesium-cesiumInspector-hide" : !primitivesVisible}');174 panel.appendChild(primitivesSection);175 var pickPrimRequired = document.createElement('div');176 pickPrimRequired.className = 'cesium-cesiumInspector-pickSection';177 primitivesSection.appendChild(pickPrimRequired);178179 var pickPrimitiveButton = document.createElement('input');180 pickPrimitiveButton.type = 'button';181 pickPrimitiveButton.value = 'Pick a primitive';182 pickPrimitiveButton.className = 'cesium-cesiumInspector-pickButton';183 pickPrimitiveButton.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickPrimitiveActive}, click: pickPrimitive');184 var buttonWrap = document.createElement('div');185 buttonWrap.className = 'cesium-cesiumInspector-center';186 buttonWrap.appendChild(pickPrimitiveButton);187 pickPrimRequired.appendChild(buttonWrap);188189 var debugSphere = document.createElement('div');190 pickPrimRequired.appendChild(debugSphere);191 var bsCheckbox = document.createElement('input');192 bsCheckbox.type = 'checkbox';193 bsCheckbox.setAttribute('data-bind', 'checked: primitiveBoundingSphere, enable: hasPickedPrimitive');194 debugSphere.appendChild(bsCheckbox);195 debugSphere.appendChild(document.createTextNode('Show bounding sphere'));196197 var refFrame = document.createElement('div');198 pickPrimRequired.appendChild(refFrame);199 var rfCheckbox = document.createElement('input');200 rfCheckbox.type = 'checkbox';201 rfCheckbox.setAttribute('data-bind', 'checked: primitiveReferenceFrame, enable: hasPickedPrimitive');202 refFrame.appendChild(rfCheckbox);203 refFrame.appendChild(document.createTextNode('Show reference frame'));204205 var primitiveOnly = document.createElement('div');206 this._primitiveOnly = primitiveOnly;207 pickPrimRequired.appendChild(primitiveOnly);208 var primitiveOnlyCheckbox = document.createElement('input');209 primitiveOnlyCheckbox.type = 'checkbox';210 primitiveOnlyCheckbox.setAttribute('data-bind', 'checked: filterPrimitive, enable: hasPickedPrimitive');211 primitiveOnly.appendChild(primitiveOnlyCheckbox);212 primitiveOnly.appendChild(document.createTextNode('Show only selected'));213214 // Terrain215 var terrain = document.createElement('div');216 terrain.className = 'cesium-cesiumInspector-sectionHeader';217 plus = document.createElement('span');218 plus.className = 'cesium-cesiumInspector-toggleSwitch';219 plus.setAttribute('data-bind', 'click: toggleTerrain, text: terrainSwitchText');220 terrain.appendChild(plus);221 terrain.appendChild(document.createTextNode('Terrain'));222 panel.appendChild(terrain);223224 var terrainSection = document.createElement('div');225 terrainSection.className = 'cesium-cesiumInspector-section';226 terrainSection.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : terrainVisible, "cesium-cesiumInspector-hide" : !terrainVisible}');227 panel.appendChild(terrainSection);228 var pickTileRequired = document.createElement('div');229 pickTileRequired.className = 'cesium-cesiumInspector-pickSection';230 terrainSection.appendChild(pickTileRequired);231 var pickTileButton = document.createElement('input');232 pickTileButton.type = 'button';233 pickTileButton.value = 'Pick a tile';234 pickTileButton.className = 'cesium-cesiumInspector-pickButton';235 pickTileButton.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickTileActive}, click: pickTile');236 buttonWrap = document.createElement('div');237 buttonWrap.appendChild(pickTileButton);238 buttonWrap.className = 'cesium-cesiumInspector-center';239 pickTileRequired.appendChild(buttonWrap);240 var tileInfo = document.createElement('div');241 pickTileRequired.appendChild(tileInfo);242 var parentTile = document.createElement('input');243 parentTile.type = 'button';244 parentTile.value = 'Parent';245 parentTile.className = 'cesium-cesiumInspector-pickButton';246 parentTile.setAttribute('data-bind', 'click: selectParent');247 var nwTile = document.createElement('input');248 nwTile.type = 'button';249 nwTile.value = 'NW';250 nwTile.className = 'cesium-cesiumInspector-pickButton';251 nwTile.setAttribute('data-bind', 'click: selectNW');252 var neTile = document.createElement('input');253 neTile.type = 'button';254 neTile.value = 'NE';255 neTile.className = 'cesium-cesiumInspector-pickButton';256 neTile.setAttribute('data-bind', 'click: selectNE');257 var swTile = document.createElement('input');258 swTile.type = 'button';259 swTile.value = 'SW';260 swTile.className = 'cesium-cesiumInspector-pickButton';261 swTile.setAttribute('data-bind', 'click: selectSW');262 var seTile = document.createElement('input');263 seTile.type = 'button';264 seTile.value = 'SE';265 seTile.className = 'cesium-cesiumInspector-pickButton';266 seTile.setAttribute('data-bind', 'click: selectSE');267268 var tileText = document.createElement('div');269 tileText.className = 'cesium-cesiumInspector-tileText';270 tileInfo.className = 'cesium-cesiumInspector-frustumStatistics';271 tileInfo.appendChild(tileText);272 tileInfo.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : hasPickedTile, "cesium-cesiumInspector-hide" : !hasPickedTile}');273 tileText.setAttribute('data-bind', 'html: tileText');274275 var relativeText = document.createElement('div');276 relativeText.className = 'cesium-cesiumInspector-relativeText';277 relativeText.textContent = 'Select relative:';278 tileInfo.appendChild(relativeText);279280 var table = document.createElement('table');281 var tr1 = document.createElement('tr');282 var tr2 = document.createElement('tr');283 var td1 = document.createElement('td');284 td1.appendChild(parentTile);285 var td2 = document.createElement('td');286 td2.appendChild(nwTile);287 var td3 = document.createElement('td');288 td3.appendChild(neTile);289 tr1.appendChild(td1);290 tr1.appendChild(td2);291 tr1.appendChild(td3);292 var td4 = document.createElement('td');293 var td5 = document.createElement('td');294 td5.appendChild(swTile);295 var td6 = document.createElement('td');296 td6.appendChild(seTile);297 tr2.appendChild(td4);298 tr2.appendChild(td5);299 tr2.appendChild(td6);300 table.appendChild(tr1);301 table.appendChild(tr2);302303 tileInfo.appendChild(table);304305 var tileBoundingSphere = document.createElement('div');306 pickTileRequired.appendChild(tileBoundingSphere);307 var tbsCheck = document.createElement('input');308 tbsCheck.type = 'checkbox';309 tbsCheck.setAttribute('data-bind', 'checked: tileBoundingSphere, enable: hasPickedTile');310 tileBoundingSphere.appendChild(tbsCheck);311 tileBoundingSphere.appendChild(document.createTextNode('Show bounding volume'));312313 var renderTile = document.createElement('div');314 pickTileRequired.appendChild(renderTile);315 var rCheck = document.createElement('input');316 rCheck.type = 'checkbox';317 rCheck.setAttribute('data-bind', 'checked: filterTile, enable: hasPickedTile');318 renderTile.appendChild(rCheck);319 renderTile.appendChild(document.createTextNode('Show only selected'));320321 var wireframe = document.createElement('div');322 terrainSection.appendChild(wireframe);323 var wCheckbox = document.createElement('input');324 wCheckbox.type = 'checkbox';325 wCheckbox.setAttribute('data-bind', 'checked: wireframe');326 wireframe.appendChild(wCheckbox);327 wireframe.appendChild(document.createTextNode('Wireframe'));328329 var suspendUpdates = document.createElement('div');330 terrainSection.appendChild(suspendUpdates);331 var upCheckbox = document.createElement('input');332 upCheckbox.type = 'checkbox';333 upCheckbox.setAttribute('data-bind', 'checked: suspendUpdates');334 suspendUpdates.appendChild(upCheckbox);335 suspendUpdates.appendChild(document.createTextNode('Suspend LOD update'));336337 var tileCoords = document.createElement('div');338 terrainSection.appendChild(tileCoords);339 var coordCheck = document.createElement('input');340 coordCheck.type = 'checkbox';341 coordCheck.setAttribute('data-bind', 'checked: tileCoordinates');342 tileCoords.appendChild(coordCheck);343 tileCoords.appendChild(document.createTextNode('Show tile coordinates'));344345 knockout.applyBindings(viewModel, this._element);346 }347348 defineProperties(CesiumInspector.prototype, {349 /**350 * Gets the parent container.351 * @memberof CesiumInspector.prototype352 *353 * @type {Element}354 */355 container : {356 get : function() {357 return this._container;
...
Cesium3DTilesInspector.js
Source:Cesium3DTilesInspector.js
...46 var text = document.createElement('div');47 text.textContent = '3D Tiles Inspector';48 text.className = 'cesium-cesiumInspector-button';49 text.setAttribute('data-bind', 'click: toggleInspector');50 element.appendChild(text);51 element.className = 'cesium-cesiumInspector cesium-3DTilesInspector';52 element.setAttribute('data-bind', 'css: { "cesium-cesiumInspector-visible" : inspectorVisible, "cesium-cesiumInspector-hidden" : !inspectorVisible}');53 container.appendChild(element);5455 var tilesetPanelContents = document.createElement('div');56 var displayPanelContents = document.createElement('div');57 var updatePanelContents = document.createElement('div');58 var loggingPanelContents = document.createElement('div');59 var tileDebugLabelsPanelContents = document.createElement('div');60 var stylePanelContents = document.createElement('div');61 var optimizationPanelContents = document.createElement('div');6263 var properties = document.createElement('div');64 properties.className = 'field-group';65 var propertiesLabel = document.createElement('label');66 propertiesLabel.className = 'field-label';67 propertiesLabel.appendChild(document.createTextNode('Properties: '));68 var propertiesField = document.createElement('div');69 propertiesField.setAttribute('data-bind', 'text: properties');70 properties.appendChild(propertiesLabel);71 properties.appendChild(propertiesField);72 tilesetPanelContents.appendChild(properties);73 tilesetPanelContents.appendChild(makeButton('togglePickTileset', 'Pick Tileset', 'pickActive'));74 tilesetPanelContents.appendChild(makeButton('trimTilesCache', 'Trim Tiles Cache'));75 tilesetPanelContents.appendChild(makeCheckbox('picking', 'Enable Picking'));7677 displayPanelContents.appendChild(makeCheckbox('colorize', 'Colorize'));78 displayPanelContents.appendChild(makeCheckbox('wireframe', 'Wireframe'));79 displayPanelContents.appendChild(makeCheckbox('showBoundingVolumes', 'Bounding Volumes'));80 displayPanelContents.appendChild(makeCheckbox('showContentBoundingVolumes', 'Content Volumes'));81 displayPanelContents.appendChild(makeCheckbox('showRequestVolumes', 'Request Volumes'));8283 updatePanelContents.appendChild(makeCheckbox('freezeFrame', 'Freeze Frame'));84 updatePanelContents.appendChild(makeCheckbox('dynamicScreenSpaceError', 'Dynamic Screen Space Error'));85 var sseContainer = document.createElement('div');86 sseContainer.appendChild(makeRangeInput('maximumScreenSpaceError', 0, 128, 1, 'Maximum Screen Space Error'));87 updatePanelContents.appendChild(sseContainer);88 var dynamicScreenSpaceErrorContainer = document.createElement('div');89 dynamicScreenSpaceErrorContainer.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : dynamicScreenSpaceError, "cesium-cesiumInspector-hide" : !dynamicScreenSpaceError}');90 dynamicScreenSpaceErrorContainer.appendChild(makeRangeInput('dynamicScreenSpaceErrorDensitySliderValue', 0, 1, 0.005, 'Screen Space Error Density', 'dynamicScreenSpaceErrorDensity'));91 dynamicScreenSpaceErrorContainer.appendChild(makeRangeInput('dynamicScreenSpaceErrorFactor', 1, 10, 0.1, 'Screen Space Error Factor'));92 updatePanelContents.appendChild(dynamicScreenSpaceErrorContainer);9394 loggingPanelContents.appendChild(makeCheckbox('performance', 'Performance'));95 loggingPanelContents.appendChild(performanceContainer);96 loggingPanelContents.appendChild(makeCheckbox('showStatistics', 'Statistics'));97 var statistics = document.createElement('div');98 statistics.className = 'cesium-3dTilesInspector-statistics';99 statistics.setAttribute('data-bind', 'html: statisticsText, visible: showStatistics');100 loggingPanelContents.appendChild(statistics);101 loggingPanelContents.appendChild(makeCheckbox('showPickStatistics', 'Pick Statistics'));102 var pickStatistics = document.createElement('div');103 pickStatistics.className = 'cesium-3dTilesInspector-statistics';104 pickStatistics.setAttribute('data-bind', 'html: pickStatisticsText, visible: showPickStatistics');105 loggingPanelContents.appendChild(pickStatistics);106107 stylePanelContents.appendChild(document.createTextNode('Color Blend Mode: '));108 var blendDropdown = document.createElement('select');109 blendDropdown.setAttribute('data-bind', 'options: colorBlendModes, ' +110 'optionsText: "text", ' +111 'optionsValue: "value", ' +112 'value: colorBlendMode');113 stylePanelContents.appendChild(blendDropdown);114 var styleEditor = document.createElement('textarea');115 styleEditor.setAttribute('data-bind', 'textInput: styleString, event: { keydown: styleEditorKeyPress }');116 stylePanelContents.className = 'cesium-cesiumInspector-styleEditor';117 stylePanelContents.appendChild(styleEditor);118 var closeStylesBtn = makeButton('compileStyle', 'Compile (Ctrl+Enter)');119 stylePanelContents.appendChild(closeStylesBtn);120 var errorBox = document.createElement('div');121 errorBox.className = 'cesium-cesiumInspector-error';122 errorBox.setAttribute('data-bind', 'text: editorError');123 stylePanelContents.appendChild(errorBox);124125 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showOnlyPickedTileDebugLabel', 'Show Picked Only'));126 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error'));127 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showRenderingStatistics', 'Rendering Statistics'));128 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showMemoryUsage', 'Memory Usage (MB)'));129 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showUrl', 'Url'));130131 optimizationPanelContents.appendChild(makeCheckbox('skipLevelOfDetail', 'Skip Tile LODs'));132 var skipScreenSpaceErrorFactorContainer = document.createElement('div');133 skipScreenSpaceErrorFactorContainer.appendChild(makeRangeInput('skipScreenSpaceErrorFactor', 1, 50, 1, 'Skip SSE Factor'));134 optimizationPanelContents.appendChild(skipScreenSpaceErrorFactorContainer);135 var baseScreenSpaceError = document.createElement('div');136 baseScreenSpaceError.appendChild(makeRangeInput('baseScreenSpaceError', 0, 4096, 1, 'SSE before skipping LOD'));137 optimizationPanelContents.appendChild(baseScreenSpaceError);138 var skipLevelsContainer = document.createElement('div');139 skipLevelsContainer.appendChild(makeRangeInput('skipLevels', 0, 10, 1, 'Min. levels to skip'));140 optimizationPanelContents.appendChild(skipLevelsContainer);141 optimizationPanelContents.appendChild(makeCheckbox('immediatelyLoadDesiredLevelOfDetail', 'Load only tiles that meet the max. SSE.'));142 optimizationPanelContents.appendChild(makeCheckbox('loadSiblings', 'Load siblings of visible tiles.'));143144 var tilesetPanel = makeSection('Tileset', 'tilesetVisible', 'toggleTileset', tilesetPanelContents);145 var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents);146 var updatePanel = makeSection('Update', 'updateVisible', 'toggleUpdate', updatePanelContents);147 var loggingPanel = makeSection('Logging', 'loggingVisible', 'toggleLogging', loggingPanelContents);148 var tileDebugLabelsPanel = makeSection('Tile Debug Labels', 'tileDebugLabelsVisible', 'toggleTileDebugLabels', tileDebugLabelsPanelContents);149 var stylePanel = makeSection('Style', 'styleVisible', 'toggleStyle', stylePanelContents);150 var optimizationPanel = makeSection('Optimization', 'optimizationVisible', 'toggleOptimization', optimizationPanelContents);151152 // first add and bind all the toggleable panels153 element.appendChild(tilesetPanel);154 element.appendChild(displayPanel);155 element.appendChild(updatePanel);156 element.appendChild(loggingPanel);157 element.appendChild(tileDebugLabelsPanel);158 element.appendChild(stylePanel);159 element.appendChild(optimizationPanel);160161 knockout.applyBindings(viewModel, element);162 }163164 defineProperties(Cesium3DTilesInspector.prototype, {165 /**166 * Gets the parent container.167 * @memberof Cesium3DTilesInspector.prototype168 *169 * @type {Element}170 */171 container : {172 get : function() {173 return this._container;174 }175 },176177 /**178 * Gets the view model.179 * @memberof Cesium3DTilesInspector.prototype180 *181 * @type {Cesium3DTilesInspectorViewModel}182 */183 viewModel : {184 get : function() {185 return this._viewModel;186 }187 }188 });189190 /**191 * @returns {Boolean} true if the object has been destroyed, false otherwise.192 */193 Cesium3DTilesInspector.prototype.isDestroyed = function() {194 return false;195 };196197 /**198 * Destroys the widget. Should be called if permanently199 * removing the widget from layout.200 */201 Cesium3DTilesInspector.prototype.destroy = function() {202 knockout.cleanNode(this._element);203 this._container.removeChild(this._element);204 this.viewModel.destroy();205206 return destroyObject(this);207 };208209 function makeSection(name, visibleProp, toggleProp, contents) {210 var toggle = document.createElement('span');211 toggle.className = 'cesium-cesiumInspector-toggleSwitch';212 toggle.setAttribute('data-bind', 'text: ' + visibleProp + ' ? "-" : "+", click: ' + toggleProp);213214 var header = document.createElement('div');215 header.className = 'cesium-cesiumInspector-sectionHeader';216 header.appendChild(toggle);217 header.appendChild(document.createTextNode(name));218219 var section = document.createElement('div');220 section.className = 'cesium-cesiumInspector-section';221 section.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : ' + visibleProp + ', "cesium-cesiumInspector-hide" : !' + visibleProp + '}');222 section.appendChild(contents);223224 var panel = document.createElement('div');225 panel.className = 'cesium-cesiumInspector-dropDown';226 panel.appendChild(header);227 panel.appendChild(section);228229 return panel;230 }231232 function makeCheckbox(property, text) {233 var checkbox = document.createElement('input');234 checkbox.type = 'checkbox';235 checkbox.setAttribute('data-bind', 'checked: ' + property);236237 var container = document.createElement('div');238 container.appendChild(checkbox);239 container.appendChild(document.createTextNode(text));240241 return container;242 }243244 function makeRangeInput(property, min, max, step, text, displayProperty) {245 displayProperty = defaultValue(displayProperty, property);246 var input = document.createElement('input');247 input.setAttribute('data-bind', 'value: ' + displayProperty);248 input.type = 'number';249250 var slider = document.createElement('input');251 slider.type = 'range';252 slider.min = min;253 slider.max = max;254 slider.step = step;255 slider.setAttribute('data-bind', 'valueUpdate: "input", value: ' + property);256257 var wrapper = document.createElement('div');258 wrapper.appendChild(slider);259260 var container = document.createElement('div');261 container.className = 'cesium-cesiumInspector-slider';262 container.appendChild(document.createTextNode(text));263 container.appendChild(input);264 container.appendChild(wrapper);265266 return container;267 }268269 function makeButton(action, text, active) {270 var button = document.createElement('button');271 button.type = 'button';272 button.textContent = text;273 button.className = 'cesium-cesiumInspector-pickButton';274 var binding = 'click: ' + action;275 if (defined(active)) {276 binding += ', css: {"cesium-cesiumInspector-pickButtonHighlight" : ' + active + '}';277 }278 button.setAttribute('data-bind', binding);
...
XMLViewer.js
Source:XMLViewer.js
...30function prepareWebKitXMLViewer(noStyleMessage)31{32 var html = createHTMLElement('html');33 var head = createHTMLElement('head');34 html.appendChild(head);35 var style = createHTMLElement('style');36 style.id = 'xml-viewer-style';37 head.appendChild(style);38 var body = createHTMLElement('body');39 html.appendChild(body);40 var sourceXML = createHTMLElement('div');41 sourceXML.id = 'webkit-xml-viewer-source-xml';42 body.appendChild(sourceXML);43 var child;44 while (child = document.firstChild) {45 document.removeChild(child);46 if (child.nodeType != Node.DOCUMENT_TYPE_NODE)47 sourceXML.appendChild(child);48 }49 document.appendChild(html);50 var header = createHTMLElement('div');51 body.appendChild(header);52 header.classList.add('header');53 var headerSpan = createHTMLElement('span');54 header.appendChild(headerSpan);55 headerSpan.textContent = noStyleMessage;56 header.appendChild(createHTMLElement('br'));57 var tree = createHTMLElement('div');58 body.appendChild(tree);59 tree.classList.add('pretty-print');60 tree.id = 'tree';61 window.onload = sourceXMLLoaded;62}63function sourceXMLLoaded()64{65 var sourceXML = document.getElementById('webkit-xml-viewer-source-xml');66 if (!sourceXML)67 return; // Stop if some XML tree extension is already processing this document68 //var style = document.head.firstChild;69 //document.head.removeChild(style);70 //document.head.appendChild(style);71 var root = document.getElementById('tree');72 for (var child = sourceXML.firstChild; child; child = child.nextSibling)73 nodeParentPairs.push({parentElement: root, node: child});74 for (var i = 0; i < nodeParentPairs.length; i++)75 processNode(nodeParentPairs[i].parentElement, nodeParentPairs[i].node);76 drawArrows();77 initButtons();78 if (typeof(onAfterWebkitXMLViewerLoaded) == 'function')79 onAfterWebkitXMLViewerLoaded();80}81// Tree processing.82function processNode(parentElement, node)83{84 if (!processNode.processorsMap) {85 processNode.processorsMap = {};86 processNode.processorsMap[Node.PROCESSING_INSTRUCTION_NODE] = processProcessingInstruction;87 processNode.processorsMap[Node.ELEMENT_NODE] = processElement;88 processNode.processorsMap[Node.COMMENT_NODE] = processComment;89 processNode.processorsMap[Node.TEXT_NODE] = processText;90 processNode.processorsMap[Node.CDATA_SECTION_NODE] = processCDATA;91 }92 if (processNode.processorsMap[node.nodeType])93 processNode.processorsMap[node.nodeType].call(this, parentElement, node);94}95function processElement(parentElement, node)96{97 if (!node.firstChild)98 processEmptyElement(parentElement, node);99 else {100 var child = node.firstChild;101 if (child.nodeType == Node.TEXT_NODE && isShort(child.nodeValue) && !child.nextSibling)102 processShortTextOnlyElement(parentElement, node);103 else104 processComplexElement(parentElement, node);105 }106}107function processEmptyElement(parentElement, node)108{109 var line = createLine();110 line.appendChild(createTag(node, false, true));111 parentElement.appendChild(line);112}113function processShortTextOnlyElement(parentElement, node)114{115 var line = createLine();116 line.appendChild(createTag(node, false, false));117 for (var child = node.firstChild; child; child = child.nextSibling)118 line.appendChild(createText(child.nodeValue));119 line.appendChild(createTag(node, true, false));120 parentElement.appendChild(line);121}122function processComplexElement(parentElement, node)123{124 var collapsible = createCollapsible();125 collapsible.expanded.start.appendChild(createTag(node, false, false));126 for (var child = node.firstChild; child; child = child.nextSibling)127 nodeParentPairs.push({parentElement: collapsible.expanded.content, node: child});128 collapsible.expanded.end.appendChild(createTag(node, true, false));129 collapsible.collapsed.content.appendChild(createTag(node, false, false));130 collapsible.collapsed.content.appendChild(createText('...'));131 collapsible.collapsed.content.appendChild(createTag(node, true, false));132 parentElement.appendChild(collapsible);133}134function processComment(parentElement, node)135{136 if (isShort(node.nodeValue)) {137 var line = createLine();138 line.appendChild(createComment('<!-- ' + node.nodeValue + ' -->'));139 parentElement.appendChild(line);140 } else {141 var collapsible = createCollapsible();142 collapsible.expanded.start.appendChild(createComment('<!--'));143 collapsible.expanded.content.appendChild(createComment(node.nodeValue));144 collapsible.expanded.end.appendChild(createComment('-->'));145 collapsible.collapsed.content.appendChild(createComment('<!--'));146 collapsible.collapsed.content.appendChild(createComment('...'));147 collapsible.collapsed.content.appendChild(createComment('-->'));148 parentElement.appendChild(collapsible);149 }150}151function processCDATA(parentElement, node)152{153 if (isShort(node.nodeValue)) {154 var line = createLine();155 line.appendChild(createText('<![CDATA[ ' + node.nodeValue + ' ]]>'));156 parentElement.appendChild(line);157 } else {158 var collapsible = createCollapsible();159 collapsible.expanded.start.appendChild(createText('<![CDATA['));160 collapsible.expanded.content.appendChild(createText(node.nodeValue));161 collapsible.expanded.end.appendChild(createText(']]>'));162 collapsible.collapsed.content.appendChild(createText('<![CDATA['));163 collapsible.collapsed.content.appendChild(createText('...'));164 collapsible.collapsed.content.appendChild(createText(']]>'));165 parentElement.appendChild(collapsible);166 }167}168function processProcessingInstruction(parentElement, node)169{170 if (isShort(node.nodeValue)) {171 var line = createLine();172 line.appendChild(createComment('<?' + node.nodeName + ' ' + node.nodeValue + '?>'));173 parentElement.appendChild(line);174 } else {175 var collapsible = createCollapsible();176 collapsible.expanded.start.appendChild(createComment('<?' + node.nodeName));177 collapsible.expanded.content.appendChild(createComment(node.nodeValue));178 collapsible.expanded.end.appendChild(createComment('?>'));179 collapsible.collapsed.content.appendChild(createComment('<?' + node.nodeName));180 collapsible.collapsed.content.appendChild(createComment('...'));181 collapsible.collapsed.content.appendChild(createComment('?>'));182 parentElement.appendChild(collapsible);183 }184}185function processText(parentElement, node)186{187 parentElement.appendChild(createText(node.nodeValue));188}189// Processing utils.190function trim(value)191{192 return value.replace(/^\s\s*/, '').replace(/\s\s*$/, '');193}194function isShort(value)195{196 return trim(value).length <= 50;197}198// Tree rendering.199function createHTMLElement(elementName)200{201 return document.createElementNS('http://www.w3.org/1999/xhtml', elementName)202}203function createCollapsible()204{205 var collapsible = createHTMLElement('div');206 collapsible.classList.add('collapsible');207 collapsible.expanded = createHTMLElement('div');208 collapsible.expanded.classList.add('expanded');209 collapsible.appendChild(collapsible.expanded);210 collapsible.expanded.start = createLine();211 collapsible.expanded.start.appendChild(createCollapseButton());212 collapsible.expanded.appendChild(collapsible.expanded.start);213 collapsible.expanded.content = createHTMLElement('div');214 collapsible.expanded.content.classList.add('collapsible-content');215 collapsible.expanded.appendChild(collapsible.expanded.content);216 collapsible.expanded.end = createLine();217 collapsible.expanded.appendChild(collapsible.expanded.end);218 collapsible.collapsed = createHTMLElement('div');219 collapsible.collapsed.classList.add('collapsed');220 collapsible.collapsed.classList.add('hidden');221 collapsible.appendChild(collapsible.collapsed);222 collapsible.collapsed.content = createLine();223 collapsible.collapsed.content.appendChild(createExpandButton());224 collapsible.collapsed.appendChild(collapsible.collapsed.content);225 return collapsible;226}227function createButton()228{229 var button = createHTMLElement('span');230 button.classList.add('button');231 return button;232}233function createCollapseButton(str)234{235 var button = createButton();236 button.classList.add('collapse-button');237 return button;238}239function createExpandButton(str)240{241 var button = createButton();242 button.classList.add('expand-button');243 return button;244}245function createComment(commentString)246{247 var comment = createHTMLElement('span');248 comment.classList.add('webkit-html-comment');249 comment.textContent = commentString;250 return comment;251}252function createText(value)253{254 var text = createHTMLElement('span');255 text.textContent = trim(value);256 text.classList.add('text');257 return text;258}259function createLine()260{261 var line = createHTMLElement('div');262 line.classList.add('line');263 return line;264}265function createTag(node, isClosing, isEmpty)266{267 var tag = createHTMLElement('span');268 tag.classList.add('webkit-html-tag');269 var stringBeforeAttrs = '<';270 if (isClosing)271 stringBeforeAttrs += '/';272 stringBeforeAttrs += node.nodeName;273 var textBeforeAttrs = document.createTextNode(stringBeforeAttrs);274 tag.appendChild(textBeforeAttrs);275 if (!isClosing) {276 for (var i = 0; i < node.attributes.length; i++)277 tag.appendChild(createAttribute(node.attributes[i]));278 }279 var stringAfterAttrs = '';280 if (isEmpty)281 stringAfterAttrs += '/';282 stringAfterAttrs += '>';283 var textAfterAttrs = document.createTextNode(stringAfterAttrs);284 tag.appendChild(textAfterAttrs);285 return tag;286}287function createAttribute(attributeNode)288{289 var attribute = createHTMLElement('span');290 attribute.classList.add('webkit-html-attribute');291 var attributeName = createHTMLElement('span');292 attributeName.classList.add('webkit-html-attribute-name');293 attributeName.textContent = attributeNode.name;294 var textBefore = document.createTextNode(' ');295 var textBetween = document.createTextNode('="');296 var attributeValue = createHTMLElement('span');297 attributeValue.classList.add('webkit-html-attribute-value');298 attributeValue.textContent = attributeNode.value;299 var textAfter = document.createTextNode('"');300 attribute.appendChild(textBefore);301 attribute.appendChild(attributeName);302 attribute.appendChild(textBetween);303 attribute.appendChild(attributeValue);304 attribute.appendChild(textAfter);305 return attribute;306}307// Tree behaviour.308function drawArrows()309{310 var ctx = document.getCSSCanvasContext("2d", "arrowRight", 10, 11);311 ctx.fillStyle = "rgb(90,90,90)";312 ctx.beginPath();313 ctx.moveTo(0, 0);314 ctx.lineTo(0, 8);315 ctx.lineTo(7, 4);316 ctx.lineTo(0, 0);317 ctx.fill();318 ctx.closePath();...
createTables.js
Source:createTables.js
...50 td2 = document.createElement('td');51 td2.setAttribute('id',prefix+'td'+(((count-1)*2+2)));52 td2.style.verticalAlign="top"; 53 54 td.appendChild(chartDiv); 55 if(tdFlag)tr.appendChild(td);56 57 tr.appendChild(td2);58 }else {59 td.appendChild(chartDiv); 60 if(tdFlag)tr.appendChild(td);61 }62 }else if(number%2 == 0){ 63 if(td == null || "undefined" == typeof(td)){64 td = document.createElement("td");65 td.setAttribute('id',prefix+'td'+number);66 td.style.verticalAlign="top";67 tdFlag = true;68 69 td2 = document.createElement('td');70 td2.setAttribute('id',prefix+'td'+(((count-1)*2+1)));71 td2.style.verticalAlign="top"; 72 73 tr.appendChild(td2);74 75 td.appendChild(chartDiv); 76 if(tdFlag)tr.appendChild(td);77 }else {78 td.appendChild(chartDiv); 79 if(tdFlag)tr.appendChild(td);80 }81 } 82 } else {83 if(number%2 == 1){ 84 if(td == null || "undefined" == typeof(td)){85 td = document.createElement("td");86 td.setAttribute('id',prefix+'td'+number);87 td.style.verticalAlign="top";88 tdFlag = true; 89 90 td2 = document.createElement('td');91 td2.setAttribute('id',prefix+'td'+(((count-1)*2+2)));92 td2.style.verticalAlign="top"; 93 94 td.appendChild(chartDiv); 95 if(tdFlag)tr.appendChild(td);96 97 tr.appendChild(td2);98 }else {99 td.appendChild(chartDiv); 100 if(tdFlag)tr.appendChild(td);101 }102 }else if(number%2 == 0){ 103 if(td == null || "undefined" == typeof(td)){104 td = document.createElement("td");105 td.setAttribute('id',prefix+'td'+number);106 td.style.verticalAlign="top";107 tdFlag = true;108 109 td2 = document.createElement('td');110 td2.setAttribute('id',prefix+'td'+(((count-1)*2+1)));111 td2.style.verticalAlign="top";112 113 tr.appendChild(td2); 114 td.appendChild(chartDiv); 115 if(tdFlag)tr.appendChild(td);116 }else {117 td.appendChild(chartDiv); 118 if(tdFlag)tr.appendChild(td);119 }120 } 121 }122 123 124 if(trFlag)tbody.appendChild(tr);125 if(tbdFlag)table.appendChild(tbody);126 if(tabFlag)center.appendChild(table);127 if(cetFlag)parent.appendChild(center); 128 }129 130 function hostTables(chartDiv,number,parent){131 132 var cetFlag = false ,tabFlag = false , tbdFlag = false , trFlag = false ,tdFlag = false ;133 var count = number%4>0 ? Math.floor(number/4 +1) : number/4; 134 var center = null, table = null ,tbody = null, tr = null , td = null ;135 136 center = document.getElementById("center1");137 if(center == null || "undefined" == typeof(center)){138 center = document.createElement("center");139 center.setAttribute('id','center1');140 cetFlag = true;141 }142 143 table = document.getElementById("graph_metric");144 if(table == null || "undefined" == typeof(table)){145 table = document.createElement("table");146 table.setAttribute('id','graph_metric');147 table.style.tableLayout='fixed';148 table.style.width='96%';149 table.style.border='0';150 table.setAttribute('cellspacing','4'); 151 tabFlag = true;152 } 153 154 tbody = document.getElementById("tbody1");155 if(tbody == null || "undefined" == typeof(tbody)){156 tbody = document.createElement("tbody");157 tbody.setAttribute('id','tbody1');158 tbdFlag = true;159 }160 161 tr = document.getElementById('tr'+count); 162 td = document.getElementById('td'+number); 163 164 var td2 = null ,td3 = null , td3 = null ;165 166 if(tr == null || "undefined" == typeof(tr)){167 tr = document.createElement("tr");168 tr.setAttribute('id','tr'+count);169 trFlag = true;170 171 if(number%4 == 1){ 172 if(td == null || "undefined" == typeof(td)){173 td = document.createElement("td");174 td.setAttribute('id','td'+number);175 td.style.verticalAlign="top";176 tdFlag = true;177 178 td2 = document.createElement('td');179 td2.style.verticalAlign="top";180 td2.setAttribute('id','td'+((count-1)*4+2));181 182 td3 = document.createElement('td');183 td3.style.verticalAlign="top";184 td3.setAttribute('id','td'+(((count-1)*4+3)));185 186 td4 = document.createElement('td');187 td4.style.verticalAlign="top";188 td4.setAttribute('id','td'+(((count-1)*4+4))); 189 190 td.appendChild(chartDiv); 191 if(tdFlag)tr.appendChild(td); 192 193 tr.appendChild(td2);194 tr.appendChild(td3);195 tr.appendChild(td4); 196 }else {197 td.appendChild(chartDiv); 198 if(tdFlag)tr.appendChild(td);199 } 200 }else if(number%4 == 2){ 201 if(td == null || "undefined" == typeof(td)){202 td = document.createElement("td");203 td.setAttribute('id','td'+number);204 td.style.verticalAlign="top";205 tdFlag = true;206 207 td2 = document.createElement('td');208 td2.style.verticalAlign="top";209 td2.setAttribute('id','td'+(((count-1)*4+1)));210 211 td3 = document.createElement('td');212 td3.style.verticalAlign="top";213 td3.setAttribute('id','td'+(((count-1)*4+3)));214 215 td4 = document.createElement('td');216 td4.style.verticalAlign="top";217 td4.setAttribute('id','td'+(((count-1)*4+4)));218 //219 tr.appendChild(td2);220 221 td.appendChild(chartDiv); 222 if(tdFlag)tr.appendChild(td); 223 224 tr.appendChild(td3);225 tr.appendChild(td4);226 }else {227 td.appendChild(chartDiv); 228 if(tdFlag)tr.appendChild(td);229 } 230 }else if(number%4 == 3){ 231 if(td == null || "undefined" == typeof(td)){232 td = document.createElement("td");233 td.setAttribute('id','td'+number);234 td.style.verticalAlign="top";235 tdFlag = true;236 237 td2 = document.createElement('td');238 td2.style.verticalAlign="top";239 td2.setAttribute('id','td'+(((count-1)*4+1)));240 241 td3 = document.createElement('td');242 td3.style.verticalAlign="top";243 td3.setAttribute('id','td'+(((count-1)*4+2)));244 245 td4 = document.createElement('td');246 td4.style.verticalAlign="top";247 td4.setAttribute('id','td'+(((count-1)*4+4))); 248 249 tr.appendChild(td2);250 tr.appendChild(td3);251 252 td.appendChild(chartDiv); 253 if(tdFlag)tr.appendChild(td); 254 255 tr.appendChild(td4); 256 }else {257 td.appendChild(chartDiv); 258 if(tdFlag)tr.appendChild(td);259 } 260 }else if(number%4 == 0){ 261 if(td == null || "undefined" == typeof(td)){262 td = document.createElement("td");263 td.setAttribute('id','td'+number);264 td.style.verticalAlign="top";265 tdFlag = true;266 267 td2 = document.createElement('td');268 td2.style.verticalAlign="top";269 td2.setAttribute('id','td'+(((count-1)*4+1)));270 271 td3 = document.createElement('td');272 td3.style.verticalAlign="top";273 td3.setAttribute('id','td'+(((count-1)*4+2)));274 275 td4 = document.createElement('td');276 td4.style.verticalAlign="top";277 td4.setAttribute('id','td'+(((count-1)*4+3)));278 279 tr.appendChild(td2);280 tr.appendChild(td3);281 tr.appendChild(td4);282 283 td.appendChild(chartDiv); 284 if(tdFlag)tr.appendChild(td); 285 }else {286 td.appendChild(chartDiv); 287 if(tdFlag)tr.appendChild(td);288 }289 } 290 } else {291 if(number%4 == 1){ 292 if(td == null || "undefined" == typeof(td)){293 td = document.createElement("td");294 td.setAttribute('id','td'+number);295 td.style.verticalAlign="top";296 tdFlag = true;297 298 td2 = document.createElement('td');299 td2.style.verticalAlign="top";300 td2.setAttribute('id','td'+(((count-1)*4+2)));301 302 td3 = document.createElement('td');303 td3.style.verticalAlign="top";304 td3.setAttribute('id','td'+(((count-1)*4+3)));305 306 td4 = document.createElement('td');307 td4.style.verticalAlign="top";308 td4.setAttribute('id','td'+(((count-1)*4+4)));309 310 td.appendChild(chartDiv); 311 if(tdFlag)tr.appendChild(td); 312 313 tr.appendChild(td2);314 tr.appendChild(td3);315 tr.appendChild(td4); 316 } else {317 td.appendChild(chartDiv); 318 if(tdFlag)tr.appendChild(td);319 } 320 }else if(number%4 == 2){ 321 if(td == null || "undefined" == typeof(td)){322 td = document.createElement("td");323 td.setAttribute('id','td'+number);324 td.style.verticalAlign="top";325 tdFlag = true;326 327 td2 = document.createElement('td');328 td2.style.verticalAlign="top";329 td2.setAttribute('id','td'+(((count-1)*4+1)));330 331 td3 = document.createElement('td');332 td3.style.verticalAlign="top";333 td3.setAttribute('id','td'+(((count-1)*4+3)));334 335 td4 = document.createElement('td');336 td4.style.verticalAlign="top";337 td4.setAttribute('id','td'+(((count-1)*4+4)));338 339 tr.appendChild(td2);340 341 td.appendChild(chartDiv); 342 if(tdFlag)tr.appendChild(td); 343 344 tr.appendChild(td3);345 tr.appendChild(td4);346 } else {347 td.appendChild(chartDiv); 348 if(tdFlag)tr.appendChild(td);349 } 350 }else if(number%4 == 3){ 351 if(td == null || "undefined" == typeof(td)){352 td = document.createElement("td");353 td.setAttribute('id','td'+number);354 td.style.verticalAlign="top";355 tdFlag = true;356 357 td2 = document.createElement('td');358 td2.style.verticalAlign="top";359 td2.setAttribute('id','td'+(((count-1)*4+1)));360 361 td3 = document.createElement('td');362 td3.style.verticalAlign="top";363 td3.setAttribute('id','td'+(((count-1)*4+2)));364 365 td4 = document.createElement('td');366 td4.style.verticalAlign="top";367 td4.setAttribute('id','td'+(((count-1)*4+4)));368 369 tr.appendChild(td2);370 tr.appendChild(td3);371 372 td.appendChild(chartDiv);373 if(tdFlag)tr.appendChild(td);374 375 tr.appendChild(td4);376 } else {377 td.appendChild(chartDiv); 378 if(tdFlag)tr.appendChild(td); 379 } 380 }else if(number%4 == 0){ 381 if(td == null || "undefined" == typeof(td)){382 td = document.createElement("td");383 td.setAttribute('id','td'+number);384 td.style.verticalAlign="top";385 tdFlag = true;386 387 td2 = document.createElement('td');388 td2.setAttribute('id','td'+(((count-1)*4+1)));389 td2.style.verticalAlign="top";390 391 td3 = document.createElement('td');392 td3.style.verticalAlign="top";393 td3.setAttribute('id','td'+(((count-1)*4+2)));394 395 td4 = document.createElement('td');396 td4.style.verticalAlign="top";397 td4.setAttribute('id','td'+(((count-1)*4+3)));398 399 tr.appendChild(td2);400 tr.appendChild(td3);401 tr.appendChild(td4);402 403 td.appendChild(chartDiv); 404 if(tdFlag)tr.appendChild(td); 405 }else {406 td.appendChild(chartDiv); 407 if(tdFlag)tr.appendChild(td); 408 }409 }410 }411 412 if(trFlag)tbody.appendChild(tr);413 if(tbdFlag)table.appendChild(tbody);414 if(tabFlag)center.appendChild(table);415 if(cetFlag)parent.appendChild(center); 416
...
application.js
Source:application.js
...22 hasRendered: false,23 buildFragment: function buildFragment(dom) {24 var el0 = dom.createDocumentFragment();25 var el1 = dom.createTextNode("Home");26 dom.appendChild(el0, el1);27 return el0;28 },29 buildRenderNodes: function buildRenderNodes() { return []; },30 statements: [31 ],32 locals: [],33 templates: []34 };35 }());36 var child1 = (function() {37 return {38 meta: {39 "revision": "Ember@2.8.3",40 "loc": {41 "source": null,42 "start": {43 "line": 20,44 "column": 1045 },46 "end": {47 "line": 20,48 "column": 3849 }50 },51 "moduleName": "itpfin/templates/application.hbs"52 },53 isEmpty: false,54 arity: 0,55 cachedFragment: null,56 hasRendered: false,57 buildFragment: function buildFragment(dom) {58 var el0 = dom.createDocumentFragment();59 var el1 = dom.createTextNode("Must Eats");60 dom.appendChild(el0, el1);61 return el0;62 },63 buildRenderNodes: function buildRenderNodes() { return []; },64 statements: [65 ],66 locals: [],67 templates: []68 };69 }());70 return {71 meta: {72 "revision": "Ember@2.8.3",73 "loc": {74 "source": null,75 "start": {76 "line": 1,77 "column": 078 },79 "end": {80 "line": 27,81 "column": 082 }83 },84 "moduleName": "itpfin/templates/application.hbs"85 },86 isEmpty: false,87 arity: 0,88 cachedFragment: null,89 hasRendered: false,90 buildFragment: function buildFragment(dom) {91 var el0 = dom.createDocumentFragment();92 var el1 = dom.createElement("nav");93 dom.setAttribute(el1,"class","navbar transparent");94 var el2 = dom.createTextNode("\n ");95 dom.appendChild(el1, el2);96 var el2 = dom.createElement("div");97 dom.setAttribute(el2,"class","container-fluid");98 var el3 = dom.createTextNode("\n ");99 dom.appendChild(el2, el3);100 var el3 = dom.createComment(" Brand and toggle get grouped for better mobile display ");101 dom.appendChild(el2, el3);102 var el3 = dom.createTextNode("\n ");103 dom.appendChild(el2, el3);104 var el3 = dom.createElement("div");105 dom.setAttribute(el3,"class","navbar-header");106 var el4 = dom.createTextNode("\n ");107 dom.appendChild(el3, el4);108 var el4 = dom.createElement("button");109 dom.setAttribute(el4,"type","button");110 dom.setAttribute(el4,"class","navbar-toggle collapsed");111 dom.setAttribute(el4,"data-toggle","collapse");112 dom.setAttribute(el4,"data-target","#bs-example-navbar-collapse-1");113 dom.setAttribute(el4,"aria-expanded","false");114 var el5 = dom.createTextNode("\n ");115 dom.appendChild(el4, el5);116 var el5 = dom.createElement("span");117 dom.setAttribute(el5,"class","sr-only");118 var el6 = dom.createTextNode("Toggle navigation");119 dom.appendChild(el5, el6);120 dom.appendChild(el4, el5);121 var el5 = dom.createTextNode("\n ");122 dom.appendChild(el4, el5);123 var el5 = dom.createElement("span");124 dom.setAttribute(el5,"class","icon-bar");125 dom.appendChild(el4, el5);126 var el5 = dom.createTextNode("\n ");127 dom.appendChild(el4, el5);128 var el5 = dom.createElement("span");129 dom.setAttribute(el5,"class","icon-bar");130 dom.appendChild(el4, el5);131 var el5 = dom.createTextNode("\n ");132 dom.appendChild(el4, el5);133 var el5 = dom.createElement("span");134 dom.setAttribute(el5,"class","icon-bar");135 dom.appendChild(el4, el5);136 var el5 = dom.createTextNode("\n ");137 dom.appendChild(el4, el5);138 dom.appendChild(el3, el4);139 var el4 = dom.createTextNode("\n ");140 dom.appendChild(el3, el4);141 dom.appendChild(el2, el3);142 var el3 = dom.createTextNode("\n\n ");143 dom.appendChild(el2, el3);144 var el3 = dom.createComment(" Collect the nav links, forms, and other content for toggling ");145 dom.appendChild(el2, el3);146 var el3 = dom.createTextNode("\n ");147 dom.appendChild(el2, el3);148 var el3 = dom.createElement("div");149 dom.setAttribute(el3,"class","collapse navbar-collapse");150 dom.setAttribute(el3,"id","bs-example-navbar-collapse-1");151 var el4 = dom.createTextNode("\n ");152 dom.appendChild(el3, el4);153 var el4 = dom.createElement("ul");154 dom.setAttribute(el4,"class","nav navbar-nav navbar-right");155 var el5 = dom.createTextNode("\n ");156 dom.appendChild(el4, el5);157 var el5 = dom.createElement("li");158 var el6 = dom.createTextNode("\n ");159 dom.appendChild(el5, el6);160 var el6 = dom.createComment("");161 dom.appendChild(el5, el6);162 var el6 = dom.createTextNode("\n ");163 dom.appendChild(el5, el6);164 dom.appendChild(el4, el5);165 var el5 = dom.createTextNode("\n ");166 dom.appendChild(el4, el5);167 var el5 = dom.createElement("li");168 var el6 = dom.createTextNode("\n ");169 dom.appendChild(el5, el6);170 var el6 = dom.createComment("");171 dom.appendChild(el5, el6);172 var el6 = dom.createTextNode("\n ");173 dom.appendChild(el5, el6);174 dom.appendChild(el4, el5);175 var el5 = dom.createTextNode("\n ");176 dom.appendChild(el4, el5);177 dom.appendChild(el3, el4);178 var el4 = dom.createTextNode("\n ");179 dom.appendChild(el3, el4);180 dom.appendChild(el2, el3);181 var el3 = dom.createComment(" /.navbar-collapse ");182 dom.appendChild(el2, el3);183 var el3 = dom.createTextNode("\n ");184 dom.appendChild(el2, el3);185 dom.appendChild(el1, el2);186 var el2 = dom.createComment(" /.container-fluid ");187 dom.appendChild(el1, el2);188 var el2 = dom.createTextNode("\n");189 dom.appendChild(el1, el2);190 dom.appendChild(el0, el1);191 var el1 = dom.createTextNode("\n");192 dom.appendChild(el0, el1);193 var el1 = dom.createComment("");194 dom.appendChild(el0, el1);195 var el1 = dom.createTextNode("\n");196 dom.appendChild(el0, el1);197 return el0;198 },199 buildRenderNodes: function buildRenderNodes(dom, fragment, contextualElement) {200 var element0 = dom.childAt(fragment, [0, 1, 7, 1]);201 var morphs = new Array(3);202 morphs[0] = dom.createMorphAt(dom.childAt(element0, [1]),1,1);203 morphs[1] = dom.createMorphAt(dom.childAt(element0, [3]),1,1);204 morphs[2] = dom.createMorphAt(fragment,2,2,contextualElement);205 return morphs;206 },207 statements: [208 ["block","link-to",["search"],[],0,null,["loc",[null,[17,10],[17,47]]]],209 ["block","link-to",["list"],[],1,null,["loc",[null,[20,10],[20,50]]]],210 ["content","outlet",["loc",[null,[26,0],[26,10]]],0,0,0,0]...
restaurant-item.js
Source:restaurant-item.js
...25 var el1 = dom.createElement("img");26 dom.setAttribute(el1,"style","width: 20px;");27 dom.setAttribute(el1,"src","https://www.emojibase.com/resources/img/emojis/apple/x1f525.png.pagespeed.ic.62QVMlIn1k.png");28 dom.setAttribute(el1,"alt","");29 dom.appendChild(el0, el1);30 var el1 = dom.createTextNode("\n ");31 dom.appendChild(el0, el1);32 return el0;33 },34 buildRenderNodes: function buildRenderNodes() { return []; },35 statements: [36 ],37 locals: [],38 templates: []39 };40 }());41 return {42 meta: {43 "revision": "Ember@2.8.3",44 "loc": {45 "source": null,46 "start": {47 "line": 1,48 "column": 049 },50 "end": {51 "line": 18,52 "column": 053 }54 },55 "moduleName": "itpfin/templates/components/restaurant-item.hbs"56 },57 isEmpty: false,58 arity: 0,59 cachedFragment: null,60 hasRendered: false,61 buildFragment: function buildFragment(dom) {62 var el0 = dom.createDocumentFragment();63 var el1 = dom.createTextNode(" ");64 dom.appendChild(el0, el1);65 var el1 = dom.createElement("div");66 dom.setAttribute(el1,"class","row item");67 var el2 = dom.createTextNode("\n ");68 dom.appendChild(el1, el2);69 var el2 = dom.createElement("div");70 dom.setAttribute(el2,"class","col-md-6");71 var el3 = dom.createTextNode("\n ");72 dom.appendChild(el2, el3);73 var el3 = dom.createElement("p");74 dom.setAttribute(el3,"style","font-size:20px;");75 var el4 = dom.createElement("b");76 var el5 = dom.createComment("");77 dom.appendChild(el4, el5);78 dom.appendChild(el3, el4);79 dom.appendChild(el2, el3);80 var el3 = dom.createTextNode("\n ");81 dom.appendChild(el2, el3);82 var el3 = dom.createElement("p");83 var el4 = dom.createComment("");84 dom.appendChild(el3, el4);85 dom.appendChild(el2, el3);86 var el3 = dom.createTextNode("\n ");87 dom.appendChild(el2, el3);88 var el3 = dom.createElement("p");89 var el4 = dom.createElement("b");90 var el5 = dom.createTextNode("Number of reviews:");91 dom.appendChild(el4, el5);92 dom.appendChild(el3, el4);93 var el4 = dom.createTextNode(" ");94 dom.appendChild(el3, el4);95 var el4 = dom.createComment("");96 dom.appendChild(el3, el4);97 dom.appendChild(el2, el3);98 var el3 = dom.createTextNode("\n ");99 dom.appendChild(el2, el3);100 var el3 = dom.createElement("p");101 var el4 = dom.createElement("b");102 var el5 = dom.createTextNode("Rating: ");103 dom.appendChild(el4, el5);104 var el5 = dom.createElement("img");105 dom.appendChild(el4, el5);106 var el5 = dom.createTextNode(" ");107 dom.appendChild(el4, el5);108 dom.appendChild(el3, el4);109 dom.appendChild(el2, el3);110 var el3 = dom.createTextNode("\n ");111 dom.appendChild(el2, el3);112 dom.appendChild(el1, el2);113 var el2 = dom.createTextNode("\n ");114 dom.appendChild(el1, el2);115 var el2 = dom.createElement("div");116 dom.setAttribute(el2,"class","col-md-4");117 var el3 = dom.createTextNode("\n ");118 dom.appendChild(el2, el3);119 var el3 = dom.createElement("p");120 var el4 = dom.createElement("b");121 var el5 = dom.createTextNode("Address: ");122 dom.appendChild(el4, el5);123 dom.appendChild(el3, el4);124 var el4 = dom.createTextNode("\n ");125 dom.appendChild(el3, el4);126 var el4 = dom.createComment("");127 dom.appendChild(el3, el4);128 var el4 = dom.createTextNode(", ");129 dom.appendChild(el3, el4);130 var el4 = dom.createComment("");131 dom.appendChild(el3, el4);132 dom.appendChild(el2, el3);133 var el3 = dom.createTextNode("\n ");134 dom.appendChild(el2, el3);135 var el3 = dom.createElement("p");136 var el4 = dom.createTextNode("\n ");137 dom.appendChild(el3, el4);138 var el4 = dom.createElement("button");139 dom.setAttribute(el4,"style","margin-top: 5%;");140 dom.setAttribute(el4,"type","submit");141 dom.setAttribute(el4,"class","btn-danger");142 var el5 = dom.createTextNode("Add to list");143 dom.appendChild(el4, el5);144 dom.appendChild(el3, el4);145 var el4 = dom.createTextNode("\n ");146 dom.appendChild(el3, el4);147 dom.appendChild(el2, el3);148 var el3 = dom.createTextNode("\n ");149 dom.appendChild(el2, el3);150 dom.appendChild(el1, el2);151 var el2 = dom.createTextNode("\n ");152 dom.appendChild(el1, el2);153 dom.appendChild(el0, el1);154 var el1 = dom.createTextNode("\n");155 dom.appendChild(el0, el1);156 var el1 = dom.createComment("");157 dom.appendChild(el0, el1);158 var el1 = dom.createTextNode("\n");159 dom.appendChild(el0, el1);160 return el0;161 },162 buildRenderNodes: function buildRenderNodes(dom, fragment, contextualElement) {163 var element0 = dom.childAt(fragment, [1]);164 var element1 = dom.childAt(element0, [1]);165 var element2 = dom.childAt(element1, [7, 0, 1]);166 var element3 = dom.childAt(element0, [3]);167 var element4 = dom.childAt(element3, [1]);168 var element5 = dom.childAt(element3, [3, 1]);169 var morphs = new Array(8);170 morphs[0] = dom.createMorphAt(dom.childAt(element1, [1, 0]),0,0);171 morphs[1] = dom.createMorphAt(dom.childAt(element1, [3]),0,0);172 morphs[2] = dom.createMorphAt(dom.childAt(element1, [5]),2,2);173 morphs[3] = dom.createAttrMorph(element2, 'src');...
list.js
Source:list.js
...22 hasRendered: false,23 buildFragment: function buildFragment(dom) {24 var el0 = dom.createDocumentFragment();25 var el1 = dom.createTextNode(" ");26 dom.appendChild(el0, el1);27 var el1 = dom.createElement("div");28 dom.setAttribute(el1,"class","list fav");29 var el2 = dom.createTextNode("\n ");30 dom.appendChild(el1, el2);31 var el2 = dom.createComment("");32 dom.appendChild(el1, el2);33 var el2 = dom.createTextNode(", ");34 dom.appendChild(el1, el2);35 var el2 = dom.createComment("");36 dom.appendChild(el1, el2);37 var el2 = dom.createTextNode("\n ");38 dom.appendChild(el1, el2);39 dom.appendChild(el0, el1);40 var el1 = dom.createTextNode("\n");41 dom.appendChild(el0, el1);42 return el0;43 },44 buildRenderNodes: function buildRenderNodes(dom, fragment, contextualElement) {45 var element0 = dom.childAt(fragment, [1]);46 var morphs = new Array(2);47 morphs[0] = dom.createMorphAt(element0,1,1);48 morphs[1] = dom.createMorphAt(element0,3,3);49 return morphs;50 },51 statements: [52 ["content","restaurant.name",["loc",[null,[20,6],[20,25]]],0,0,0,0],53 ["content","restaurant.city",["loc",[null,[20,27],[20,46]]],0,0,0,0]54 ],55 locals: ["restaurant"],56 templates: []57 };58 }());59 return {60 meta: {61 "revision": "Ember@2.8.3",62 "loc": {63 "source": null,64 "start": {65 "line": 1,66 "column": 067 },68 "end": {69 "line": 25,70 "column": 071 }72 },73 "moduleName": "itpfin/templates/list.hbs"74 },75 isEmpty: false,76 arity: 0,77 cachedFragment: null,78 hasRendered: false,79 buildFragment: function buildFragment(dom) {80 var el0 = dom.createDocumentFragment();81 var el1 = dom.createComment("");82 dom.appendChild(el0, el1);83 var el1 = dom.createTextNode("\n");84 dom.appendChild(el0, el1);85 var el1 = dom.createElement("h2");86 var el2 = dom.createElement("b");87 var el3 = dom.createTextNode("Must Eats");88 dom.appendChild(el2, el3);89 dom.appendChild(el1, el2);90 dom.appendChild(el0, el1);91 var el1 = dom.createTextNode("\n");92 dom.appendChild(el0, el1);93 var el1 = dom.createElement("div");94 dom.setAttribute(el1,"class","row must-eats");95 var el2 = dom.createTextNode("\n ");96 dom.appendChild(el1, el2);97 var el2 = dom.createElement("div");98 dom.setAttribute(el2,"class","col-md-4");99 var el3 = dom.createTextNode("\n ");100 dom.appendChild(el2, el3);101 var el3 = dom.createElement("form");102 dom.setAttribute(el3,"class","newRes");103 var el4 = dom.createTextNode("\n ");104 dom.appendChild(el3, el4);105 var el4 = dom.createElement("div");106 dom.setAttribute(el4,"class","row");107 var el5 = dom.createTextNode("\n ");108 dom.appendChild(el4, el5);109 var el5 = dom.createComment("");110 dom.appendChild(el4, el5);111 var el5 = dom.createTextNode("\n ");112 dom.appendChild(el4, el5);113 dom.appendChild(el3, el4);114 var el4 = dom.createTextNode("\n ");115 dom.appendChild(el3, el4);116 var el4 = dom.createElement("div");117 dom.setAttribute(el4,"class","row");118 var el5 = dom.createTextNode("\n ");119 dom.appendChild(el4, el5);120 var el5 = dom.createComment("");121 dom.appendChild(el4, el5);122 var el5 = dom.createTextNode("\n ");123 dom.appendChild(el4, el5);124 dom.appendChild(el3, el4);125 var el4 = dom.createTextNode("\n ");126 dom.appendChild(el3, el4);127 var el4 = dom.createElement("div");128 dom.setAttribute(el4,"class","row");129 var el5 = dom.createTextNode("\n ");130 dom.appendChild(el4, el5);131 var el5 = dom.createElement("button");132 dom.setAttribute(el5,"type","submit");133 dom.setAttribute(el5,"class","btn-danger");134 var el6 = dom.createTextNode("Add Restaurant");135 dom.appendChild(el5, el6);136 dom.appendChild(el4, el5);137 var el5 = dom.createTextNode("\n ");138 dom.appendChild(el4, el5);139 dom.appendChild(el3, el4);140 var el4 = dom.createTextNode("\n ");141 dom.appendChild(el3, el4);142 dom.appendChild(el2, el3);143 var el3 = dom.createTextNode("\n ");144 dom.appendChild(el2, el3);145 dom.appendChild(el1, el2);146 var el2 = dom.createTextNode("\n ");147 dom.appendChild(el1, el2);148 var el2 = dom.createElement("div");149 dom.setAttribute(el2,"class","col-md-8");150 var el3 = dom.createTextNode("\n");151 dom.appendChild(el2, el3);152 var el3 = dom.createComment("");153 dom.appendChild(el2, el3);154 var el3 = dom.createTextNode(" ");155 dom.appendChild(el2, el3);156 dom.appendChild(el1, el2);157 var el2 = dom.createTextNode("\n");158 dom.appendChild(el1, el2);159 dom.appendChild(el0, el1);160 var el1 = dom.createTextNode("\n");161 dom.appendChild(el0, el1);162 return el0;163 },164 buildRenderNodes: function buildRenderNodes(dom, fragment, contextualElement) {165 var element1 = dom.childAt(fragment, [4]);166 var element2 = dom.childAt(element1, [1, 1]);167 var morphs = new Array(5);168 morphs[0] = dom.createMorphAt(fragment,0,0,contextualElement);169 morphs[1] = dom.createAttrMorph(element2, 'onsubmit');170 morphs[2] = dom.createMorphAt(dom.childAt(element2, [1]),1,1);171 morphs[3] = dom.createMorphAt(dom.childAt(element2, [3]),1,1);172 morphs[4] = dom.createMorphAt(dom.childAt(element1, [3]),1,1);173 dom.insertBoundary(fragment, 0);174 return morphs;175 },...
show_ssid.js
Source:show_ssid.js
...15 var tbody=document.createElement('tbody');16 var row=document.createElement('tr');17 var cell=document.createElement('th');18 cell.innerHTML='noise';19 row.appendChild(cell);20 var cell=document.createElement('th');21 cell.innerHTML='ssid';22 row.appendChild(cell);23 var cell=document.createElement('th');24 cell.innerHTML='encryption_type';25 row.appendChild(cell);26 var cell=document.createElement('th');27 cell.innerHTML='bitrates';28 row.appendChild(cell);29 var cell=document.createElement('th');30 cell.innerHTML='address';31 row.appendChild(cell);32 var cell=document.createElement('th');33 cell.innerHTML='frequency';34 row.appendChild(cell);35 var cell=document.createElement('th');36 cell.innerHTML='mode';37 row.appendChild(cell);38 var cell=document.createElement('th');39 cell.innerHTML='encrypted';40 row.appendChild(cell);41 var cell=document.createElement('th');42 cell.innerHTML='quality';43 row.appendChild(cell);44 var cell=document.createElement('th');45 cell.innerHTML='signal';46 row.appendChild(cell);47 var cell=document.createElement('th');48 cell.innerHTML='channel';49 row.appendChild(cell);50 thead.appendChild(row);51 tbl.appendChild(thead);52 for (var i=0;i<len;i++){53 var row=document.createElement('tr');54 var cell=document.createElement('td');55 cell.innerHTML=j[i].noise;56 row.appendChild(cell);57 var cell=document.createElement('td');58 cell.innerHTML=j[i].ssid;59 row.appendChild(cell);60 var cell=document.createElement('td');61 cell.innerHTML=j[i].encryption_type;62 row.appendChild(cell);63 var cell=document.createElement('td');64 cell.innerHTML=j[i].bitrates;65 row.appendChild(cell);66 var cell=document.createElement('td');67 cell.innerHTML=j[i].address;68 row.appendChild(cell);69 var cell=document.createElement('td');70 cell.innerHTML=j[i].frequency;71 row.appendChild(cell);72 var cell=document.createElement('td');73 cell.innerHTML=j[i].mode;74 row.appendChild(cell);75 var cell=document.createElement('td');76 cell.innerHTML=j[i].encrypted;77 row.appendChild(cell);78 var cell=document.createElement('td');79 cell.innerHTML=j[i].quality;80 row.appendChild(cell);81 var cell=document.createElement('td');82 cell.innerHTML=j[i].signal;83 row.appendChild(cell);84 var cell=document.createElement('td');85 cell.innerHTML=j[i].hannel;86 row.appendChild(cell);87 tbody.appendChild(row); 88 }89tbl.appendChild(tbody);90$(tbl).tablesorter(); 91document.getElementsByTagName('body')[0].appendChild(tbl);...
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: 'example.png' });7 await browser.close();8})();
Using AI Code Generation
1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.setContent('<div>hello</div>');7 await page.evaluate(() => {8 const div = document.createElement('div');9 div.textContent = 'world';10 document.body.appendChild(div);11 });12 await browser.close();13})();
Using AI Code Generation
1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const element = await page.$('input[name="q"]');7 await element._appendChild({value:'hello world'});8 await browser.close();9})();10from playwright.sync_api import sync_playwright11with sync_playwright() as p:12 browser = p.chromium.launch()13 context = browser.new_context()14 page = context.new_page()15 element = page.query_selector("input[name='q']")16 element._append_child({"value":"hello world"})17 browser.close()18const {chromium} = require('playwright');19(async () => {20 const browser = await chromium.launch();21 const context = await browser.newContext();22 const page = await context.newPage();23 const element = await page.$('input[name="q"]');24 await element._appendChild({value:'hello world'});25 await browser.close();26})();27from playwright.sync_api import sync_playwright28with sync_playwright() as p:29 browser = p.chromium.launch()30 context = browser.new_context()31 page = context.new_page()32 element = page.query_selector("input[name='q']")33 element._append_child({"value":"hello world"})34 browser.close()35const {chromium} = require('playwright');36(async () => {37 const browser = await chromium.launch();38 const context = await browser.newContext();39 const page = await context.newPage();40 const element = await page.$('input[name="q"]');41 await element._appendChild({value:'hello world'});42 await browser.close();43})();
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.evaluate(() => {6 const document = window['playwright'].selectors._document;7 const div = document.createElement('div');8 div.id = 'myDiv';9 document.body.appendChild(div);10 });11 await browser.close();12})();13const { chromium } = require('playwright');14(async () => {15 const browser = await chromium.launch();16 const page = await browser.newPage();17 await page.evaluate(() => {18 const document = window['playwright'].selectors._document;19 document.body.innerHTML = '<div id="myDiv"></div>';20 });21 await browser.close();22})();23const { chromium } = require('playwright');24(async () => {25 const browser = await chromium.launch();26 const page = await browser.newPage();27 await page.evaluate(() => {28 const document = window['playwright'].selectors._document;29 document.body.innerText = 'Hello World!';30 });31 await browser.close();32})();33const { chromium } = require('playwright');34(async () => {35 const browser = await chromium.launch();36 const page = await browser.newPage();37 await page.evaluate(() => {38 const document = window['playwright'].selectors._document;39 const div = document.createElement('div');
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.setContent('<input type="text" id="myInput">');6 const input = await page.$('input');7 await page.evaluate(element => element.value = 'Hello World', input);8 await page.screenshot({ path: 'example.png' });9 await browser.close();10})();11const { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const page = await browser.newPage();15 await page.setContent('<input type="text" id="myInput">');16 const input = await page.$('input');17 await page.evaluate(element => element.value = 'Hello World', input);18 await page.screenshot({ path: 'example.png' });19 await browser.close();20})();21const { chromium } = require('playwright');22(async () => {23 const browser = await chromium.launch();24 const page = await browser.newPage();25 await page.setContent('<input type="text" id="myInput">');26 const input = await page.$('input');27 await page.evaluate(element => element.value = 'Hello World', input);28 await page.screenshot({ path: 'example.png' });29 await browser.close();30})();31const { chromium } = require('playwright');32(async () => {33 const browser = await chromium.launch();34 const page = await browser.newPage();35 await page.setContent('<input type="text" id="myInput">');36 const input = await page.$('input');37 await page.evaluate(element => element.value = 'Hello World', input);38 await page.screenshot({ path: 'example.png' });39 await browser.close();40})();41const { chromium } = require('playwright');
Using AI Code Generation
1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const element = await page.$('body');7 await element.evaluate(element => element.appendChild(document.createElement('div')), element);8 await browser.close();9})();10const {chromium} = require('playwright');11(async () => {12 const browser = await chromium.launch();13 const context = await browser.newContext();14 const page = await context.newPage();15 const elements = await page.$$('body');16 console.log(elements);17 await browser.close();18})();19const {chromium} = require('playwright');20(async () => {21 const browser = await chromium.launch();22 const context = await browser.newContext();23 const page = await context.newPage();24 const elements = await page.$$('body');25 console.log(elements);26 const innerHTML = await elements[0].evaluate(element => element.innerHTML);27 console.log(innerHTML);28 await browser.close();29})();30const {chromium} = require('playwright');31(async () => {32 const browser = await chromium.launch();33 const context = await browser.newContext();34 const page = await context.newPage();35 const elements = await page.$$('body');36 console.log(elements);37 const innerHTML = await elements[0].evaluate(element => element.innerHTML);38 console.log(innerHTML);39 const bodyInnerHTML = await page.evaluate(() => document.body.innerHTML);40 console.log(bodyInnerHTML);41 await browser.close();42})();
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.evaluate(() => {7 const newElement = document.createElement('div');8 newElement.id = 'myElement';9 document.body.appendChild(newElement);10 });11 await page.screenshot({ path: `screenshot.png` });12 await browser.close();13})();14 at CDPSession.send (C:\Users\user\Documents\playwright\playwright\node_modules\playwright\lib\protocol\connection.js:59:23)15 at DOMDispatcher._dispatchEvent (C:\Users\user\Documents\playwright\playwright\node_modules\playwright\lib\protocol\dom.js:36:29)16 at CDPSession.Page._onMessage (C:\Users\user\Documents\playwright\playwright\node_modules\playwright\lib\protocol\page.js:85:47)17 at CDPSession.emit (events.js:315:20)18 at CDPSession._onMessage (C:\Users\user\Documents\playwright\playwright\node_modules\playwright\lib\protocol\connection.js:140:12)19 at Connection._onMessage (C:\Users\user\Documents\playwright\playwright\node_modules\playwright\lib\protocol\connection.js:32:47)20 at WebSocketTransport._ws.addEventListener.event (C:\Users\user\Documents\playwright\playwright\node_modules\playwright\lib\protocol\transport.js:129:24)21 at WebSocket.onMessage (C:\Users\user\Documents\playwright\playwright\node_modules\ws\lib\event-target.js:132:16)22 at WebSocket.emit (events.js:315:20)23 at Receiver.receiverOnMessage (C:\Users\user\Documents
Using AI Code Generation
1const { Page } = require('playwright');2Page.prototype.append = async function(selector, html) {3 const element = await this.$(selector);4 return element._delegate.append(html);5};6module.exports = {7};8const { Page } = require('./test');9module.exports = {10 launchOptions: {11 },12 serverOptions: {13 },14 contextOptions: {15 },16};17describe('Jest Playwright', () => {18 beforeAll(async () => {19 });20 it('should be titled "Jest Playwright"', async () => {21 await expect(page.title()).resolves.toMatch('Jest Playwright');22 });23 it('should append to the DOM', async () => {24 await page.append('#container', '<p>hello</p>');25 const text = await page.$eval('#container', (e) => e.textContent);26 expect(text).toBe('hello');27 });28});
Using AI Code Generation
1import { appendChild } from 'playwright';2appendChild(document.body, 'span', { id: 'test' });3import { appendChild } from 'playwright';4appendChild(document.body, 'span', { id: 'test' });5import { appendChild } from 'playwright';6appendChild(document.body, 'span', { id: 'test' });7import { appendChild } from 'playwright';8appendChild(document.body, 'span', { id: 'test' });9import { appendChild } from 'playwright';10appendChild(document.body, 'span', { id: 'test' });11import { appendChild } from 'playwright';12appendChild(document.body, 'span', { id: 'test' });13import { appendChild } from 'playwright';14appendChild(document.body, 'span', { id: 'test' });15import { appendChild } from 'playwright';16appendChild(document.body, 'span', { id: 'test' });17import { appendChild } from 'playwright';18appendChild(document.body, 'span', { id: 'test' });19import { appendChild } from 'playwright';20appendChild(document.body, 'span', { id: 'test' });21import { appendChild } from 'playwright';22appendChild(document.body, 'span', { id: 'test' });23import { appendChild } from 'playwright';24appendChild(document.body, 'span', { id: 'test' });25import { appendChild } from 'playwright';26appendChild(document.body, 'span',
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!!