File tree 2 files changed +20
-7
lines changed
2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,18 @@ h1 { color: red }
144
144
expect ( descriptor . template ! . content ) . toBe ( content )
145
145
} )
146
146
147
+ //#2566
148
+ test ( 'div lang should not be treated as plain text' , ( ) => {
149
+ const { errors } = parse ( `
150
+ <template lang="pug">
151
+ <div lang="">
152
+ <div></div>
153
+ </div>
154
+ </template>
155
+ ` )
156
+ expect ( errors . length ) . toBe ( 0 )
157
+ } )
158
+
147
159
test ( 'error tolerance' , ( ) => {
148
160
const { errors } = parse ( `<template>` )
149
161
expect ( errors . length ) . toBe ( 1 )
Original file line number Diff line number Diff line change @@ -115,13 +115,14 @@ export function parse(
115
115
if (
116
116
( ! parent && tag !== 'template' ) ||
117
117
// <template lang="xxx"> should also be treated as raw text
118
- props . some (
119
- p =>
120
- p . type === NodeTypes . ATTRIBUTE &&
121
- p . name === 'lang' &&
122
- p . value &&
123
- p . value . content !== 'html'
124
- )
118
+ ( tag === 'template' &&
119
+ props . some (
120
+ p =>
121
+ p . type === NodeTypes . ATTRIBUTE &&
122
+ p . name === 'lang' &&
123
+ p . value &&
124
+ p . value . content !== 'html'
125
+ ) )
125
126
) {
126
127
return TextModes . RAWTEXT
127
128
} else {
You can’t perform that action at this time.
0 commit comments