@@ -45,10 +45,6 @@ var isBuiltInTag = makeMap('slot,component', true);
45
45
*/
46
46
47
47
48
- /**
49
- * Check whether the object has the property.
50
- */
51
- var hasOwnProperty = Object . prototype . hasOwnProperty ;
52
48
53
49
54
50
/**
@@ -68,7 +64,7 @@ function cached (fn) {
68
64
}
69
65
70
66
/**
71
- * Camelize a hyphen-delmited string.
67
+ * Camelize a hyphen-delimited string.
72
68
*/
73
69
var camelizeRE = / - ( \w ) / g;
74
70
var camelize = cached ( function ( str ) {
@@ -80,10 +76,6 @@ var camelize = cached(function (str) {
80
76
*/
81
77
82
78
83
- /**
84
- * Hyphenate a camelCase string.
85
- */
86
- var hyphenateRE = / ( [ ^ - ] ) ( [ A - Z ] ) / g;
87
79
88
80
89
81
/**
@@ -113,12 +105,6 @@ function extend (to, _from) {
113
105
*/
114
106
115
107
116
- /**
117
- * Strict object type check. Only returns true
118
- * for plain JavaScript objects.
119
- */
120
- var toString = Object . prototype . toString ;
121
- var OBJECT_STRING = '[object Object]' ;
122
108
123
109
124
110
/**
@@ -354,22 +340,6 @@ var IS_REGEX_CAPTURING_BROKEN = false;
354
340
355
341
// Special Elements (can contain anything)
356
342
var isScriptOrStyle = makeMap ( 'script,style' , true ) ;
357
- var hasLang = function ( attr ) { return attr . name === 'lang' && attr . value !== 'html' ; } ;
358
- var isSpecialTag = function ( tag , isSFC , stack ) {
359
- if ( isScriptOrStyle ( tag ) ) {
360
- return true
361
- }
362
- if ( isSFC && stack . length === 1 ) {
363
- // top-level template that has no pre-processor
364
- if ( tag === 'template' && ! stack [ 0 ] . attrs . some ( hasLang ) ) {
365
- return false
366
- } else {
367
- return true
368
- }
369
- }
370
- return false
371
- } ;
372
-
373
343
var reCache = { } ;
374
344
375
345
var ltRE = / & l t ; / g;
@@ -398,7 +368,7 @@ function parseHTML (html, options) {
398
368
while ( html ) {
399
369
last = html ;
400
370
// Make sure we're not in a script or style element
401
- if ( ! lastTag || ! isSpecialTag ( lastTag , options . sfc , stack ) ) {
371
+ if ( ! lastTag || ! isScriptOrStyle ( lastTag ) ) {
402
372
var textEnd = html . indexOf ( '<' ) ;
403
373
if ( textEnd === 0 ) {
404
374
// Comment:
@@ -433,7 +403,7 @@ function parseHTML (html, options) {
433
403
if ( endTagMatch ) {
434
404
var curIndex = index ;
435
405
advance ( endTagMatch [ 0 ] . length ) ;
436
- parseEndTag ( endTagMatch [ 0 ] , endTagMatch [ 1 ] , curIndex , index ) ;
406
+ parseEndTag ( endTagMatch [ 1 ] , curIndex , index ) ;
437
407
continue
438
408
}
439
409
@@ -490,7 +460,7 @@ function parseHTML (html, options) {
490
460
} ) ;
491
461
index += html . length - rest . length ;
492
462
html = rest ;
493
- parseEndTag ( '</' + stackedTag + '>' , stackedTag , index - endTagLength , index ) ;
463
+ parseEndTag ( stackedTag , index - endTagLength , index ) ;
494
464
}
495
465
496
466
if ( html === last && options . chars ) {
@@ -536,10 +506,10 @@ function parseHTML (html, options) {
536
506
537
507
if ( expectHTML ) {
538
508
if ( lastTag === 'p' && isNonPhrasingTag ( tagName ) ) {
539
- parseEndTag ( '' , lastTag ) ;
509
+ parseEndTag ( lastTag ) ;
540
510
}
541
511
if ( canBeLeftOpenTag ( tagName ) && lastTag === tagName ) {
542
- parseEndTag ( '' , tagName ) ;
512
+ parseEndTag ( tagName ) ;
543
513
}
544
514
}
545
515
@@ -566,7 +536,7 @@ function parseHTML (html, options) {
566
536
}
567
537
568
538
if ( ! unary ) {
569
- stack . push ( { tag : tagName , attrs : attrs } ) ;
539
+ stack . push ( { tag : tagName , lowerCasedTag : tagName . toLowerCase ( ) , attrs : attrs } ) ;
570
540
lastTag = tagName ;
571
541
unarySlash = '' ;
572
542
}
@@ -576,16 +546,19 @@ function parseHTML (html, options) {
576
546
}
577
547
}
578
548
579
- function parseEndTag ( tag , tagName , start , end ) {
580
- var pos ;
549
+ function parseEndTag ( tagName , start , end ) {
550
+ var pos , lowerCasedTagName ;
581
551
if ( start == null ) { start = index ; }
582
552
if ( end == null ) { end = index ; }
583
553
554
+ if ( tagName ) {
555
+ lowerCasedTagName = tagName . toLowerCase ( ) ;
556
+ }
557
+
584
558
// Find the closest opened tag of the same type
585
559
if ( tagName ) {
586
- var needle = tagName . toLowerCase ( ) ;
587
560
for ( pos = stack . length - 1 ; pos >= 0 ; pos -- ) {
588
- if ( stack [ pos ] . tag . toLowerCase ( ) === needle ) {
561
+ if ( stack [ pos ] . lowerCasedTag === lowerCasedTagName ) {
589
562
break
590
563
}
591
564
}
@@ -605,11 +578,11 @@ function parseHTML (html, options) {
605
578
// Remove the open elements from the stack
606
579
stack . length = pos ;
607
580
lastTag = pos && stack [ pos - 1 ] . tag ;
608
- } else if ( tagName . toLowerCase ( ) === 'br' ) {
581
+ } else if ( lowerCasedTagName === 'br' ) {
609
582
if ( options . start ) {
610
583
options . start ( tagName , [ ] , true , start , end ) ;
611
584
}
612
- } else if ( tagName . toLowerCase ( ) === 'p' ) {
585
+ } else if ( lowerCasedTagName === 'p' ) {
613
586
if ( options . start ) {
614
587
options . start ( tagName , [ ] , false , start , end ) ;
615
588
}
@@ -719,7 +692,7 @@ function wrapFilter (exp, filter) {
719
692
/* */
720
693
721
694
var defaultTagRE = / \{ \{ ( (?: .| \n ) + ?) \} \} / g;
722
- var regexEscapeRE = / [ - . * + ? ^ $ { } ( ) | [ \] / \\ ] / g;
695
+ var regexEscapeRE = / [ - . * + ? ^ $ { } ( ) | [ \] \ /\\ ] / g;
723
696
724
697
var buildRegex = cached ( function ( delimiters ) {
725
698
var open = delimiters [ 0 ] . replace ( regexEscapeRE , '\\$&' ) ;
@@ -1516,7 +1489,7 @@ function processAttrs (el) {
1516
1489
name = camelize ( name ) ;
1517
1490
}
1518
1491
}
1519
- if ( isProp || platformMustUseProp ( el . tag , name ) ) {
1492
+ if ( isProp || platformMustUseProp ( el . tag , el . attrsMap . type , name ) ) {
1520
1493
addProp ( el , name , value ) ;
1521
1494
} else {
1522
1495
addAttr ( el , name , value ) ;
@@ -1550,15 +1523,6 @@ function processAttrs (el) {
1550
1523
}
1551
1524
}
1552
1525
addAttr ( el , name , JSON . stringify ( value ) ) ;
1553
- // #4530 also bind special attributes as props even if they are static
1554
- // so that patches between dynamic/static are consistent
1555
- if ( platformMustUseProp ( el . tag , name ) ) {
1556
- if ( name === 'value' ) {
1557
- addProp ( el , name , JSON . stringify ( value ) ) ;
1558
- } else {
1559
- addProp ( el , name , 'true' ) ;
1560
- }
1561
- }
1562
1526
}
1563
1527
}
1564
1528
}
@@ -2135,25 +2099,28 @@ function getNormalizationType (children) {
2135
2099
var res = 0 ;
2136
2100
for ( var i = 0 ; i < children . length ; i ++ ) {
2137
2101
var el = children [ i ] ;
2102
+ if ( el . type !== 1 ) {
2103
+ continue
2104
+ }
2138
2105
if ( needsNormalization ( el ) ||
2139
- ( el . if && el . ifConditions . some ( function ( c ) { return needsNormalization ( c . block ) ; } ) ) ) {
2106
+ ( el . ifConditions && el . ifConditions . some ( function ( c ) { return needsNormalization ( c . block ) ; } ) ) ) {
2140
2107
res = 2 ;
2141
2108
break
2142
2109
}
2143
2110
if ( maybeComponent ( el ) ||
2144
- ( el . if && el . ifConditions . some ( function ( c ) { return maybeComponent ( c . block ) ; } ) ) ) {
2111
+ ( el . ifConditions && el . ifConditions . some ( function ( c ) { return maybeComponent ( c . block ) ; } ) ) ) {
2145
2112
res = 1 ;
2146
2113
}
2147
2114
}
2148
2115
return res
2149
2116
}
2150
2117
2151
2118
function needsNormalization ( el ) {
2152
- return el . for || el . tag === 'template' || el . tag === 'slot'
2119
+ return el . for !== undefined || el . tag === 'template' || el . tag === 'slot'
2153
2120
}
2154
2121
2155
2122
function maybeComponent ( el ) {
2156
- return el . type === 1 && ! isPlatformReservedTag$1 ( el . tag )
2123
+ return ! isPlatformReservedTag$1 ( el . tag )
2157
2124
}
2158
2125
2159
2126
function genNode ( node ) {
0 commit comments