wip: remove htmlMode

This commit is contained in:
Evan You 2023-11-15 19:15:04 +08:00
parent db085b4a79
commit ec33e61e87
3 changed files with 0 additions and 17 deletions

View File

@ -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
*/

View File

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

View File

@ -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)