Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DOM -outerHTML is modified by JS bridge?



Thanks Darin, I changed the instance name.

It seems that when I perform a user event, the DOM gets modified (emptied?)

in -awakeFromNib:

[fWebView setFrameLoadDelegate:self];
[[fWebView mainFrame] loadRequest:[NSURLRequest requestWithURL: [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Untitled" ofType:@"html"]]]];


in didFinishLoadForFrame:
- (void)webView:(WebView *)webView didFinishLoadForFrame:(WebFrame *) frame
{
NSLog(@"didFinishLoadForFrame");
NSLog(@"didFinishLoadForFrame: %@", [(DOMHTMLElement *)[[[webView mainFrame] DOMDocument] documentElement] outerHTML]);
WebScriptObject * wso = [webView windowScriptObject];
id result;
NSArray * args = [NSArray arrayWithObjects:scriptObject, nil];
result = [wso callWebScriptMethod:@"cocoacalling" withArguments:args];
NSLog(@"%@ result", result);
}


results in:

2005-12-05 09:57:30.155 DataTypeRoot[12898] didFinishLoadForFrame
2005-12-05 09:57:30.156 DataTypeRoot[12898] didFinishLoadForFrame: <HTML><HEAD>


<SCRIPT type="text/javascript"><!--
function cocoacalling(scrObject)
{ scrObject.Score = 1000; document.write('cocoacalling'); return scrObject.Score;}
// -->
</SCRIPT></HEAD><BODY>
hi LJSCompare
</BODY></HTML>
2005-12-05 09:57:30.159 DataTypeRoot[12898] 1000 result


after I click an action method:

-(IBAction)setToFileAndReload:(id)sender
{
NSLog(@"clicked button: %@", [(DOMHTMLElement *)[[[fWebView mainFrame] DOMDocument] documentElement] outerHTML]);
[[(DOMHTMLElement *)[[[fWebView mainFrame] DOMDocument] documentElement] outerHTML] writeToFile:@"/Users/mhanna/myDev/ GetActualJavascriptWorking/DataTypeRoot.keyaccess/domhtml.html" atomically:YES];
[[fWebView mainFrame] loadRequest:[NSURLRequest requestWithURL: [NSURL fileURLWithPath:@"/Users/mhanna/myDev/ GetActualJavascriptWorking/DataTypeRoot.keyaccess/domhtml.html"]]];
}



2005-12-05 09:57:32.110 DataTypeRoot[12898] clicked button: <HTML></ HTML>
2005-12-05 09:57:32.129 DataTypeRoot[12898] windowScriptObjectAvailable
2005-12-05 09:57:32.132 DataTypeRoot[12898] didFinishLoadForFrame
2005-12-05 09:57:32.132 DataTypeRoot[12898] didFinishLoadForFrame: <HTML><BODY></BODY></HTML>
2005-12-05 09:57:32.132 DataTypeRoot[12898] (null) result



isn't this bizarre? Michael -- Michael Hanna email@hidden iChat: michaelkhanna(AIM)



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.