Browse Source

wip: remove htmlMode

pull/9689/head
Evan You 2 years ago
parent
commit
ec33e61e87
  1. 4
      packages/compiler-core/src/options.ts
  2. 1
      packages/compiler-core/src/parse.ts
  3. 12
      packages/compiler-core/src/parser/index.ts

4
packages/compiler-core/src/options.ts

@ -17,10 +17,6 @@ export interface ErrorHandlingOptions {
export interface ParserOptions
extends ErrorHandlingOptions,
CompilerCompatOptions {
/**
* Parse as HTML. Default: false
*/
htmlMode?: boolean
/**
* e.g. platform native elements, e.g. `<div>` for browsers
*/

1
packages/compiler-core/src/parse.ts

@ -40,7 +40,6 @@ import {
} from './compat/compatConfig'
type OptionalOptions =
| 'htmlMode'
| 'whitespace'
| 'isNativeTag'
| 'isBuiltInComponent'

12
packages/compiler-core/src/parser/index.ts

@ -19,7 +19,6 @@ import { NO, extend } from '@vue/shared'
import { defaultOnError, defaultOnWarn } from '../errors'
type OptionalOptions =
| 'htmlMode'
| 'getTextMode' // TODO
| 'whitespace'
| 'isNativeTag'
@ -59,7 +58,6 @@ let currentOptions: MergedParserOptions = defaultParserOptions
let currentRoot: RootNode = createRoot([])
// parser state
let htmlMode = false
let currentInput = ''
let currentElement: ElementNode | null = null
let currentProp: AttributeNode | DirectiveNode | null = null
@ -99,16 +97,7 @@ const tokenizer = new Tokenizer(
for (let index = 0; index <= pos; index++) {
onCloseTag(stack.shift()!, end)
}
} else if (htmlMode && name === 'p') {
// Implicit open before close
emitOpenTag('p', start)
closeCurrentTag(end)
}
} else if (htmlMode && name === 'br') {
// TODO
// We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.
// this.cbs.onopentag?.('br', {}, true)
// this.cbs.onclosetag?.('br', false)
}
},
@ -420,7 +409,6 @@ export function baseParse(input: string, options?: ParserOptions): RootNode {
reset()
currentInput = input
currentOptions = extend({}, defaultParserOptions, options)
htmlMode = !!currentOptions.htmlMode
const root = (currentRoot = createRoot([]))
tokenizer.parse(currentInput)
root.children = condenseWhitespace(root.children)

Loading…
Cancel
Save