@@ -1031,6 +1031,8 @@ export function hpass(tag: string): VirtualElementPass {
10311031 } else if ( arguments . length === 3 ) {
10321032 attrs = arguments [ 1 ] ;
10331033 renderer = arguments [ 2 ] ;
1034+ } else if ( arguments . length > 3 ) {
1035+ throw new Error ( "hpass() should be called with 1, 2, or 3 arguments" ) ;
10341036 }
10351037
10361038 return new VirtualElementPass ( tag , attrs , renderer ) ;
@@ -1201,23 +1203,15 @@ namespace Private {
12011203 continue ;
12021204 }
12031205
1204- // Handle the case of passthru update.
1205- if ( oldVNode . type === 'passthru' && newVNode . type === 'passthru' ) {
1206- newVNode . render ( currElem as HTMLElement ) ;
1207- currElem = currElem ! . nextSibling ;
1208- continue ;
1209- }
1210-
12111206 // If the types of the old and new nodes differ,
12121207 // create and insert a new node.
1213- if ( oldVNode . type === 'text' || newVNode . type === 'text' ||
1214- oldVNode . type === 'passthru' || newVNode . type === 'passthru' ) {
1208+ if ( oldVNode . type !== newVNode . type || oldVNode . type === 'text' || newVNode . type === 'text' ) {
12151209 ArrayExt . insert ( oldCopy , i , newVNode ) ;
12161210 createDOMNode ( newVNode , host , currElem ) ;
12171211 continue ;
12181212 }
12191213
1220- // At this point, both nodes are known to be element nodes .
1214+ // At this point, both nodes are known to be of matching non-text type .
12211215
12221216 // If the new elem is keyed, move an old keyed elem to the proper
12231217 // location before proceeding with the diff. The search can start
@@ -1263,7 +1257,11 @@ namespace Private {
12631257 updateAttrs ( currElem as HTMLElement , oldVNode . attrs , newVNode . attrs ) ;
12641258
12651259 // Update the element content.
1266- updateContent ( currElem as HTMLElement , oldVNode . children , newVNode . children ) ;
1260+ if ( oldVNode . type === 'passthru' || newVNode . type === 'passthru' ) {
1261+ ( newVNode as VirtualElementPass ) . render ( currElem as HTMLElement ) ;
1262+ } else {
1263+ updateContent ( currElem as HTMLElement , oldVNode . children , newVNode . children ) ;
1264+ }
12671265
12681266 // Step to the next sibling element.
12691267 currElem = currElem ! . nextSibling ;
0 commit comments