S
Scott Sauyet
---- s2.createTextNode(s1.cssText || s1.ownerNode.textContent));Suppose !styleSheet.href and you are right about `cssText', in a nutshell:
var
s1 = styleSheet,
s2 = document.createElement("style");
if (s1 && s2)
{
s2.type = "text/css";
s2.appendChild(
++++ document.createTextNode(s1.cssText ||
s1.ownerNode.textContent));
document.getElementsByTagName("head")[0].appendChild(s2);
}
Another thought: if the iframe's src references a significantly
different path than the main page and the stylesheet in a STYLE
element contains relative URLS is there a simple way to deal with
them?
For example,
main document at http://example.com/path/
iframe document at http://example.com/path/subpath/
<style type="text/css">
@import "../css/fancy.css";
body {background: url("../images/myPic.png");}
</style>
I'm wondering if the best answer is simply "Don't do that." Or is
there a simple enhancement to this technique that would gracefully
handle such a scenario?
-- Scott
-- Scott