@@ -11,15 +11,23 @@ class Modal {
1111 if ( ! userVm ) {
1212 throw new Error ( 'Modal needs a VueModel.' )
1313 }
14- if ( ! userVm . el && ! userVm . template ) {
14+
15+ if ( userVm . nodeType ) {
16+ this . __customElement = userVm
17+ }
18+ else if ( ! userVm . template ) {
19+ console . error ( 'Error in Modal create object:' , userVm )
1520 throw new Error ( 'Modal needs a template.' )
1621 }
22+ else if ( userVm . el ) {
23+ console . error ( 'Error in Modal create object:' , userVm )
24+ throw new Error ( 'Specifying "el" property for VM in a Modal is forbidden' )
25+ }
1726
1827 let vm
19- this . __customElement = typeof userVm . el !== 'undefined'
2028
2129 if ( this . __customElement ) {
22- vm = userVm
30+ vm = { el : this . __customElement }
2331 }
2432 else {
2533 vm = Utils . extend ( true , userVm )
@@ -69,7 +77,7 @@ class Modal {
6977 this . $content . classList . add ( 'maximized' )
7078 }
7179
72- if ( this . __customElement ) {
80+ if ( this . closeWithBackdrop ) {
7381 this . $backdrop . addEventListener ( 'click' , this . close )
7482 }
7583
@@ -155,7 +163,7 @@ class Modal {
155163 }
156164
157165 this . $backdrop . classList . remove ( 'active' )
158- if ( this . __customElement ) {
166+ if ( this . closeWithBackdrop ) {
159167 this . $backdrop . removeEventListener ( 'click' , this . close )
160168 }
161169 if ( ! Platform . within . iframe ) {
0 commit comments