Permalink
Browse files

Added inline SVG feature detection and use it for webkit fallbacks.

  • Loading branch information...
1 parent 2e6ca1e commit 0995a5cd937227e8494c674cfbe80f2053091f1a @rlr rlr committed Feb 28, 2011
Showing with 44 additions and 0 deletions.
  1. +9 −0 mobile.css
  2. BIN mobile/homeicon.png
  3. BIN mobile/searchbtn.png
  4. +35 −0 mobilefeatures.js
View
@@ -284,6 +284,10 @@ header #home {
padding: 14px 0;
line-height: 14px;
}
+.no-inlinesvg header #home {
+ background: transparent url(../global/mobile/homeicon.png) no-repeat 0 12px;
+ padding-left: 22px;
+}
.mini-header .site-title a {
font-size: 22px;
line-height: 22px;
@@ -420,6 +424,7 @@ a.listview:before {
}
#search button[type=submit] {
+ display: block;
margin: 0;
height: 45px;
width: 56px;
@@ -434,6 +439,10 @@ a.listview:before {
vertical-align: middle;
}
+.no-inlinesvg #search button[type=submit] {
+ background: transparent url(../global/mobile/searchbtn.png) no-repeat left top;
+}
+
/************************************/
/* FOOTER */
/************************************/
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,35 @@
+/*
+ * In general we assume modern on the mobile site. We don't need full
+ * modernizr, but there are features we want to test for.
+ */
+
+// Tests below are copied from Modernizr
+/*!
+ * Modernizr v1.7
+ * http://www.modernizr.com
+ *
+ * Developed by:
+ * - Faruk Ates http://farukat.es/
+ * - Paul Irish http://paulirish.com/
+ *
+ * Copyright (c) 2009-2011
+ * Dual-licensed under the BSD or MIT licenses.
+ * http://www.modernizr.com/license/
+ */
+
+
+(function() {
+
+"use strict";
+
+// Inline SVG is not in iPhone or Android webkit _yet_, so we need to fallback.
+function inlineSVG() {
+ var div = document.createElement('div');
+ div.innerHTML = '<svg/>';
+ return (div.firstChild && div.firstChild.namespaceURI) == 'http://www.w3.org/2000/svg';
+}
+if(!inlineSVG()) {
+ document.documentElement.className += ' ' + 'no-inlinesvg';
+}
+
+}());

0 comments on commit 0995a5c

Please sign in to comment.