Playground for exploring how the Vue template compiler compiles your template.
vuejs / vue-template-explorer Goto Github PK
View Code? Open in Web Editor NEWVue template compilation explorer
Vue template compilation explorer
Playground for exploring how the Vue template compiler compiles your template.
准确来说是Vue2.6对应的版本
Uncaught TypeError: Cannot convert undefined or null to object
at window.init (template-explorer.global.js:37884)
at Function.t._invokeFactory (loader.js:1036)
at t.complete (loader.js:1046)
at s._onModuleComplete (loader.js:1663)
at s._onModuleComplete (loader.js:1675)
at s._onModuleComplete (loader.js:1675)
at s._onModuleComplete (loader.js:1675)
at s._onModuleComplete (loader.js:1675)
at s._onModuleComplete (loader.js:1675)
at s._onModuleComplete (loader.js:1675)
<div>
<textarea><br /></textarea>
<Textarea><br /></Textarea>
<Style><br /></Style>
<Script><br /></Script>
<component is="textarea"><br /></component>
<component is="Textarea"><br /></component>
<component is="style"><br /></component>
<component is="Style"><br /></component>
<component is="script"><br /></component>
<component is="Script"><br /></component>
</div>
预览编译结果:
function render () {
with ( this ) {
return _c('div', [
_c('textarea', [_v('<br />')]),
_c('Textarea', [_v('<br />')]),
_c('Style', [_v('<br />')]),
_c('Script', [_v('<br />')]),
_c('textarea', { tag: 'component' }, [_c('br')]),
_c('Textarea', { tag: 'component' }, [_c('br')]),
_c('style', { tag: 'component' }, [_c('br')]),
_c('Style', { tag: 'component' }, [_c('br')]),
_c('script', { tag: 'component' }, [_c('br')]),
_c('Script', { tag: 'component' }, [_c('br')])
], 1);
}
}
实际编译结果:
function anonymous () {
with ( this ) {
return _c('div', [
_c('textarea'),
_v(' '),
_c('Textarea'),
_v(' '),
_c('Style'),
_v(' '),
_c('Script'),
_v(' '),
_c('textarea', { tag: 'component' }, [_c('br')]),
_v(' '),
_c('Textarea', { tag: 'component' }, [_c('br')]),
_v(' '),
_c('style', { tag: 'component' }, [_c('br')]),
_v(' '),
_c('Style', { tag: 'component' }, [_c('br')]),
_v(' '),
_c('script', { tag: 'component' }, [_c('br')]),
_v(' '),
_c('Script', { tag: 'component' }, [_c('br')])
], 1);
}
}
这里列举了三个会被特殊对待的标签(先忽略空白处理问题),主要谈论的是 <textarea>
<style>
<script>
标签及其大小写变种组件中 HTML 标记处理问题:
<textarea>
等标签内的标签进行剔除,这似乎不是在模拟原生行为?<title>
标签和 <textarea>
标签都属于 escapable raw text elements,而 <style>
<script>
标签属于 raw text elements,但在引擎编译结果中,似乎 <title>
被完全当作普通元素对待,而实际上它是不能包含子节点的,如何理解这种行为?非常感谢!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.