Mailing Lists: Apple Mailing Lists

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

Re: Dynamically reset the DOM?



I've added this in windowScriptObjectAvailable:
[wso setValue:scriptObject forKey:@"scrObject"];

but doing this creates no discernible difference.

Calling setValue:forKey: on wso sets a value in the window object. It's like having the line "scrObject = XXX" inside a <script> tag. However, you pass scrObject directly as an argument to cocoacalling(), so setting the value of scrObject globally is superfluous.

I'm using pre-existing _javascript_, which cannot be modified. 'scrObject' is the name and parameter I have to use.

I don't understand this comment. In the example you provide, the _javascript_ gets created through the following line:

NSString * scriptPreamble = @"<!-- function cocoacalling(scrObject) { scrObject.Score = 1000; document.write('cocoacalling'); return scrObject.Score;}";

I'm suggesting changing that to

NSString * scriptPreamble = @"<!-- function cocoacalling() {alert('cocoacalling got called'}";

and changing 

result = [wso callWebScriptMethod:@"cocoacalling" withArguments:args];

to

result = [wso callWebScriptMethod:@"cocoacalling" withArguments:nil];

and testing whether the function gets called at all. Is that possible?

You might as well log wso at the time as well, just for sanity's sake.

what confuses me is that using loadRequest:pathForResource: will allow me to get a result, "1000", while inserting a new string with loadHTMLString:baseURL: returns me a result(whether or not I have [wso setValue:scriptObject forKey:@"scrObject"]; in the webView:windowScriptObjectAvailable:. In both cases webView:windowScriptObjectAvailable: are called

Is this a typo? I thought the loadHTMLString case did not return a value.

As for loadRequest, that is indeed strange.

what if I generated scratch files in a temporary directory and reload them with loadRequest:pathForResource: ?

Seems like a reasonable work-around, but I'd prefer to get to the bottom of the problem.

Geoff

 _______________________________________________
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

References: 
 >Dynamically reset the DOM? (From: Michael Hanna <email@hidden>)
 >Re: Dynamically reset the DOM? (From: Geoffrey Garen <email@hidden>)
 >Re: Dynamically reset the DOM? (From: Michael Hanna <email@hidden>)
 >Re: Dynamically reset the DOM? (From: Michael Hanna <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.