|
|
@@ -44,18 +44,21 @@ function compileToFunction(
|
|
|
template = el ? el.innerHTML : ``
|
|
|
}
|
|
|
|
|
|
- const { code } = compile(
|
|
|
- template,
|
|
|
- extend(
|
|
|
- {
|
|
|
- hoistStatic: true,
|
|
|
- onError: __DEV__ ? onError : undefined,
|
|
|
- onWarn: __DEV__ ? e => onError(e, true) : NOOP
|
|
|
- } as CompilerOptions,
|
|
|
- options
|
|
|
- )
|
|
|
+ const opts = extend(
|
|
|
+ {
|
|
|
+ hoistStatic: true,
|
|
|
+ onError: __DEV__ ? onError : undefined,
|
|
|
+ onWarn: __DEV__ ? e => onError(e, true) : NOOP
|
|
|
+ } as CompilerOptions,
|
|
|
+ options
|
|
|
)
|
|
|
|
|
|
+ if (!opts.isCustomElement && typeof customElements !== 'undefined') {
|
|
|
+ opts.isCustomElement = tag => !!customElements.get(tag)
|
|
|
+ }
|
|
|
+
|
|
|
+ const { code } = compile(template, opts)
|
|
|
+
|
|
|
function onError(err: CompilerError, asWarning = false) {
|
|
|
const message = asWarning
|
|
|
? err.message
|