Changeset 2312

Show
Ignore:
Timestamp:
02/13/05 22:28:45 (4 years ago)
Author:
timothy
Message:

Use the standard DOM "childNodes" call vs the extended DOM "children". The later seems to contain all recursive children, not what we need.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/JVStyleView.m

    r2308 r2312  
    425425                if( ! subsequent ) { // append message normally 
    426426                        [[replaceElement parentNode] removeChild:replaceElement]; 
    427                         while( [[element children] length] ) // append all children 
     427                        while( [[element childNodes] length] ) // append all children 
    428428                                [body appendChild:[element firstChild]]; 
    429                 } else if( [[element children] length] >= 1 ) { // append as a subsequent message 
     429                } else if( [[element childNodes] length] >= 1 ) { // append as a subsequent message 
    430430                        DOMNode *parent = [replaceElement parentNode]; 
    431431                        DOMNode *nextSib = [replaceElement nextSibling]; 
    432432                        [parent replaceChild:[element firstChild] :replaceElement]; // replaces the consecutiveInsert node 
    433                         while( [[element children] length] ) { // append all remaining children (in reverse order) 
     433                        while( [[element childNodes] length] ) { // append all remaining children (in reverse order) 
    434434                                if( nextSib ) [parent insertBefore:[element firstChild] :nextSib]; 
    435435                                else [parent appendChild:[element firstChild]]; 
     
    438438 
    439439                // enforce the scrollback limit 
    440                 if( scrollbackLimit > 0 && [[body children] length] > scrollbackLimit ) 
    441                         for( i = 0; [[body children] length] > scrollbackLimit && i < ( [[body children] length] - scrollbackLimit ); i++ ) 
    442                                 [body removeChild:[[body children] item:0]];           
     440                if( scrollbackLimit > 0 && [[body childNodes] length] > scrollbackLimit ) 
     441                        for( i = 0; [[body childNodes] length] > scrollbackLimit && i < ( [[body childNodes] length] - scrollbackLimit ); i++ ) 
     442                                [body removeChild:[[body childNodes] item:0]];                 
    443443 
    444444                if( [scrollNeeded boolValue] ) [self scrollToBottom]; 
     
    476476                DOMNode *firstMessage = [body firstChild]; 
    477477 
    478                 while( [[element children] length] ) { // append all children 
     478                while( [[element childNodes] length] ) { // append all children 
    479479                        if( firstMessage ) [body insertBefore:[element firstChild] :firstMessage]; 
    480480                        else [body appendChild:[element firstChild]]; 
     
    533533        if( [[self mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    534534                DOMHTMLElement *body = [(DOMHTMLDocument *)[[self mainFrame] DOMDocument] body]; 
    535                 if( index < [[body children] length] ) return [[[[body children] item:index] valueForKey:@"offsetTop"] intValue]; 
     535                if( index < [[body childNodes] length] ) return [[[[body childNodes] item:index] valueForKey:@"offsetTop"] intValue]; 
    536536                else return 0; 
    537537        } else 
     
    544544#ifdef WebKitVersion146 
    545545        if( [[self mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    546                 return [[[(DOMHTMLDocument *)[[self mainFrame] DOMDocument] body] children] length]; 
     546                return [[[(DOMHTMLDocument *)[[self mainFrame] DOMDocument] body] childNodes] length]; 
    547547        } else 
    548548#endif