A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue-next/commit/048ac299f35709b25ae1bc1efa67d2abc53dbc3b below:

skip unncessary checks when parsing end tag · vuejs/core@048ac29 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+31

-17

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+31

-17

lines changed Original file line number Diff line number Diff line change

@@ -444,11 +444,21 @@ const isSpecialTemplateDirective = /*#__PURE__*/ makeMap(

444 444

/**

445 445

* Parse a tag (E.g. `<div id=a>`) with that type (start tag or end tag).

446 446

*/

447 +

function parseTag(

448 +

context: ParserContext,

449 +

type: TagType.Start,

450 +

parent: ElementNode | undefined

451 +

): ElementNode

452 +

function parseTag(

453 +

context: ParserContext,

454 +

type: TagType.End,

455 +

parent: ElementNode | undefined

456 +

): void

447 457

function parseTag(

448 458

context: ParserContext,

449 459

type: TagType,

450 460

parent: ElementNode | undefined

451 -

): ElementNode {

461 +

): ElementNode | undefined {

452 462

__TEST__ && assert(/^<\/?[a-z]/i.test(context.source))

453 463

__TEST__ &&

454 464

assert(

@@ -478,6 +488,7 @@ function parseTag(

478 488 479 489

// check v-pre

480 490

if (

491 +

type === TagType.Start &&

481 492

!context.inVPre &&

482 493

props.some(p => p.type === NodeTypes.DIRECTIVE && p.name === 'pre')

483 494

) {

@@ -489,6 +500,22 @@ function parseTag(

489 500

props = parseAttributes(context, type).filter(p => p.name !== 'v-pre')

490 501

}

491 502 503 +

// Tag close.

504 +

let isSelfClosing = false

505 +

if (context.source.length === 0) {

506 +

emitError(context, ErrorCodes.EOF_IN_TAG)

507 +

} else {

508 +

isSelfClosing = startsWith(context.source, '/>')

509 +

if (type === TagType.End && isSelfClosing) {

510 +

emitError(context, ErrorCodes.END_TAG_WITH_TRAILING_SOLIDUS)

511 +

}

512 +

advanceBy(context, isSelfClosing ? 2 : 1)

513 +

}

514 + 515 +

if (type === TagType.End) {

516 +

return

517 +

}

518 + 492 519

// warn v-if/v-for usage on the same element

493 520

if (__COMPAT__ && __DEV__ && !__TEST__) {

494 521

let hasIf = false

@@ -512,18 +539,6 @@ function parseTag(

512 539

}

513 540

}

514 541 515 -

// Tag close.

516 -

let isSelfClosing = false

517 -

if (context.source.length === 0) {

518 -

emitError(context, ErrorCodes.EOF_IN_TAG)

519 -

} else {

520 -

isSelfClosing = startsWith(context.source, '/>')

521 -

if (type === TagType.End && isSelfClosing) {

522 -

emitError(context, ErrorCodes.END_TAG_WITH_TRAILING_SOLIDUS)

523 -

}

524 -

advanceBy(context, isSelfClosing ? 2 : 1)

525 -

}

526 - 527 542

let tagType = ElementTypes.ELEMENT

528 543

const options = context.options

529 544

if (!context.inVPre && !options.isCustomElement(tag)) {

@@ -565,11 +580,10 @@ function parseTag(

565 580

tagType = ElementTypes.SLOT

566 581

} else if (

567 582

tag === 'template' &&

568 -

props.some(p => {

569 -

return (

583 +

props.some(

584 +

p =>

570 585

p.type === NodeTypes.DIRECTIVE && isSpecialTemplateDirective(p.name)

571 -

)

572 -

})

586 +

)

573 587

) {

574 588

tagType = ElementTypes.TEMPLATE

575 589

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4