开发者

Why can't i switch stylesheets in iframe using Firefox 4?

开发者 https://www.devze.com 2023-02-18 06:07 出处:网络
I am using an iframe and i have a tinymce UI button. When the button gets pushed i remove a stylesheet from th开发者_StackOverflow社区e iframes head (and i add another stylesheet). This works.

I am using an iframe and i have a tinymce UI button. When the button gets pushed i remove a stylesheet from th开发者_StackOverflow社区e iframes head (and i add another stylesheet). This works. On second button push i remove the formerly added stylesheet. This works. But when i want to insert the stylesheet which i removed on first button push it does not work.

It looks like i am only allowed to insert a stylesheet which has never been loaded in the iframes head.

Does anyone know why that is? Is there a workaround for this?


I had to change the function used to replace the stylesheet.

Formerly, i used

ed.dom.loadCSS( ed.settings.content_css );

to insert a stylesheet into the editor iframe head.

Main developer of moyxiecode spocke confirmed that loadCss only loads a stylesheet once (it several times in the past)

Using this jQuery code instead of the above code works like a charm:

$('#'+ed.id+'_ifr').contents().find('head').append('<link href="'+ed.settings.content_css+'" rel="stylesheet">');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号