pidgin: e024ab8c: Use insertAdjacentHtml instead of docume...

qulogic at pidgin.im qulogic at pidgin.im
Thu May 31 02:21:52 EDT 2012


----------------------------------------------------------------------
Revision: e024ab8c9c715bd10352fc8ed661247a72c2b51e
Parent:   0999ca4d27c29a236181f63c3e351073fbf9911a
Author:   qulogic at pidgin.im
Date:     05/30/12 23:42:49
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e024ab8c9c715bd10352fc8ed661247a72c2b51e

Changelog: 

Use insertAdjacentHtml instead of document.write. This seems a lot
better since it correctly applies styles and adds elements to the DOM,
which then show up in the inspector.

Changes against parent 0999ca4d27c29a236181f63c3e351073fbf9911a

  patched  pidgin/gtkwebview.c

-------------- next part --------------
============================================================
--- pidgin/gtkwebview.c	9bdd9018d3db3ef1d0db18aaa23bcbe11fefbfc0
+++ pidgin/gtkwebview.c	1dd5c39e0271a012fd807ba82ce739048b59385d
@@ -551,12 +551,12 @@ gtk_webview_append_html(GtkWebView *webv
 gtk_webview_append_html(GtkWebView *webview, const char *html)
 {
 	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
-	char *escaped = gtk_webview_quote_js_string(html);
-	char *script = g_strdup_printf("document.write(%s)", escaped);
-	webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script);
+	WebKitDOMDocument *doc;
+	WebKitDOMHTMLElement *body;
+	doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
+	body = webkit_dom_document_get_body(doc);
+	webkit_dom_html_element_insert_adjacent_html(body, "beforeend", html, NULL);
 	priv->empty = FALSE;
-	g_free(script);
-	g_free(escaped);
 }
 
 void


More information about the Commits mailing list