How to use nodeSet method in stryker-parent

Best JavaScript code snippet using stryker-parent

step.js

Source:step.js Github

copy

Full Screen

1 /**2 * @license3 * The MIT License4 *5 * Copyright (c) 2007 Cybozu Labs, Inc.6 * Copyright (c) 2012 Google Inc.7 *8 * Permission is hereby granted, free of charge, to any person obtaining a copy9 * of this software and associated documentation files (the "Software"), to10 * deal in the Software without restriction, including without limitation the11 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or12 * sell copies of the Software, and to permit persons to whom the Software is13 * furnished to do so, subject to the following conditions:14 *15 * The above copyright notice and this permission notice shall be included in16 * all copies or substantial portions of the Software.17 *18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS24 * IN THE SOFTWARE.25 */26/**27 * @fileoverview A step expression.28 * @author moz@google.com (Michael Zhou)29 */30goog.provide('wgxpath.Step');31goog.require('goog.array');32goog.require('goog.dom.NodeType');33goog.require('wgxpath.DataType');34goog.require('wgxpath.Expr');35goog.require('wgxpath.KindTest');36goog.require('wgxpath.Node');37goog.require('wgxpath.NodeSet');38goog.require('wgxpath.Predicates');39goog.require('wgxpath.userAgent');40/**41 * Class for a step in a path expression42 * http://www.w3.org/TR/xpath20/#id-steps.43 *44 * @extends {wgxpath.Expr}45 * @constructor46 * @param {!wgxpath.Step.Axis} axis The axis for this Step.47 * @param {!wgxpath.NodeTest} test The test for this Step.48 * @param {!wgxpath.Predicates=} opt_predicates The predicates for this49 * Step.50 * @param {boolean=} opt_descendants Whether descendants are to be included in51 * this step ('//' vs '/').52 */53wgxpath.Step = function(axis, test, opt_predicates, opt_descendants) {54 var axisCast = /** @type {!wgxpath.Step.Axis_} */ (axis);55 wgxpath.Expr.call(this, wgxpath.DataType.NODESET);56 /**57 * @type {!wgxpath.Step.Axis_}58 * @private59 */60 this.axis_ = axisCast;61 /**62 * @type {!wgxpath.NodeTest}63 * @private64 */65 this.test_ = test;66 /**67 * @type {!wgxpath.Predicates}68 * @private69 */70 this.predicates_ = opt_predicates || new wgxpath.Predicates([]);71 /**72 * Whether decendants are included in this step73 *74 * @private75 * @type {boolean}76 */77 this.descendants_ = !!opt_descendants;78 var quickAttrInfo = this.predicates_.getQuickAttr();79 if (axis.supportsQuickAttr_ && quickAttrInfo) {80 var attrName = quickAttrInfo.name;81 attrName = wgxpath.userAgent.IE_DOC_PRE_9 ?82 attrName.toLowerCase() : attrName;83 var attrValueExpr = quickAttrInfo.valueExpr;84 this.setQuickAttr({85 name: attrName,86 valueExpr: attrValueExpr87 });88 }89 this.setNeedContextPosition(this.predicates_.doesNeedContextPosition());90};91goog.inherits(wgxpath.Step, wgxpath.Expr);92/**93 * @override94 * @return {!wgxpath.NodeSet} The nodeset result.95 */96wgxpath.Step.prototype.evaluate = function(ctx) {97 var node = ctx.getNode();98 var nodeset = null;99 var quickAttr = this.getQuickAttr();100 var attrName = null;101 var attrValue = null;102 var pstart = 0;103 if (quickAttr) {104 attrName = quickAttr.name;105 attrValue = quickAttr.valueExpr ?106 quickAttr.valueExpr.asString(ctx) : null;107 pstart = 1;108 }109 if (this.descendants_) {110 if (!this.doesNeedContextPosition() &&111 this.axis_ == wgxpath.Step.Axis.CHILD) {112 nodeset = wgxpath.Node.getDescendantNodes(this.test_, node,113 attrName, attrValue);114 nodeset = this.predicates_.evaluatePredicates(nodeset, pstart);115 } else {116 var step = new wgxpath.Step(wgxpath.Step.Axis.DESCENDANT_OR_SELF,117 new wgxpath.KindTest('node'));118 var iter = step.evaluate(ctx).iterator();119 var n = iter.next();120 if (!n) {121 nodeset = new wgxpath.NodeSet();122 } else {123 nodeset = this.evaluate_(/** @type {!wgxpath.Node} */ (n),124 attrName, attrValue, pstart);125 while ((n = iter.next()) != null) {126 nodeset = wgxpath.NodeSet.merge(nodeset,127 this.evaluate_(/** @type {!wgxpath.Node} */ (n), attrName,128 attrValue, pstart));129 }130 }131 }132 } else {133 nodeset = this.evaluate_(ctx.getNode(), attrName, attrValue, pstart);134 }135 return nodeset;136};137/**138 * Evaluates this step on the given context to a nodeset.139 * (assumes this.descendants_ = false)140 *141 * @private142 * @param {!wgxpath.Node} node The context node.143 * @param {?string} attrName The name of the attribute.144 * @param {?string} attrValue The value of the attribute.145 * @param {number} pstart The first predicate to evaluate.146 * @return {!wgxpath.NodeSet} The nodeset from evaluating this Step.147 */148wgxpath.Step.prototype.evaluate_ = function(149 node, attrName, attrValue, pstart) {150 var nodeset = this.axis_.func_(this.test_, node, attrName, attrValue);151 nodeset = this.predicates_.evaluatePredicates(nodeset, pstart);152 return nodeset;153};154/**155 * Returns whether the step evaluation should include descendants.156 *157 * @return {boolean} Whether descendants are included.158 */159wgxpath.Step.prototype.doesIncludeDescendants = function() {160 return this.descendants_;161};162/**163 * Returns the step's axis.164 *165 * @return {!wgxpath.Step.Axis} The axis.166 */167wgxpath.Step.prototype.getAxis = function() {168 return /** @type {!wgxpath.Step.Axis} */ (this.axis_);169};170/**171 * Returns the test for this step.172 *173 * @return {!wgxpath.NodeTest} The test for this step.174 */175wgxpath.Step.prototype.getTest = function() {176 return this.test_;177};178/**179 * @override180 */181wgxpath.Step.prototype.toString = function() {182 var text = 'Step:';183 text += wgxpath.Expr.indent('Operator: ' + (this.descendants_ ? '//' : '/'));184 if (this.axis_.name_) {185 text += wgxpath.Expr.indent('Axis: ' + this.axis_);186 }187 text += wgxpath.Expr.indent(this.test_);188 if (this.predicates_.getLength()) {189 var predicates = goog.array.reduce(this.predicates_.getPredicates(),190 function(prev, curr) {191 return prev + wgxpath.Expr.indent(curr);192 }, 'Predicates:');193 text += wgxpath.Expr.indent(predicates);194 }195 return text;196};197/**198 * A step axis.199 *200 * @constructor201 * @param {string} name The axis name.202 * @param {function(!wgxpath.NodeTest, wgxpath.Node, ?string, ?string):203 * !wgxpath.NodeSet} func The function for this axis.204 * @param {boolean} reverse Whether to iterate over the nodeset in reverse.205 * @param {boolean} supportsQuickAttr Whether quickAttr should be enabled for206 * this axis.207 * @private208 */209wgxpath.Step.Axis_ = function(name, func, reverse, supportsQuickAttr) {210 /**211 * @private212 * @type {string}213 */214 this.name_ = name;215 /**216 * @private217 * @type {function(!wgxpath.NodeTest, wgxpath.Node, ?string, ?string):218 * !wgxpath.NodeSet}219 */220 this.func_ = func;221 /**222 * @private223 * @type {boolean}224 */225 this.reverse_ = reverse;226 /**227 * @private228 * @type {boolean}229 */230 this.supportsQuickAttr_ = supportsQuickAttr;231};232/**233 * Returns whether the nodes in the step should be iterated over in reverse.234 *235 * @return {boolean} Whether the nodes should be iterated over in reverse.236 */237wgxpath.Step.Axis_.prototype.isReverse = function() {238 return this.reverse_;239};240/**241 * @override242 */243wgxpath.Step.Axis_.prototype.toString = function() {244 return this.name_;245};246/**247 * A map from axis name to Axis.248 *249 * @type {!Object.<string, !wgxpath.Step.Axis>}250 * @private251 */252wgxpath.Step.nameToAxisMap_ = {};253/**254 * Creates an axis and maps the axis's name to that axis.255 *256 * @param {string} name The axis name.257 * @param {function(!wgxpath.NodeTest, wgxpath.Node, ?string, ?string):258 * !wgxpath.NodeSet} func The function for this axis.259 * @param {boolean} reverse Whether to iterate over nodesets in reverse.260 * @param {boolean=} opt_supportsQuickAttr Whether quickAttr can be enabled261 * for this axis.262 * @return {!wgxpath.Step.Axis} The axis.263 * @private264 */265wgxpath.Step.createAxis_ =266 function(name, func, reverse, opt_supportsQuickAttr) {267 if (wgxpath.Step.nameToAxisMap_.hasOwnProperty(name)) {268 throw Error('Axis already created: ' + name);269 }270 // The upcast and then downcast for the JSCompiler.271 var axis = /** @type {!Object} */ (new wgxpath.Step.Axis_(272 name, func, reverse, !!opt_supportsQuickAttr));273 axis = /** @type {!wgxpath.Step.Axis} */ (axis);274 wgxpath.Step.nameToAxisMap_[name] = axis;275 return axis;276};277/**278 * Returns the axis for this axisname or null if none.279 *280 * @param {string} name The axis name.281 * @return {wgxpath.Step.Axis} The axis.282 */283wgxpath.Step.getAxis = function(name) {284 return wgxpath.Step.nameToAxisMap_[name] || null;285};286/**287 * Axis enumeration.288 *289 * @enum {{isReverse: function(): boolean}}290 */291wgxpath.Step.Axis = {292 ANCESTOR: wgxpath.Step.createAxis_('ancestor',293 function(test, node) {294 var nodeset = new wgxpath.NodeSet();295 var parent = node;296 while (parent = parent.parentNode) {297 if (test.matches(parent)) {298 nodeset.unshift(parent);299 }300 }301 return nodeset;302 }, true),303 ANCESTOR_OR_SELF: wgxpath.Step.createAxis_('ancestor-or-self',304 function(test, node) {305 var nodeset = new wgxpath.NodeSet();306 var toMatch = node;307 do {308 if (test.matches(toMatch)) {309 nodeset.unshift(toMatch);310 }311 } while (toMatch = toMatch.parentNode);312 return nodeset;313 }, true),314 ATTRIBUTE: wgxpath.Step.createAxis_('attribute',315 function(test, node) {316 var nodeset = new wgxpath.NodeSet();317 var testName = test.getName();318 // IE8 doesn't allow access to the style attribute using getNamedItem.319 // It returns an object with nodeValue = null. Even worse, ".style" on320 // IE8 can mutate the DOM, adding an empty string attribute. Therefore321 // we check it last.322 if (testName == 'style' &&323 wgxpath.userAgent.IE_DOC_PRE_9 && node.style) {324 nodeset.add(wgxpath.IEAttrWrapper.forStyleOf(325 /** @type {!Node} */ (node), node.sourceIndex));326 return nodeset;327 }328 var attrs = node.attributes;329 if (attrs) {330 if ((test instanceof wgxpath.KindTest &&331 goog.isNull(test.getType())) || testName == '*') {332 var sourceIndex = node.sourceIndex;333 for (var i = 0, attr; attr = attrs[i]; i++) {334 if (wgxpath.userAgent.IE_DOC_PRE_9) {335 if (attr.nodeValue) {336 nodeset.add(wgxpath.IEAttrWrapper.forAttrOf(337 /** @type {!Node} */ (node), attr, sourceIndex));338 }339 } else {340 nodeset.add(attr);341 }342 }343 } else {344 var attr = attrs.getNamedItem(testName);345 if (attr) {346 if (wgxpath.userAgent.IE_DOC_PRE_9) {347 if (attr.nodeValue) {348 nodeset.add(wgxpath.IEAttrWrapper.forAttrOf(349 /** @type {!Node} */ (node), attr, node.sourceIndex));350 }351 } else {352 nodeset.add(attr);353 }354 }355 }356 }357 return nodeset;358 }, false),359 CHILD: wgxpath.Step.createAxis_('child',360 wgxpath.Node.getChildNodes, false, true),361 DESCENDANT: wgxpath.Step.createAxis_('descendant',362 wgxpath.Node.getDescendantNodes, false, true),363 DESCENDANT_OR_SELF: wgxpath.Step.createAxis_('descendant-or-self',364 function(test, node, attrName, attrValue) {365 var nodeset = new wgxpath.NodeSet();366 if (wgxpath.Node.attrMatches(node, attrName, attrValue)) {367 if (test.matches(node)) {368 nodeset.add(node);369 }370 }371 return wgxpath.Node.getDescendantNodes(test, node,372 attrName, attrValue, nodeset);373 }, false, true),374 FOLLOWING: wgxpath.Step.createAxis_('following',375 function(test, node, attrName, attrValue) {376 var nodeset = new wgxpath.NodeSet();377 var parent = node;378 do {379 var child = parent;380 while (child = child.nextSibling) {381 if (wgxpath.Node.attrMatches(child, attrName, attrValue)) {382 if (test.matches(child)) {383 nodeset.add(child);384 }385 }386 nodeset = wgxpath.Node.getDescendantNodes(test, child,387 attrName, attrValue, nodeset);388 }389 } while (parent = parent.parentNode);390 return nodeset;391 }, false, true),392 FOLLOWING_SIBLING: wgxpath.Step.createAxis_('following-sibling',393 function(test, node) {394 var nodeset = new wgxpath.NodeSet();395 var toMatch = node;396 while (toMatch = toMatch.nextSibling) {397 if (test.matches(toMatch)) {398 nodeset.add(toMatch);399 }400 }401 return nodeset;402 }, false),403 NAMESPACE: wgxpath.Step.createAxis_('namespace',404 function(test, node) {405 // not implemented406 return new wgxpath.NodeSet();407 }, false),408 PARENT: wgxpath.Step.createAxis_('parent',409 function(test, node) {410 var nodeset = new wgxpath.NodeSet();411 if (node.nodeType == goog.dom.NodeType.DOCUMENT) {412 return nodeset;413 } else if (node.nodeType == goog.dom.NodeType.ATTRIBUTE) {414 nodeset.add(node.ownerElement);415 return nodeset;416 }417 var parent = /** @type {!Node} */ (node.parentNode);418 if (test.matches(parent)) {419 nodeset.add(parent);420 }421 return nodeset;422 }, false),423 PRECEDING: wgxpath.Step.createAxis_('preceding',424 function(test, node, attrName, attrValue) {425 var nodeset = new wgxpath.NodeSet();426 var parents = [];427 var parent = node;428 do {429 parents.unshift(parent);430 } while (parent = parent.parentNode);431 for (var i = 1, l0 = parents.length; i < l0; i++) {432 var siblings = [];433 node = parents[i];434 while (node = node.previousSibling) {435 siblings.unshift(node);436 }437 for (var j = 0, l1 = siblings.length; j < l1; j++) {438 node = siblings[j];439 if (wgxpath.Node.attrMatches(node, attrName, attrValue)) {440 if (test.matches(node)) nodeset.add(node);441 }442 nodeset = wgxpath.Node.getDescendantNodes(test, node,443 attrName, attrValue, nodeset);444 }445 }446 return nodeset;447 }, true, true),448 PRECEDING_SIBLING: wgxpath.Step.createAxis_('preceding-sibling',449 function(test, node) {450 var nodeset = new wgxpath.NodeSet();451 var toMatch = node;452 while (toMatch = toMatch.previousSibling) {453 if (test.matches(toMatch)) {454 nodeset.unshift(toMatch);455 }456 }457 return nodeset;458 }, true),459 SELF: wgxpath.Step.createAxis_('self',460 function(test, node) {461 var nodeset = new wgxpath.NodeSet();462 if (test.matches(node)) {463 nodeset.add(node);464 }465 return nodeset;466 }, false)...

Full Screen

Full Screen

nodeset.js

Source:nodeset.js Github

copy

Full Screen

1 /**2 * @license3 * The MIT License4 *5 * Copyright (c) 2007 Cybozu Labs, Inc.6 * Copyright (c) 2012 Google Inc.7 *8 * Permission is hereby granted, free of charge, to any person obtaining a copy9 * of this software and associated documentation files (the "Software"), to10 * deal in the Software without restriction, including without limitation the11 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or12 * sell copies of the Software, and to permit persons to whom the Software is13 * furnished to do so, subject to the following conditions:14 *15 * The above copyright notice and this permission notice shall be included in16 * all copies or substantial portions of the Software.17 *18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS24 * IN THE SOFTWARE.25 */26/**27 * @fileoverview Context information about nodes in their nodeset.28 * @author evanrthomas@google.com (Evan Thomas)29 */30goog.provide('wgxpath.NodeSet');31goog.require('goog.dom');32goog.require('wgxpath.Node');33/**34 * A set of nodes sorted by their prefix order in the document.35 *36 * @constructor37 */38wgxpath.NodeSet = function() {39 // In violation of standard Closure practice, we initialize properties to40 // immutable constants in the constructor instead of on the prototype,41 // because we have empirically measured better performance by doing so.42 /**43 * A pointer to the first node in the linked list.44 *45 * @private46 * @type {wgxpath.NodeSet.Entry_}47 */48 this.first_ = null;49 /**50 * A pointer to the last node in the linked list.51 *52 * @private53 * @type {wgxpath.NodeSet.Entry_}54 */55 this.last_ = null;56 /**57 * Length of the linked list.58 *59 * @private60 * @type {number}61 */62 this.length_ = 0;63};64/**65 * A entry for a node in a linked list66 *67 * @param {!wgxpath.Node} node The node to be added.68 * @constructor69 * @private70 */71wgxpath.NodeSet.Entry_ = function(node) {72 // In violation of standard Closure practice, we initialize properties to73 // immutable constants in the constructor instead of on the prototype,74 // because we have empirically measured better performance by doing so.75 /**76 * @type {!wgxpath.Node}77 */78 this.node = node;79 /**80 * @type {wgxpath.NodeSet.Entry_}81 */82 this.prev = null;83 /**84 * @type {wgxpath.NodeSet.Entry_}85 */86 this.next = null;87};88/**89 * Merges two nodesets, removing duplicates. This function may modify both90 * nodesets, and will return a reference to one of the two.91 *92 * <p> Note: We assume that the two nodesets are already sorted in DOM order.93 *94 * @param {!wgxpath.NodeSet} a The first nodeset.95 * @param {!wgxpath.NodeSet} b The second nodeset.96 * @return {!wgxpath.NodeSet} The merged nodeset.97 */98wgxpath.NodeSet.merge = function(a, b) {99 if (!a.first_) {100 return b;101 } else if (!b.first_) {102 return a;103 }104 var aCurr = a.first_;105 var bCurr = b.first_;106 var merged = a, tail = null, next = null, length = 0;107 while (aCurr && bCurr) {108 if (wgxpath.Node.equal(aCurr.node, bCurr.node)) {109 next = aCurr;110 aCurr = aCurr.next;111 bCurr = bCurr.next;112 } else {113 var compareResult = goog.dom.compareNodeOrder(114 /** @type {!Node} */ (aCurr.node),115 /** @type {!Node} */ (bCurr.node));116 if (compareResult > 0) {117 next = bCurr;118 bCurr = bCurr.next;119 } else {120 next = aCurr;121 aCurr = aCurr.next;122 }123 }124 next.prev = tail;125 if (tail) {126 tail.next = next;127 } else {128 merged.first_ = next;129 }130 tail = next;131 length++;132 }133 next = aCurr || bCurr;134 while (next) {135 next.prev = tail;136 tail.next = next;137 tail = next;138 length++;139 next = next.next;140 }141 merged.last_ = tail;142 merged.length_ = length;143 return merged;144};145/**146 * Prepends a node to this nodeset.147 *148 * @param {!wgxpath.Node} node The node to be added.149 */150wgxpath.NodeSet.prototype.unshift = function(node) {151 var entry = new wgxpath.NodeSet.Entry_(node);152 entry.next = this.first_;153 if (!this.last_) {154 this.first_ = this.last_ = entry;155 } else {156 this.first_.prev = entry;157 }158 this.first_ = entry;159 this.length_++;160};161/**162 * Adds a node to this nodeset.163 *164 * @param {!wgxpath.Node} node The node to be added.165 */166wgxpath.NodeSet.prototype.add = function(node) {167 var entry = new wgxpath.NodeSet.Entry_(node);168 entry.prev = this.last_;169 if (!this.first_) {170 this.first_ = this.last_ = entry;171 } else {172 this.last_.next = entry;173 }174 this.last_ = entry;175 this.length_++;176};177/**178 * Returns the first node of the nodeset.179 *180 * @return {?wgxpath.Node} The first node of the nodeset181 if the nodeset is non-empty;182 * otherwise null.183 */184wgxpath.NodeSet.prototype.getFirst = function() {185 var first = this.first_;186 if (first) {187 return first.node;188 } else {189 return null;190 }191};192/**193 * Return the length of this nodeset.194 *195 * @return {number} The length of the nodeset.196 */197wgxpath.NodeSet.prototype.getLength = function() {198 return this.length_;199};200/**201 * Returns the string representation of this nodeset.202 *203 * @return {string} The string representation of this nodeset.204 */205wgxpath.NodeSet.prototype.string = function() {206 var node = this.getFirst();207 return node ? wgxpath.Node.getValueAsString(node) : '';208};209/**210 * Returns the number representation of this nodeset.211 *212 * @return {number} The number representation of this nodeset.213 */214wgxpath.NodeSet.prototype.number = function() {215 return +this.string();216};217/**218 * Returns an iterator over this nodeset. Once this iterator is made, DO NOT219 * add to this nodeset until the iterator is done.220 *221 * @param {boolean=} opt_reverse Whether to iterate right to left or vice versa.222 * @return {!wgxpath.NodeSet.Iterator} An iterator over the nodes.223 */224wgxpath.NodeSet.prototype.iterator = function(opt_reverse) {225 return new wgxpath.NodeSet.Iterator(this, !!opt_reverse);226};227/**228 * An iterator over the nodes of this nodeset.229 *230 * @param {!wgxpath.NodeSet} nodeset The nodeset to be iterated over.231 * @param {boolean} reverse Whether to iterate in ascending or descending232 * order.233 * @constructor234 */235wgxpath.NodeSet.Iterator = function(nodeset, reverse) {236 // In violation of standard Closure practice, we initialize properties to237 // immutable constants in the constructor instead of on the prototype,238 // because we have empirically measured better performance by doing so.239 /**240 * @type {!wgxpath.NodeSet}241 * @private242 */243 this.nodeset_ = nodeset;244 /**245 * @type {boolean}246 * @private247 */248 this.reverse_ = reverse;249 /**250 * @type {wgxpath.NodeSet.Entry_}251 * @private252 */253 this.current_ = reverse ? nodeset.last_ : nodeset.first_;254 /**255 * @type {wgxpath.NodeSet.Entry_}256 * @private257 */258 this.lastReturned_ = null;259};260/**261 * Returns the next value of the iteration or null if passes the end.262 *263 * @return {?wgxpath.Node} The next node from this iterator.264 */265wgxpath.NodeSet.Iterator.prototype.next = function() {266 var current = this.current_;267 if (current == null) {268 return null;269 } else {270 var lastReturned = this.lastReturned_ = current;271 if (this.reverse_) {272 this.current_ = current.prev;273 } else {274 this.current_ = current.next;275 }276 return lastReturned.node;277 }278};279/**280 * Deletes the last node that was returned from this iterator.281 */282wgxpath.NodeSet.Iterator.prototype.remove = function() {283 var nodeset = this.nodeset_;284 var entry = this.lastReturned_;285 if (!entry) {286 throw Error('Next must be called at least once before remove.');287 }288 var prev = entry.prev;289 var next = entry.next;290 // Modify the pointers of prev and next291 if (prev) {292 prev.next = next;293 } else {294 // If there was no prev node entry must've been first_, so update first_.295 nodeset.first_ = next;296 }297 if (next) {298 next.prev = prev;299 } else {300 // If there was no prev node entry must've been last_, so update last_.301 nodeset.last_ = prev;302 }303 nodeset.length_--;304 this.lastReturned_ = null;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var nodeSet = strykerParent.nodeSet;3var assert = require('assert');4describe('nodeSet', function () {5 it('should be an object', function () {6 assert.equal(typeof nodeSet, 'object');7 });8});9var nodeSet = require('node-set');10module.exports = {11};12module.exports = {13 someMethod: function () {14 return true;15 }16};17{18 "dependencies": {19 }20}21{22}

Full Screen

Using AI Code Generation

copy

Full Screen

1const nodeSet = require('stryker-parent').nodeSet;2const nodeSet = require('stryker-parent').nodeSet;3nodeSet('node6', 'node8', 'node10');4const nodeSet = require('stryker-parent').nodeSet;5const nodeSet = require('stryker-parent').nodeSet;6nodeSet('node6', 'node8', 'node10');7const nodeSet = require('stryker-parent').nodeSet;8const nodeSet = require('stryker-parent').nodeSet;9nodeSet('node6', 'node8', 'node10');10const nodeSet = require('stryker-parent').nodeSet;11const nodeSet = require('stryker-parent').nodeSet;12nodeSet('node6', 'node8', 'node10');13const nodeSet = require('stryker-parent').nodeSet;14const nodeSet = require('stryker-parent').nodeSet;15nodeSet('node6', 'node8', 'node10');16const nodeSet = require('stryker-parent').nodeSet;17const nodeSet = require('stryker-parent').nodeSet;18nodeSet('node6', 'node8', 'node10');19const nodeSet = require('stryker-parent').nodeSet;20const nodeSet = require('stryker-parent').nodeSet;21nodeSet('node6', 'node8', 'node10');

Full Screen

Using AI Code Generation

copy

Full Screen

1module.exports = {2 nodeSet: function() {3 return {4 }5 }6}7module.exports = function(config) {8 config.set({9 commandRunner: {10 }11 });12};

Full Screen

Using AI Code Generation

copy

Full Screen

1var parent = require('stryker-parent');2var child = require('stryker-child');3parent.nodeSet(child, process.argv[2], process.argv[3], process.argv[4], process.argv[5]);4var parent = require('stryker-parent');5var child = require('stryker-child');6parent.nodeGet(child, process.argv[2], process.argv[3], process.argv[4], process.argv[5]);7var parent = require('stryker-parent');8var child = require('stryker-child');9parent.nodeRemove(child, process.argv[2], process.argv[3], process.argv[4], process.argv[5]);10var parent = require('stryker-parent');11var child = require('stryker-child');12parent.nodeUpdate(child, process.argv[2], process.argv[3], process.argv[4], process.argv[5]);13var parent = require('stryker-parent');14var child = require('stryker-child');15parent.nodeGetAll(child, process.argv[2], process.argv[3], process.argv[4], process.argv[5]);16var parent = require('stryker-parent');17var child = require('stryker-child');18parent.nodeGetAllKeys(child, process.argv[2], process.argv[3], process.argv[4], process.argv[5]);19var parent = require('stryker-parent');20var child = require('stryker-child');21parent.nodeGetAllValues(child, process.argv[2], process.argv[3], process.argv[4], process.argv[5]);22var parent = require('stryker-parent');23var child = require('stryker-child');24parent.nodeGetAllKeysValues(child, process.argv[2], process.argv[3], process.argv[4], process.argv[5]);

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2strykerParent.nodeSet('C:\Program Files (x86)\nodejs\node.exe');3var stryker = require('stryker');4stryker.run();5var stryker = require('stryker');6stryker.run({7});8var stryker = require('stryker');9stryker.run({10});11var stryker = require('stryker');12stryker.run({13});14var stryker = require('stryker');15stryker.run({16});17var stryker = require('stryker');18stryker.run({19});20var stryker = require('stryker');21stryker.run({22});23var stryker = require('stryker');24stryker.run({

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var strykerParentNode = strykerParent.nodeSet;3var strykerParentNode = strykerParent.nodeSet;4var strykerParent = require('stryker-parent');5var strykerParentNode = strykerParent.nodeSet;6var strykerParentNode = strykerParent.nodeSet;7var strykerParent = require('stryker-parent');8var strykerParentNode = strykerParent.nodeSet;9var strykerParentNode = strykerParent.nodeSet;10var strykerParent = require('stryker-parent');11var strykerParentNode = strykerParent.nodeSet;12var strykerParentNode = strykerParent.nodeSet;13var strykerParent = require('stryker-parent');14var strykerParentNode = strykerParent.nodeSet;15var strykerParentNode = strykerParent.nodeSet;16var strykerParent = require('stryker-parent');17var strykerParentNode = strykerParent.nodeSet;18var strykerParentNode = strykerParent.nodeSet;19var strykerParent = require('stryker-parent');20var strykerParentNode = strykerParent.nodeSet;21var strykerParentNode = strykerParent.nodeSet;22var strykerParent = require('stryker-parent');23var strykerParentNode = strykerParent.nodeSet;24var strykerParentNode = strykerParent.nodeSet;25var strykerParent = require('stryker-parent');26var strykerParentNode = strykerParent.nodeSet;27var strykerParentNode = strykerParent.nodeSet;28var strykerParent = require('stryker-parent');

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var nodeSet = stryker.nodeSet;3var nodeSet = new nodeSet();4console.log(nodeSet);5var stryker = require('stryker-parent');6Your name to display (optional):7Your name to display (optional):

Full Screen

Using AI Code Generation

copy

Full Screen

1var nodeSet = require('stryker-parent').nodeSet;2var nodeVersion = '0.10.0';3nodeSet(nodeVersion, function(err) {4 if (err) {5 console.log('Error setting node version:', err);6 } else {7 console.log('Node version set to:', nodeVersion);8 }9});10### nodeSet(version, callback)11MIT © [Jason Boyles](

Full Screen

Using AI Code Generation

copy

Full Screen

1var nodeSet = require('stryker-parent').nodeSet;2nodeSet();3var nodeGet = require('stryker-parent').nodeGet;4var parent = nodeGet();5var nodeKill = require('stryker-parent').nodeKill;6nodeKill();7var nodeKill = require('stryker-parent').nodeKill;8nodeKill();9var nodeKill = require('stryker-parent').nodeKill;10nodeKill();11var nodeKill = require('stryker-parent').nodeKill;12nodeKill();13var nodeKill = require('stryker-parent').nodeKill;14nodeKill();15var nodeKill = require('stryker-parent').nodeKill;16nodeKill();17var nodeKill = require('stryker-parent').nodeKill;18nodeKill();19var nodeKill = require('stryker-parent').nodeKill;20nodeKill();21var nodeKill = require('stryker-parent').nodeKill;22nodeKill();

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

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

Run stryker-parent automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful