mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 14:41:28 +00:00
Fix for same html appearing multiple times in CPWebView when using loadHTMLString: many times in succession.
Reviewed by me.
This commit is contained in:
+12
-3
@@ -69,11 +69,13 @@ CPWebViewScrollNative = 2;
|
||||
|
||||
CPString _url;
|
||||
CPString _html;
|
||||
|
||||
|
||||
Function _loadCallback;
|
||||
|
||||
|
||||
int _scrollMode;
|
||||
CGSize _scrollSize;
|
||||
|
||||
int _loadHTMLStringTimer;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CPRect)frameRect frameName:(CPString)frameName groupName:(CPString)groupName
|
||||
@@ -327,8 +329,15 @@ CPWebViewScrollNative = 2;
|
||||
// clear the iframe
|
||||
_iframe.src = "";
|
||||
|
||||
if (_loadHTMLStringTimer !== nil)
|
||||
{
|
||||
window.clearTimeout(_loadHTMLStringTimer);
|
||||
_loadHTMLStringTimer = nil;
|
||||
}
|
||||
|
||||
// need to give the browser a chance to reset iframe, otherwise we'll be document.write()-ing the previous document
|
||||
window.setTimeout(function() {
|
||||
_loadHTMLStringTimer = window.setTimeout(function()
|
||||
{
|
||||
var win = [self DOMWindow];
|
||||
|
||||
win.document.write(_html);
|
||||
|
||||
Reference in New Issue
Block a user