Permalink
Browse files

Merge branch 'master' of git://github.com/pelle/wysihat into pelle/ma…

…ster
  • Loading branch information...
2 parents 571d4f5 + 4b4966a commit 815325595c6b6c9a2fd575cdb77704960501aa3a @jeffkreeftmeijer committed Sep 23, 2009
Showing with 31 additions and 0 deletions.
  1. +31 −0 src/wysihat/models/iframe.js
View
31 src/wysihat/models/iframe.js
@@ -109,6 +109,37 @@ WysiHat.iFrame.Methods = {
return this;
},
+
+ /**
+ * WysiHat.iFrame.Methods#linkStyleSheet(href) -> Element
+ * - href (String): The path to an external CSS style sheet
+ *
+ * Links an external CSS style sheet to iframe document.
+ **/
+
+ linkStyleSheet: function(href) {
+ this.whenReady(function(editor){
+ var document = editor.getDocument();
+ if(document.createStyleSheet) { // IE
+ document.createStyleSheet(css);
+ } else {
+ var head = document.documentElement.getElementsByTagName('head')[0];
+ if (!head) {
+ head=document.createElement('head');
+ document.documentElement.insertBefore(head,document.getElementsByTagName('body')[0]);
+ }
+ var link='<link href="'+href+'" media="screen" rel="stylesheet" type="text/css"/>';
+ head=$(head);
+ if (head.insert) { // Safari
+ $(head).insert(link);
+ } else { // everyone else
+ head.innerHTML=head.innerHTML+link;
+ }
+ }
+ });
+ },
+
+
/**
* WysiHat.iFrame.Methods#getStyle(style) -> string

0 comments on commit 8153255

Please sign in to comment.