File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -110,19 +110,24 @@ const registry = {
110
110
*/
111
111
const $el = $ ( el ) ;
112
112
const pattern = registry . patterns [ name ] ;
113
- if ( pattern . init ) {
114
- const plog = logging . getLogger ( `pat.${ name } ` ) ;
115
- if ( $el . is ( pattern . trigger ) ) {
116
- plog . debug ( "Initialising." , $el ) ;
117
- try {
113
+ const plog = logging . getLogger ( `pat.${ name } ` ) ;
114
+ if ( el . matches ( pattern . trigger ) ) {
115
+ plog . debug ( "Initialising." , el ) ;
116
+ try {
117
+ if ( pattern . init ) {
118
+ // old style initialisation
118
119
pattern . init ( $el , null , trigger ) ;
119
- plog . debug ( "done." ) ;
120
- } catch ( e ) {
121
- if ( dont_catch ) {
122
- throw e ;
123
- }
124
- plog . error ( "Caught error:" , e ) ;
120
+ } else {
121
+ // class based pattern initialisation
122
+ new pattern ( $el , null , trigger ) ;
123
+ }
124
+
125
+ plog . debug ( "done." ) ;
126
+ } catch ( e ) {
127
+ if ( dont_catch ) {
128
+ throw e ;
125
129
}
130
+ plog . error ( "Caught error:" , e ) ;
126
131
}
127
132
}
128
133
} ,
You can’t perform that action at this time.
0 commit comments