Skip to content

Commit

Permalink
fix: getTextMode signature chage
Browse files Browse the repository at this point in the history
  • Loading branch information
rigor789 committed May 17, 2020
1 parent 7ae8a2e commit f309a4e
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions packages/compiler/src/parserOptions.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import {
ElementNode,
isBuiltInType,
Namespaces,
ParserOptions,
TextModes
TextModes,
} from '@vue/compiler-core'
// import { makeMap } from '@vue/shared'
// import { isKnownView } from '@nativescript-vue/runtime'
import { decodeHtml } from './decodeHtml'
import { ACTION_BAR, TRANSITION, TRANSITION_GROUP } from './runtimeHelpers'

// const isRawTextContainer = /*#__PURE__*/ makeMap('style,script', true)

export const enum DOMNamespaces {
HTML = Namespaces.HTML
HTML = Namespaces.HTML,
}

const isBuiltInComponent = (tag: string): symbol | undefined => {
Expand All @@ -28,30 +23,20 @@ const isBuiltInComponent = (tag: string): symbol | undefined => {

export const parserOptions: ParserOptions = {
// We don't have void tags in NativeScript (<br>, <hr> etc.)
isVoidTag: tag => false,
isNativeTag: tag => false,
isPreTag: tag => tag === 'pre',
isVoidTag: () => false,
isNativeTag: () => false,
isPreTag: (tag) => tag === 'pre',
isBuiltInComponent,
decodeEntities: decodeHtml,
// todo: we might add support for different namespaces in the future
// for example - it would be neat to be able to write inline svg
// with the svg plugin?
getNamespace(tag: string, parent: ElementNode | undefined): DOMNamespaces {
getNamespace() {
return DOMNamespaces.HTML
},

// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
getTextMode(tag: string, ns: DOMNamespaces): TextModes {
getTextMode() {
return TextModes.DATA
// // todo: look into if any of this would be useful in ns
// if (ns === DOMNamespaces.HTML) {
// if (tag === 'textarea' || tag === 'title') {
// return TextModes.RCDATA
// }
// if (isRawTextContainer(tag)) {
// return TextModes.RAWTEXT
// }
// }
// return TextModes.DATA
}
},
}

0 comments on commit f309a4e

Please sign in to comment.