[jQuery] AJAX .Load stripping out a <STYLE> tag.
This is an in-house clinical portal, similar in nature to DotNetNuke or
Rainbow Portal in that content is served dynamically through one or two
ASPX pages. The ASPX pages grab content from a database which includes
references to ASCX's (user controls). It's one of those user controls
I'm writing that uses jQuery to populate a DIV depending on a tabbed
item you select.
Down to the nuts and bolts, clicking an anchor tag executes something to
the effect of:
$("#myDiv").load("query.aspx?param1=2¶m2=3");
The result is similar to:
<style type="text/css">
...... bunch of CSS
</style>
<table>
...... data listing
</table>
I can see that the result is coming across correctly and the table pops
up in the page, but the STYLE tag never makes it to the DOM. Using IE's
Developer Toolbar I can see that it isn't added as STYLE element or even
a #text element. Forgive the IE part, we're stuck with it internally.
So any how, I must assume it's what you said with innerHTML not playing
well with <STYLE> tags. If I include the <STYLE> tag as part of the
originally served document there is no problem at all.
Actually, I just wrote a very basic test and confirmed that it's just
innerHTML being a prick. Check out http://ooz.net/~warthog/test.html for
an example. I tried using a STYLE in the HEAD, one in the BODY, and
finally one using innerHTML. The first two work correctly but the third
strips the STYLE element.