summaryrefslogtreecommitdiff
path: root/includes/ajax.inc
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2014-11-03 00:39:48 -0500
committerDavid Rothstein <drothstein@gmail.com>2014-11-03 00:39:48 -0500
commit62e874b348fe64490952a12f419164e26ea98d21 (patch)
tree1832d4d5e6c6077c54813a1dc31d400f8f80758a /includes/ajax.inc
parent0c8dc6ea062cd7595a7b6fbd02fb0f0294ccecef (diff)
downloadbrdo-62e874b348fe64490952a12f419164e26ea98d21.tar.gz
brdo-62e874b348fe64490952a12f419164e26ea98d21.tar.bz2
Issue #1071818 by JeremyFrench, nod_, Cottser, gielfeldt, xjm, anthbel, reglogge, NROTC_Webmaster, kristofferwiklund, lliss, sun | sepgil: Fixed Lazy-loading CSS fails in IE.
Diffstat (limited to 'includes/ajax.inc')
-rw-r--r--includes/ajax.inc25
1 files changed, 24 insertions, 1 deletions
diff --git a/includes/ajax.inc b/includes/ajax.inc
index 31067c3e0..10877a246 100644
--- a/includes/ajax.inc
+++ b/includes/ajax.inc
@@ -276,7 +276,7 @@ function ajax_render($commands = array()) {
$extra_commands = array();
if (!empty($styles)) {
- $extra_commands[] = ajax_command_prepend('head', $styles);
+ $extra_commands[] = ajax_command_add_css($styles);
}
if (!empty($scripts_header)) {
$extra_commands[] = ajax_command_prepend('head', $scripts_header);
@@ -1257,3 +1257,26 @@ function ajax_command_update_build_id($form) {
'new' => $form['#build_id'],
);
}
+
+/**
+ * Creates a Drupal Ajax 'add_css' command.
+ *
+ * This method will add css via ajax in a cross-browser compatible way.
+ *
+ * This command is implemented by Drupal.ajax.prototype.commands.add_css()
+ * defined in misc/ajax.js.
+ *
+ * @param $styles
+ * A string that contains the styles to be added.
+ *
+ * @return
+ * An array suitable for use with the ajax_render() function.
+ *
+ * @see misc/ajax.js
+ */
+function ajax_command_add_css($styles) {
+ return array(
+ 'command' => 'add_css',
+ 'data' => $styles,
+ );
+}