Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #15 from brianfryer/master
Fix for IE8
  • Loading branch information
bassjobsen committed Jan 9, 2015
2 parents 7f8b116 + f61891f commit 0ec829e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wp-defer-loading.php
Expand Up @@ -119,7 +119,10 @@ function print_extra_script( $handle, $echo = true ) {


echo "var element = document.createElement(\"script\");\n";
echo "element.appendChild( document.createTextNode( \"". addslashes(str_replace(array('\r\n','\n','\r'),"",$output)) ."\" ) );";
// <script> elements in IE8 do not support the .appendChild() method
// so, we're assigning the string to the .text property
//echo "element.appendChild( document.createTextNode( \"". addslashes(str_replace(array('\r\n','\n','\r'),"",$output)) ."\" ) );";
echo "element.text = '". addslashes(str_replace(array('\r\n','\n','\r'),"",$output)) ."' ;";
echo "\ndocument.body.appendChild(element);\n";

return true;
Expand Down

0 comments on commit 0ec829e

Please sign in to comment.