Every line of 'if statement in html' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
133 if(expression) { 134 return { 135 $type: "if", 136 condition: this._getParamNames(arguments[0])[0], 137 expression: expression, 138 children: arguments[1] 139 } 140 }
531 parseIf(): Node { 532 let token = this.current; 533 assert(token.kind == TokenKind.IF); 534 this.advance(); 535 536 if (!this.expect(TokenKind.LEFT_PARENTHESIS)) { 537 return null; 538 } 539 540 let value: Node; 541 542 // Recover from a missing value 543 if (this.peek(TokenKind.RIGHT_PARENTHESIS)) { 544 this.unexpectedToken(); 545 this.advance(); 546 value = createParseError(); 547 } 548 549 else { 550 value = this.parseExpression(Precedence.LOWEST, ParseKind.EXPRESSION); 551 if (value == null || !this.expect(TokenKind.RIGHT_PARENTHESIS)) { 552 return null; 553 } 554 } 555 556 let trueBranch = this.parseBody(); 557 if (trueBranch == null) { 558 return null; 559 } 560 561 let falseBranch: Node = null; 562 if (this.eat(TokenKind.ELSE)) { 563 falseBranch = this.parseBody(); 564 if (falseBranch == null) { 565 return null; 566 } 567 } 568 569 return createIf(value, trueBranch, falseBranch).withRange(spanRanges( 570 token.range, (falseBranch != null ? falseBranch : trueBranch).range)); 571 }
36 function html_if_tag_allowed(node) { 37 if (is_allowed_html_tag(node)) { 38 this.lit(node.literal); 39 return; 40 } else { 41 this.lit(escape(node.literal)); 42 } 43 }
33 export function If({ condition, children }) { 34 if (children == null) { 35 return null; 36 } 37 38 const conditionResult = getConditionResult(condition) 39 40 return ( 41 42 {[].concat(children).find(c => (c.type !== Else) ^ !conditionResult) || 43 null} 44 45 ); 46 }
302 function parseIf(parser) { 303 lookAhead(parser); 304 var condExpr = parseSimpleExpr(parser); 305 if (parser.headToken != "then") { 306 throw new IbisError(expected(parser, "then")); 307 } 308 lookAhead(parser); 309 var thenExpr = parseSimpleExpr(parser); 310 if (parser.headToken != "else") { 311 throw new IbisError(expected(parser, "else")); 312 } 313 lookAhead(parser); 314 var elseExpr = parseSimpleExpr(parser); 315 return Expr.createIf(condExpr, thenExpr, elseExpr); 316 }
135 function processIf (el) { 136 const exp = getAndRemoveAttr(el, 'v-if'); 137 if (exp) { 138 el.if = exp; 139 if (!el.ifConditions) { 140 el.ifConditions = []; 141 } 142 el.ifConditions.push({ 143 exp: exp, 144 block: el 145 }); 146 } 147 }
60 get if() { 61 const ifNode = new Node(); 62 ifNode.parent = this._current; 63 this._current.set(keyword.IF, ifNode); 64 this._current = ifNode; 65 return this; 66 }
198 statement() { 199 let node; 200 201 if (this.currentToken.is(Token.BEGIN)) { 202 node = this.compoundStatement(); 203 } else if (this.currentToken.is(Token.IDENTIFIER)) { 204 node = this.assignmentStatement(); 205 } else { 206 node = this.empty(); 207 } 208 209 return node; 210 }
947 prewalkIfStatement(statement) { 948 this.prewalkStatement(statement.consequent); 949 if (statement.alternate) { 950 this.prewalkStatement(statement.alternate); 951 } 952 }
119 function genIf (el: any): string { 120 el.ifProcessed = true // avoid recursion 121 return genIfConditions(el.ifConditions.slice()) 122 }