I'm working with a WebView where I use DOM object manipulation in objective-c combined with _javascript_.
I have the dom document and I add an object with some attributes like this:
DOMNodeList *list = [ domDoc getElementsByTagName: @"BODY" ];
DOMNode *body = [ list item: 0 ];
myObject = (DOMHTMLObjectElement *) [ [ domDoc createElement: @"OBJECT" ] retain ];
[ myObject setAttribute: @"ID" : @"MyObjectName" ];
[ myObject setAttribute: @"NAME" : @"MyObjectName" ];
<snip>
[ myObject setAttribute: @"command" : @"xxx" ];
[ body appendChild: myObject ];
In the _javascript_, I can get the object with this and check its value (this is in a _javascript_ function that gets called):
var myObject = document.body.children['MyObjectName'];
alert(myObject.command);
myObject.command = "abcdef";
alert(myObject.command);
I have a WebUIDelegate with the runJavaScriptAlertPanelWithMessage that prints out the alert value and compares it against myObject:
- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message
{
NSLog (@"alert: %@", message);
NSLog( @"command attribute: %@", [ mSwfObject getAttribute: @"command" ] );
}
In the above example, it prints out:
2006-10-26 08:44:29.771 TestInsideWebKit[9235] alert: xxx
2006-10-26 08:44:29.771 TestInsideWebKit[9235] command attribute: xxx
2006-10-26 08:44:29.771 TestInsideWebKit[9235] alert: abcdef
2006-10-26 08:44:29.771 TestInsideWebKit[9235] command attribute: xxx
Why isn't the command attribute changed in the objective-c object when it's changed in the _javascript_ function? It must be the same object since it started as 'xxx'.
Any help would be appreciated,
Thanks,
Rudi
_______________________________________________
webkit-dev mailing list