Просмотр исходного кода

chore: document rationale for ignoring some parsing errors

Evan You 2 лет назад
Родитель
Сommit
6022ac05c4

+ 4 - 0
packages/compiler-core/__tests__/parse.spec.ts

@@ -2037,6 +2037,10 @@ describe('compiler: parse', () => {
   })
 
   describe('Errors', () => {
+    // HTML parsing errors as specified at
+    // https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
+    // We ignore some errors that do NOT affect parse result in meaningful ways
+    // but have non-trivial implementation cost.
     const patterns: {
       [key: string]: Array<{
         code: string

+ 0 - 1
packages/compiler-core/src/parser/index.ts

@@ -291,7 +291,6 @@ const tokenizer = new Tokenizer(stack, {
     if (currentElement && currentProp) {
       if (quote !== QuoteType.NoValue) {
         if (__BROWSER__ && currentAttrValue.includes('&')) {
-          // TODO should not do this in <script> or <style>
           currentAttrValue = currentOptions.decodeEntities!(
             currentAttrValue,
             true