@@ -220,7 +220,8 @@ CompilerProto.compile = function (node, root) {
220220 // special attributes to check
221221 var repeatExp ,
222222 componentId ,
223- partialId
223+ partialId ,
224+ customElementFn = utils . elements [ node . tagName . toLowerCase ( ) ]
224225
225226 // It is important that we access these attributes
226227 // procedurally because the order matters.
@@ -239,21 +240,16 @@ CompilerProto.compile = function (node, root) {
239240 compiler . bindDirective ( directive )
240241 }
241242
242- // sd-component has second highest priority
243- // and we preseve all other attributes as well.
243+ // custom elements has 2nd highest priority
244+ } else if ( customElementFn ) {
245+
246+ addChild ( customElementFn )
247+
248+ // sd-component has 3rd highest priority
244249 } else if ( ! root && ( componentId = utils . attr ( node , 'component' ) ) ) {
245250
246251 var ChildVM = compiler . getOption ( 'components' , componentId )
247- if ( ChildVM ) {
248- var child = new ChildVM ( {
249- el : node ,
250- child : true ,
251- compilerOptions : {
252- parentCompiler : compiler
253- }
254- } )
255- compiler . childCompilers . push ( child . $compiler )
256- }
252+ if ( ChildVM ) addChild ( ChildVM )
257253
258254 } else {
259255
@@ -279,6 +275,22 @@ CompilerProto.compile = function (node, root) {
279275 compiler . compileTextNode ( node )
280276
281277 }
278+
279+ function addChild ( Ctor ) {
280+ if ( utils . isConstructor ( Ctor ) ) {
281+ var child = new Ctor ( {
282+ el : node ,
283+ child : true ,
284+ compilerOptions : {
285+ parentCompiler : compiler
286+ }
287+ } )
288+ compiler . childCompilers . push ( child . $compiler )
289+ } else {
290+ // simply call the function
291+ Ctor ( node )
292+ }
293+ }
282294}
283295
284296/**
0 commit comments