KangoExtensions / kango

Kango framework issue tracker
74 stars 7 forks source link

Adding styles to the page not working on Kango 1.7.9 [IE ONLY] #133

Closed ThoranCheLadra closed 9 years ago

ThoranCheLadra commented 9 years ago

Hi,

One of the features of our plugin is to add on-page controls, for which we have styles stored in stylesheet. In previous versions of Kango, we could simply include them by appending them to the page's HEAD with jQuery. This doesn't work anymore. I've tried other ways such as native javascript but no success so far; it appears. Below is a code snippet that worked on <= 1.7.7 and doesn't on 1.7.9:

kango.invokeAsync('kango.io.getExtensionFileContents', 'Content/css/cleanslate.css', function (content) { Logging.logDebug('Adding cleanslate css'); $(document.head).prepend(''); });

Cheers, Arthur.

akrylysov commented 9 years ago

Do you use var $ = window.$.noConflict(true); in your script?

The following code works great:

// ==UserScript==
// @name test
// @include http://*
// @include https://*
// @include about:blank
// @require jquery.min.js
// ==/UserScript==

var $ = window.$.noConflict(true);
$(document.body).append('<h1>222222<h1/>');
$(document.head).prepend('<style>body {background-color: red;}<style>');
ThoranCheLadra commented 9 years ago

Issue was caused by unreachable statement when fetching asynchronously a css file, closing this. Thanks