@@ -28,17 +28,14 @@ import {
2828 QSlotParent ,
2929 QBackRefs ,
3030 QTemplate ,
31- Q_PREFIX ,
32- dangerouslySetInnerHTML ,
31+ HANDLER_PREFIX ,
3332} from '../shared/utils/markers' ;
3433import { isPromise } from '../shared/utils/promises' ;
3534import { type ValueOrPromise } from '../shared/utils/types' ;
3635import {
3736 convertEventNameFromJsxPropToHtmlAttr ,
3837 getEventNameFromJsxProp ,
3938 getEventNameScopeFromJsxProp ,
40- isHtmlAttributeAnEventName ,
41- isJsxPropertyAnEventName ,
4239} from '../shared/utils/event-names' ;
4340import { ChoreType } from '../shared/util-chore-type' ;
4441import { hasClassAttr } from '../shared/utils/scoped-styles' ;
@@ -92,9 +89,13 @@ import { EffectProperty, isSignal, SubscriptionData } from '../signal/signal';
9289import type { Signal } from '../signal/signal.public' ;
9390import { executeComponent } from '../shared/component-execution' ;
9491import {
92+ StaticPropId ,
9593 getPropId ,
9694 getPropName ,
9795 getSlotName ,
96+ isEventProp ,
97+ isHandlerProp ,
98+ isQProp ,
9899 isSlotProp ,
99100 type NumericPropKey ,
100101} from '../shared/utils/prop' ;
@@ -618,9 +619,9 @@ export const vnode_diff = (
618619 // We never tell the vNode about them saving us time and memory.
619620 for ( const key in constProps ) {
620621 let value = constProps [ key as unknown as NumericPropKey ] ;
621- const numericKey = key as unknown as NumericPropKey ;
622+ const numericKey = Number ( key ) as NumericPropKey ;
622623 const nameKey = getPropName ( numericKey ) ;
623- if ( isJsxPropertyAnEventName ( nameKey ) ) {
624+ if ( isEventProp ( numericKey ) ) {
624625 // So for event handlers we must add them to the vNode so that qwikloader can look them up
625626 // But we need to mark them so that they don't get pulled into the diff.
626627 const eventName = getEventNameFromJsxProp ( nameKey ) ;
@@ -648,7 +649,7 @@ export const vnode_diff = (
648649 continue ;
649650 }
650651
651- if ( nameKey === 'ref' ) {
652+ if ( numericKey === StaticPropId . REF ) {
652653 if ( isSignal ( value ) ) {
653654 value . value = element ;
654655 continue ;
@@ -676,13 +677,13 @@ export const vnode_diff = (
676677 ) ;
677678 }
678679
679- if ( nameKey === dangerouslySetInnerHTML ) {
680+ if ( numericKey === StaticPropId . INNERHTML ) {
680681 element . innerHTML = value as string ;
681682 element . setAttribute ( QContainerAttr , QContainerValue . HTML ) ;
682683 continue ;
683684 }
684685
685- if ( elementName === 'textarea' && nameKey === 'value' ) {
686+ if ( elementName === 'textarea' && numericKey === StaticPropId . VALUE ) {
686687 if ( value && typeof value !== 'string' ) {
687688 if ( isDev ) {
688689 throw qError ( QError . wrongTextareaValue , [ currentFile , value ] ) ;
@@ -764,11 +765,11 @@ export const vnode_diff = (
764765 for ( const key in props ) {
765766 const value = props [ key as unknown as NumericPropKey ] ;
766767 if ( value != null ) {
767- mapArray_set ( jsxAttrs , key as unknown as NumericPropKey , value , 0 ) ;
768+ mapArray_set ( jsxAttrs , Number ( key ) as NumericPropKey , value , 0 ) ;
768769 }
769770 }
770771 if ( jsxKey !== null ) {
771- mapArray_set ( jsxAttrs , getPropId ( ELEMENT_KEY ) , jsxKey , 0 ) ;
772+ mapArray_set ( jsxAttrs , StaticPropId . ELEMENT_KEY as NumericPropKey , jsxKey , 0 ) ;
772773 }
773774 const vNode = ( vNewNode || vCurrent ) as ElementVNode ;
774775 needsQDispatchEventPatch =
@@ -820,12 +821,12 @@ export const vnode_diff = (
820821
821822 const record = ( key : NumericPropKey , value : any ) => {
822823 const keyName = getPropName ( key ) ;
823- if ( keyName . startsWith ( ':' ) ) {
824+ if ( isHandlerProp ( key ) ) {
824825 vnode_setProp ( vnode , keyName , value ) ;
825826 return ;
826827 }
827828
828- if ( keyName === 'ref' ) {
829+ if ( key === StaticPropId . REF ) {
829830 const element = vnode_getNode ( vnode ) as Element ;
830831 if ( isSignal ( value ) ) {
831832 value . value = element ;
@@ -882,17 +883,14 @@ export const vnode_diff = (
882883 } ;
883884
884885 while ( srcKey !== null || dstKey !== null ) {
885- if (
886- ( dstKey && getPropName ( dstKey ) . startsWith ( HANDLER_PREFIX ) ) ||
887- ( dstKey && getPropName ( dstKey ) . startsWith ( Q_PREFIX ) )
888- ) {
886+ if ( ( dstKey && isHandlerProp ( dstKey ) ) || ( dstKey && isQProp ( dstKey ) ) ) {
889887 // These are a special keys which we use to mark the event handlers as immutable or
890888 // element key we need to ignore them.
891889 dstIdx ++ ; // skip the destination value, we don't care about it.
892890 dstKey = dstIdx < dstLength ? dstAttrs [ dstIdx ++ ] : null ;
893891 } else if ( srcKey == null ) {
894892 // Source has more keys, so we need to remove them from destination
895- if ( dstKey && isHtmlAttributeAnEventName ( getPropName ( dstKey ) ) ) {
893+ if ( dstKey && isEventProp ( dstKey ) ) {
896894 patchEventDispatch = true ;
897895 dstIdx ++ ;
898896 } else {
@@ -902,7 +900,7 @@ export const vnode_diff = (
902900 dstKey = dstIdx < dstLength ? dstAttrs [ dstIdx ++ ] : null ;
903901 } else if ( dstKey == null ) {
904902 // Destination has more keys, so we need to insert them from source.
905- const isEvent = isJsxPropertyAnEventName ( getPropName ( srcKey ) ) ;
903+ const isEvent = isEventProp ( srcKey ) ;
906904 if ( isEvent ) {
907905 // Special handling for events
908906 patchEventDispatch = true ;
@@ -926,7 +924,7 @@ export const vnode_diff = (
926924 dstKey = dstIdx < dstLength ? dstAttrs [ dstIdx ++ ] : null ;
927925 } else if ( srcKey < dstKey ) {
928926 // Destination is missing the key, so we need to insert it.
929- if ( isJsxPropertyAnEventName ( getPropName ( srcKey ) ) ) {
927+ if ( isEventProp ( srcKey ) ) {
930928 // Special handling for events
931929 patchEventDispatch = true ;
932930 recordJsxEvent ( srcKey , srcAttrs [ srcIdx ] ) ;
@@ -943,7 +941,7 @@ export const vnode_diff = (
943941 dstKey = dstIdx < dstLength ? dstAttrs [ dstIdx ++ ] : null ;
944942 } else {
945943 // Source is missing the key, so we need to remove it from destination.
946- if ( isHtmlAttributeAnEventName ( getPropName ( dstKey ) ) ) {
944+ if ( isEventProp ( dstKey ) ) {
947945 patchEventDispatch = true ;
948946 dstIdx ++ ;
949947 } else {
@@ -1219,7 +1217,15 @@ function getKey(vNode: VNode | null): string | null {
12191217 if ( vNode == null ) {
12201218 return null ;
12211219 }
1222- return vnode_getProp < string > ( vNode , ELEMENT_KEY , null ) ;
1220+ const type = vNode [ VNodeProps . flags ] ;
1221+ if ( ( type & VNodeFlags . ELEMENT_OR_VIRTUAL_MASK ) !== 0 ) {
1222+ const props = vnode_getProps ( vNode ) ;
1223+ // this works, because q:key is always at 0 position or it is not present
1224+ if ( props [ 0 ] === StaticPropId . ELEMENT_KEY ) {
1225+ return props [ 1 ] as string | null ;
1226+ }
1227+ }
1228+ return null ;
12231229}
12241230
12251231/**
@@ -1450,11 +1456,6 @@ function markVNodeAsDeleted(vCursor: VNode) {
14501456 vCursor [ VNodeProps . flags ] |= VNodeFlags . Deleted ;
14511457}
14521458
1453- /**
1454- * This marks the property as immutable. It is needed for the QRLs so that QwikLoader can get a hold
1455- * of them. This character must be `:` so that the `vnode_getAttr` can ignore them.
1456- */
1457- const HANDLER_PREFIX = ':' ;
14581459let count = 0 ;
14591460const enum SiblingsArray {
14601461 Name = 0 ,
0 commit comments