I have a unique situation where I am using an Ajax control within a Yahoo popup that is being loaded with jQuery.
My approach involves making a simple .get request to load the HTML content.
$.get(contentUrl, null, function(response) {
$('#dialog').find('.bd').assertOne().html(response);
}, "waitDlg");
The issue arises when the loaded content requires its own CSS which is generated dynamically. I am faced with the decision of either inline styling or incorporating an external CSS stylesheet.
Upon testing in Chrome, it becomes evident that the CSS introduced via AJAX is not being evaluated/applied when inserted into the DOM through the above code.
Interestingly, Internet Explorer will evaluate an inlined CSS as soon as it enters the DOM, but Chrome does not exhibit this behavior. Unfortunately, I am currently unable to test in FireFox due to an unrelated technical problem.
My question now is whether there is a jQuery method to evaluate a dynamically added stylesheet in the DOM as either an inline style or a separate stylesheet?
There are several factors driving my desire for this functionality:
- The CSS in the popup belongs exclusively to the popup and may originate from a different environment
- The dynamic nature of the CSS makes it inconvenient to place it in the parent page unless absolutely necessary
- I had anticipated this setup to function smoothly, but unfortunately, I have encountered setbacks :-(