@@ -10,7 +10,8 @@ import {hasColon, splitByColon} from './utils/string-ops.js'
1010
1111const typeValid = obj => [ 'number' , 'boolean' , 'string' ] . indexOf ( typeof obj ) > - 1
1212
13- const createByTag = ( { tagType, tagName, tagContent, attrs, namespace} ) => {
13+ // eslint-disable-next-line max-params
14+ const createByTag = ( tagType , tagName , tagContent , attrs , namespace ) => {
1415 switch ( tagType ) {
1516 case 'string' : {
1617 if ( tagName === tagContent && attrs && attrs . is && typeof attrs . is === 'string' ) {
@@ -44,8 +45,9 @@ const createByTag = ({tagType, tagName, tagContent, attrs, namespace}) => {
4445 }
4546}
4647
47- const getElement = ( { tagType, tagName, tagContent, attrs, ref, refs, namespace} ) => {
48- const element = createByTag ( { tagType, tagName, tagContent, attrs, namespace} )
48+ // eslint-disable-next-line max-params
49+ const getElement = ( tagType , tagName , tagContent , attrs , ref , refs , namespace ) => {
50+ const element = createByTag ( tagType , tagName , tagContent , attrs , namespace )
4951 if ( ref ) Object . defineProperty ( refs , ref , {
5052 value : element ,
5153 enumerable : true
@@ -59,7 +61,7 @@ const getVal = (dataNode, key) => {
5961 return data
6062}
6163
62- const regTmpl = ( ctx , { val, handler} ) => {
64+ const regTmpl = ( ctx , val , handler ) => {
6365 if ( ARR . isArray ( val ) ) {
6466 const [ strs , ...exprs ] = val
6567
@@ -99,7 +101,8 @@ const regTmpl = (ctx, {val, handler}) => {
99101 return ( ) => val
100102}
101103
102- const applyEventListener = ( { element, custom, handler, trigger : { l, s, i, p, h, a, c, t, u, e, o, k} } ) => {
104+ // eslint-disable-next-line max-params
105+ const applyEventListener = ( element , custom , handler , { l, s, i, p, h, a, c, t, u, e, o, k} ) => {
103106
104107 /*
105108 * l: listener : string
@@ -189,7 +192,8 @@ const applyEventListener = ({element, custom, handler, trigger: {l, s, i, p, h,
189192 element [ addListener ] ( l , eventHandler , eventOptions )
190193}
191194
192- const addValListener = ( ctx , { trigger, updateLock, element, lastNode, key, expr, custom} ) => {
195+ // eslint-disable-next-line max-params
196+ const addValListener = ( ctx , trigger , updateLock , element , lastNode , key , expr , custom ) => {
193197 const addListener = custom && '$on' || 'addEventListener'
194198 const { parentNode, _key} = initBinding ( ctx , { bind : expr } )
195199
@@ -206,7 +210,7 @@ const addValListener = (ctx, {trigger, updateLock, element, lastNode, key, expr,
206210 }
207211
208212 if ( trigger ) {
209- applyEventListener ( { element, custom, handler, trigger} )
213+ applyEventListener ( element , custom , handler , trigger )
210214 } else if ( key === 'value' ) {
211215 // Listen to input, keyup and change events in order to work in most browsers.
212216 element [ addListener ] ( 'input' , handler , eventOptions )
@@ -268,7 +272,8 @@ const getAttrHandler = (ctx, {element, key, custom}) => {
268272 }
269273}
270274
271- const addAttr = ( ctx , { element, attr, key, custom} ) => {
275+ // eslint-disable-next-line max-params
276+ const addAttr = ( ctx , element , attr , key , custom ) => {
272277 if ( typeValid ( attr ) ) {
273278 if ( custom ) {
274279 if ( attr === '' ) {
@@ -293,10 +298,11 @@ const addAttr = (ctx, {element, attr, key, custom}) => {
293298 }
294299
295300 const handler = getAttrHandler ( ctx , { element, key, custom} )
296- regTmpl ( ctx , { val : attr , handler} )
301+ regTmpl ( ctx , attr , handler )
297302}
298303
299- const addProp = ( ctx , { element, propPath, value, trigger, updateOnly, custom} ) => {
304+ // eslint-disable-next-line max-params
305+ const addProp = ( ctx , element , value , propPath , trigger , updateOnly , custom ) => {
300306 const keyPath = ARR . copy ( propPath )
301307 const lastKey = keyPath . pop ( )
302308 if ( custom ) keyPath . unshift ( '$data' )
@@ -319,27 +325,28 @@ const addProp = (ctx, {element, propPath, value, trigger, updateOnly, custom}) =
319325 }
320326 }
321327
322- regTmpl ( ctx , { val : value , handler} )
328+ regTmpl ( ctx , value , handler )
323329 if (
324330 trigger ||
325331 ( propPath . length === 1 && ( lastKey === 'value' || lastKey === 'checked' ) ) &&
326332 ! value [ 0 ]
327333 ) {
328- addValListener ( ctx , { trigger, updateLock, element, lastNode, key : lastKey , expr : value [ 1 ] , custom} )
334+ addValListener ( ctx , trigger , updateLock , element , lastNode , lastKey , value [ 1 ] , custom )
329335 }
330336 }
331337}
332338
333339const rawHandler = val => val
334340
335- const addEvent = ( ctx , { element, trigger, custom} ) => {
341+ // eslint-disable-next-line max-params
342+ const addEvent = ( ctx , element , trigger , custom ) => {
336343
337344 /*
338345 * m: method : string
339346 * v: value : string/array/undefined
340347 */
341348 const { m, v} = trigger
342- const _handler = regTmpl ( ctx , { val : v , ctx , handler : rawHandler } )
349+ const _handler = regTmpl ( ctx , v , rawHandler )
343350
344351 const callEventHandler = ( event ) => {
345352 const value = _handler ( )
@@ -351,10 +358,11 @@ const addEvent = (ctx, {element, trigger, custom}) => {
351358 }
352359 }
353360
354- applyEventListener ( { element, custom, handler : callEventHandler , trigger} )
361+ applyEventListener ( element , custom , callEventHandler , trigger )
355362}
356363
357- const createElement = ( ctx , { info, namespace, fragment, custom} ) => {
364+ // eslint-disable-next-line max-params
365+ const createElement = ( ctx , info , namespace , fragment , custom ) => {
358366 if ( fragment ) return [ new EFFragment ( ) , 'fragment' ]
359367
360368 /*
@@ -368,10 +376,10 @@ const createElement = (ctx, {info, namespace, fragment, custom}) => {
368376 const tagName = t
369377 const tagContent = ctx . scope [ t ] || t
370378 const tagType = typeof tagContent
371- const element = getElement ( { tagType, tagName, tagContent, attrs : a , ref : r , refs : ctx . refs , namespace} )
372- if ( a ) for ( let key in a ) addAttr ( ctx , { element, custom , attr : a [ key ] , key} )
373- if ( p ) for ( let [ propPath , value , trigger , updateOnly ] of p ) addProp ( ctx , { element, custom , value, propPath, trigger, updateOnly} )
374- if ( e ) for ( let trigger of e ) addEvent ( ctx , { element, custom , trigger } )
379+ const element = getElement ( tagType , tagName , tagContent , a , r , ctx . refs , namespace )
380+ if ( a ) for ( let key in a ) addAttr ( ctx , element , a [ key ] , key , custom )
381+ if ( p ) for ( let [ propPath , value , trigger , updateOnly ] of p ) addProp ( ctx , element , value , propPath , trigger , updateOnly , custom )
382+ if ( e ) for ( let trigger of e ) addEvent ( ctx , element , trigger , custom )
375383
376384 return [ element , tagType ]
377385}
0 commit comments