perf(core): use startsWith instead of indexOf (#989)
				
					
				
			This commit is contained in:
		
							parent
							
								
									9e26be2c26
								
							
						
					
					
						commit
						054ccecd58
					
				@ -73,7 +73,7 @@ export function emit(
 | 
				
			|||||||
  let handler = props[`on${capitalize(event)}`]
 | 
					  let handler = props[`on${capitalize(event)}`]
 | 
				
			||||||
  // for v-model update:xxx events, also trigger kebab-case equivalent
 | 
					  // for v-model update:xxx events, also trigger kebab-case equivalent
 | 
				
			||||||
  // for props passed via kebab-case
 | 
					  // for props passed via kebab-case
 | 
				
			||||||
  if (!handler && event.indexOf('update:') === 0) {
 | 
					  if (!handler && event.startsWith('update:')) {
 | 
				
			||||||
    event = hyphenate(event)
 | 
					    event = hyphenate(event)
 | 
				
			||||||
    handler = props[`on${capitalize(event)}`]
 | 
					    handler = props[`on${capitalize(event)}`]
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ export function patchAttr(
 | 
				
			|||||||
  value: any,
 | 
					  value: any,
 | 
				
			||||||
  isSVG: boolean
 | 
					  isSVG: boolean
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
  if (isSVG && key.indexOf('xlink:') === 0) {
 | 
					  if (isSVG && key.startsWith('xlink:')) {
 | 
				
			||||||
    if (value == null) {
 | 
					    if (value == null) {
 | 
				
			||||||
      el.removeAttributeNS(xlinkNS, key.slice(6, key.length))
 | 
					      el.removeAttributeNS(xlinkNS, key.slice(6, key.length))
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,7 @@ export const patchProp: RendererOptions<Node, Element>['patchProp'] = (
 | 
				
			|||||||
    default:
 | 
					    default:
 | 
				
			||||||
      if (isOn(key)) {
 | 
					      if (isOn(key)) {
 | 
				
			||||||
        // ignore v-model listeners
 | 
					        // ignore v-model listeners
 | 
				
			||||||
        if (key.indexOf('onUpdate:') < 0) {
 | 
					        if (!key.startsWith('onUpdate:')) {
 | 
				
			||||||
          patchEvent(el, key, prevValue, nextValue, parentComponent)
 | 
					          patchEvent(el, key, prevValue, nextValue, parentComponent)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      } else if (
 | 
					      } else if (
 | 
				
			||||||
 | 
				
			|||||||
@ -29,7 +29,7 @@ export function stringifyStyle(
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  for (const key in styles) {
 | 
					  for (const key in styles) {
 | 
				
			||||||
    const value = styles[key]
 | 
					    const value = styles[key]
 | 
				
			||||||
    const normalizedKey = key.indexOf(`--`) === 0 ? key : hyphenate(key)
 | 
					    const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key)
 | 
				
			||||||
    if (
 | 
					    if (
 | 
				
			||||||
      isString(value) ||
 | 
					      isString(value) ||
 | 
				
			||||||
      (typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))
 | 
					      (typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user