]> spindle.queued.net Git - midori/commitdiff
Always create a new style element for link find
authorChristian Dywan <christian@twotoasts.de>
Tue, 26 Oct 2010 21:50:59 +0000 (23:50 +0200)
committerChristian Dywan <christian@twotoasts.de>
Tue, 26 Oct 2010 21:50:59 +0000 (23:50 +0200)
Otherwise adding rules for link find on pages with
no stylesheets doesn't work.

midori/midori-view.c

index 2e6f462edfa328261fb55c31e1a34b00fc1ce324..14353c467ce03a525716c132a49d61f66af0c4ea 100644 (file)
@@ -1812,8 +1812,12 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
         if (view->find_links == -1)
         {
             result = sokoke_js_script_eval (js_context,
-                "(function (aSelector, aRule) { "
-                " document.styleSheets[0].insertRule (aSelector + ' ' + aRule);"
+                "(function (selector, rule) { "
+                " var style = document.createElement ('style');"
+                " style.setAttribute ('type', 'text/css');"
+                " var heads = document.getElementsByTagName ('head');"
+                " heads[0].appendChild (style);"
+                " document.styleSheets[0].insertRule (selector + ' ' + rule);"
                 " } )"
                 " ('.midoriHKD87346', '{ "
                 " font-size:small !important; font-weight:bold !important;"