Skip to content

Commit

Permalink
Adding child support at the element level.
Browse files Browse the repository at this point in the history
  • Loading branch information
WhichKatieDid committed Oct 25, 2011
1 parent 9c7febc commit 3d33a26
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
28 changes: 28 additions & 0 deletions iphone/Classes/TiDOMElementProxy.m
Expand Up @@ -127,6 +127,34 @@ -(id)getAttributeNode:(id)args
return result;
}

-(id)insertBefore:(id)args
{
[self throwException:@"mutation not supported" subreason:nil location:CODELOCATION];
}

-(id)replaceChild:(id)args
{
[self throwException:@"mutation not supported" subreason:nil location:CODELOCATION];
}

-(id)removeChild:(id)args
{
ENSURE_ARG_COUNT(args, 1);
TiDOMNodeProxy * oldChild;
ENSURE_ARG_AT_INDEX(oldChild, args, 0, TiDOMNodeProxy);
[element removeChild:[oldChild node]];
return oldChild;
}

-(id)appendChild:(id)args
{
ENSURE_ARG_COUNT(args, 1);
TiDOMNodeProxy * newChild;
ENSURE_ARG_AT_INDEX(newChild, args, 0, TiDOMNodeProxy);
[element addChild:[newChild node]];
return newChild;
}

-(void)setAttributeNode:(id)args
{
//TODO:
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiDOMNodeProxy.h
Expand Up @@ -15,7 +15,7 @@
GDataXMLDocument *document;
}

-(void)setNode:(GDataXMLNode*)node_;
@property(nonatomic,retain) GDataXMLNode *node;
@property(nonatomic,retain) GDataXMLDocument *document;

-(NSString *)XMLString;
Expand Down
8 changes: 1 addition & 7 deletions iphone/Classes/TiDOMNodeProxy.m
Expand Up @@ -15,7 +15,7 @@
#import "TiDOMAttrProxy.h"

@implementation TiDOMNodeProxy
@synthesize document;
@synthesize document, node;

#pragma mark Internal

Expand All @@ -26,12 +26,6 @@ -(void)dealloc
[super dealloc];
}

-(void)setNode:(GDataXMLNode*)node_
{
RELEASE_TO_NIL(node);
node = [node_ retain];
}

-(NSString *)XMLString
{
return [node XMLString];
Expand Down

0 comments on commit 3d33a26

Please sign in to comment.