mirror of https://github.com/vuejs/core.git
wip: remove htmlMode
This commit is contained in:
parent
db085b4a79
commit
ec33e61e87
|
@ -17,10 +17,6 @@ export interface ErrorHandlingOptions {
|
||||||
export interface ParserOptions
|
export interface ParserOptions
|
||||||
extends ErrorHandlingOptions,
|
extends ErrorHandlingOptions,
|
||||||
CompilerCompatOptions {
|
CompilerCompatOptions {
|
||||||
/**
|
|
||||||
* Parse as HTML. Default: false
|
|
||||||
*/
|
|
||||||
htmlMode?: boolean
|
|
||||||
/**
|
/**
|
||||||
* e.g. platform native elements, e.g. `<div>` for browsers
|
* e.g. platform native elements, e.g. `<div>` for browsers
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,7 +40,6 @@ import {
|
||||||
} from './compat/compatConfig'
|
} from './compat/compatConfig'
|
||||||
|
|
||||||
type OptionalOptions =
|
type OptionalOptions =
|
||||||
| 'htmlMode'
|
|
||||||
| 'whitespace'
|
| 'whitespace'
|
||||||
| 'isNativeTag'
|
| 'isNativeTag'
|
||||||
| 'isBuiltInComponent'
|
| 'isBuiltInComponent'
|
||||||
|
|
|
@ -19,7 +19,6 @@ import { NO, extend } from '@vue/shared'
|
||||||
import { defaultOnError, defaultOnWarn } from '../errors'
|
import { defaultOnError, defaultOnWarn } from '../errors'
|
||||||
|
|
||||||
type OptionalOptions =
|
type OptionalOptions =
|
||||||
| 'htmlMode'
|
|
||||||
| 'getTextMode' // TODO
|
| 'getTextMode' // TODO
|
||||||
| 'whitespace'
|
| 'whitespace'
|
||||||
| 'isNativeTag'
|
| 'isNativeTag'
|
||||||
|
@ -59,7 +58,6 @@ let currentOptions: MergedParserOptions = defaultParserOptions
|
||||||
let currentRoot: RootNode = createRoot([])
|
let currentRoot: RootNode = createRoot([])
|
||||||
|
|
||||||
// parser state
|
// parser state
|
||||||
let htmlMode = false
|
|
||||||
let currentInput = ''
|
let currentInput = ''
|
||||||
let currentElement: ElementNode | null = null
|
let currentElement: ElementNode | null = null
|
||||||
let currentProp: AttributeNode | DirectiveNode | null = null
|
let currentProp: AttributeNode | DirectiveNode | null = null
|
||||||
|
@ -99,16 +97,7 @@ const tokenizer = new Tokenizer(
|
||||||
for (let index = 0; index <= pos; index++) {
|
for (let index = 0; index <= pos; index++) {
|
||||||
onCloseTag(stack.shift()!, end)
|
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()
|
reset()
|
||||||
currentInput = input
|
currentInput = input
|
||||||
currentOptions = extend({}, defaultParserOptions, options)
|
currentOptions = extend({}, defaultParserOptions, options)
|
||||||
htmlMode = !!currentOptions.htmlMode
|
|
||||||
const root = (currentRoot = createRoot([]))
|
const root = (currentRoot = createRoot([]))
|
||||||
tokenizer.parse(currentInput)
|
tokenizer.parse(currentInput)
|
||||||
root.children = condenseWhitespace(root.children)
|
root.children = condenseWhitespace(root.children)
|
||||||
|
|
Loading…
Reference in New Issue