feat(custom-elements): automatically respect custom elements when compiling in browser
This commit is contained in:
parent
c3465c1e88
commit
9f8f07ed38
@ -44,9 +44,7 @@ function compileToFunction(
|
|||||||
template = el ? el.innerHTML : ``
|
template = el ? el.innerHTML : ``
|
||||||
}
|
}
|
||||||
|
|
||||||
const { code } = compile(
|
const opts = extend(
|
||||||
template,
|
|
||||||
extend(
|
|
||||||
{
|
{
|
||||||
hoistStatic: true,
|
hoistStatic: true,
|
||||||
onError: __DEV__ ? onError : undefined,
|
onError: __DEV__ ? onError : undefined,
|
||||||
@ -54,7 +52,12 @@ function compileToFunction(
|
|||||||
} as CompilerOptions,
|
} as CompilerOptions,
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
if (!opts.isCustomElement && typeof customElements !== 'undefined') {
|
||||||
|
opts.isCustomElement = tag => !!customElements.get(tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { code } = compile(template, opts)
|
||||||
|
|
||||||
function onError(err: CompilerError, asWarning = false) {
|
function onError(err: CompilerError, asWarning = false) {
|
||||||
const message = asWarning
|
const message = asWarning
|
||||||
|
Loading…
Reference in New Issue
Block a user