Add a short delay to the contentAdded event, to ensure it's run after the content has been appended. JSXtras JSXtras_bookmark
authorThijs Alkemade <me@thijsalkema.de>
Tue, 16 Apr 2013 22:33:54 +0200
branchJSXtras
changeset 5423 30446d4b7b9f
parent 5422 3cd596256677
Add a short delay to the contentAdded event, to ensure it's run after the content has been appended.
Plugins/WebKit Message View/AIWebKitMessageViewController.m
--- a/Plugins/WebKit Message View/AIWebKitMessageViewController.m	Tue Apr 16 20:33:19 2013 +0200
+++ b/Plugins/WebKit Message View/AIWebKitMessageViewController.m	Tue Apr 16 22:33:54 2013 +0200
@@ -656,9 +656,11 @@
         
         if (objectsAdded > 0) {
             [webView stringByEvaluatingJavaScriptFromString:
-             @"var evt = document.createEvent(\"Event\");\n"
+             @"window.setTimeout(function () {\n"
+			 @"var evt = document.createEvent(\"Event\");\n"
              @"evt.initEvent(\"contentAdded\", true, true);\n"
-             @"document.dispatchEvent(evt);"];
+             @"document.dispatchEvent(evt);"
+			 @"}, 100);"];
         }
 		
 		//If there is still content to process (the webview wasn't ready), we'll try again after a brief delay