Skip to content

Commit f85e4c9

Browse files
author
scottjehl
committed
small workaround to get media query function to work on Nokia
1 parent 02c9264 commit f85e4c9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

js/jquery.mobile.media.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@ $.mobile.media = (function() {
2828

2929
return function( query ) {
3030
if ( !( query in cache ) ) {
31-
var styleBlock = $( "<style type='text/css'>" +
32-
"@media " + query + "{#jquery-mediatest{position:absolute;}}" +
33-
"</style>" );
31+
var styleBlock = document.createElement('style'),
32+
cssrule = "@media " + query + " { #jquery-mediatest { position:absolute; } }";
33+
//must set type for IE!
34+
styleBlock.type = "text/css";
35+
if (styleBlock.styleSheet){
36+
styleBlock.styleSheet.cssText = cssrule;
37+
}
38+
else {
39+
styleBlock.appendChild(document.createTextNode(cssrule));
40+
}
41+
3442
$html.prepend( fakeBody ).prepend( styleBlock );
3543
cache[ query ] = testDiv.css( "position" ) === "absolute";
3644
fakeBody.add( styleBlock ).remove();

0 commit comments

Comments
 (0)