问题
Why can't Aurelia deal with self-closing require
elements?
For example:
<require from="component"></require>
works
<require from="component"/>
doesn't work
No error is given, yet the entire template will fail if you try to use the self-closing element.
回答1:
According to the HTML specification, there are just a few void elements (elements that only have a start tag), which are:
area
,base
,br
,col
,embed
,hr
,img
,input
,keygen
,link
,meta
,param
,source
,track
,wbr
.https://www.w3.org/TR/html5/syntax.html#void-elements.
Aurelia uses the browser's native DOMParser, which means it follows the same set of standards.
来源:https://stackoverflow.com/questions/37300986/aurelia-self-closing-require-element-does-not-work