From 74af14733ebf6c3a4a02e224db085e1e643f83cb Mon Sep 17 00:00:00 2001
From: scottjehl
Date: Wed, 10 Nov 2010 10:16:01 -0500
Subject: [PATCH 1/2] testing support for HTML5 elements for
page,header,footer,content
---
docs/pages/page-template-html5.html | 28 ++++++++++++++++++++++++++++
js/jquery.mobile.js | 10 ++++++----
js/jquery.mobile.page.js | 6 ++++++
3 files changed, 40 insertions(+), 4 deletions(-)
create mode 100755 docs/pages/page-template-html5.html
diff --git a/docs/pages/page-template-html5.html b/docs/pages/page-template-html5.html
new file mode 100755
index 00000000000..f4298eb51a0
--- /dev/null
+++ b/docs/pages/page-template-html5.html
@@ -0,0 +1,28 @@
+
+
+
+
+ Page Title
+
+
+
+
+
+
+
+
+
+
Page Title
+
+
+
+
Page content goes here.
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/js/jquery.mobile.js b/js/jquery.mobile.js
index c88dcb91cd5..31db80d7fc4 100644
--- a/js/jquery.mobile.js
+++ b/js/jquery.mobile.js
@@ -6,9 +6,11 @@
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
+
+
(function( $, window, undefined ) {
-
+
//jQuery.mobile configurable options
jQuery.mobile = {
@@ -61,7 +63,7 @@
//if device support condition(s) aren't met, leave things as they are -> a basic, usable experience,
//otherwise, proceed with the enhancements
if ( !jQuery.mobile.gradeA() ) {
- return;
+ //return;
}
//define vars for interal use
@@ -437,7 +439,7 @@
var all = jQuery("");
//workaround to allow scripts to execute when included in page divs
all.get(0).innerHTML = html;
- to = all.find('[data-role="page"]');
+ to = all.find('[data-role="page"], section[role=document]');
//rewrite src and href attrs to use a base url
if( !$.support.dynamicBaseTag ){
@@ -598,7 +600,7 @@
//dom-ready
jQuery(function(){
- var $pages = jQuery("[data-role='page']");
+ var $pages = jQuery("[data-role='page'],section[role='document']");
//set up active page
$startPage = $.activePage = $pages.first();
diff --git a/js/jquery.mobile.page.js b/js/jquery.mobile.page.js
index 44f53934a19..740470e5c8e 100644
--- a/js/jquery.mobile.page.js
+++ b/js/jquery.mobile.page.js
@@ -35,6 +35,12 @@ jQuery.widget( "mobile.page", jQuery.mobile.widget, {
return;
}
+ //add data attrs to html5 markup
+ $elem.filter('section[role=document]').attr('data-role', 'page');
+ $elem.find('header').attr('data-role', 'header');
+ $elem.find('footer').attr('data-role', 'footer');
+ $elem.find('section[role=main]').attr('data-role', 'content');
+
//some of the form elements currently rely on the presence of ui-page and ui-content
// classes so we'll handle page and content roles outside of the main role processing
// loop below.
From ed7954d8b018413aae080fd79d09da5cd2a6db91 Mon Sep 17 00:00:00 2001
From: scottjehl
Date: Wed, 10 Nov 2010 10:26:13 -0500
Subject: [PATCH 2/2] shim shimmy ya...
---
js/jquery.mobile.js | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/js/jquery.mobile.js b/js/jquery.mobile.js
index 31db80d7fc4..620236bdb36 100644
--- a/js/jquery.mobile.js
+++ b/js/jquery.mobile.js
@@ -7,10 +7,16 @@
* http://jquery.org/license
*/
+ // html5shiv MIT @rem remysharp.com/html5-enabling-script
+// iepp v1.6.2 MIT @jon_neal iecss.com/print-protector
+/*@cc_on(function(m,c){var z="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video";function n(d){for(var a=-1;++ai";if(g.childNodes.length!==1){var i=z.split("|"),o=i.length,s=RegExp("(^|\\s)("+z+")",
+"gi"),t=RegExp("<(/*)("+z+")","gi"),u=RegExp("(^|[^\\n]*?\\s)("+z+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),r=c.createDocumentFragment(),k=c.documentElement;g=k.firstChild;var h=c.createElement("body"),l=c.createElement("style"),f;n(c);n(r);g.insertBefore(l,
+g.firstChild);l.media="print";m.attachEvent("onbeforeprint",function(){var d=-1,a=p(c.styleSheets,"all"),e=[],b;for(f=f||c.body;(b=u.exec(a))!=null;)e.push((b[1]+b[2]+b[3]).replace(s,"$1.iepp_$2")+b[4]);for(l.styleSheet.cssText=e.join("\n");++d<0)a[b].className+=" iepp_"+i[d]}r.appendChild(f);k.appendChild(h);h.className=f.className;h.innerHTML=f.innerHTML.replace(t,"<$1font")});m.attachEvent("onafterprint",
+function(){h.innerHTML="";k.removeChild(h);k.appendChild(f);l.styleSheet.cssText=""})}})(this,document);@*/
(function( $, window, undefined ) {
-
+
//jQuery.mobile configurable options
jQuery.mobile = {
@@ -63,7 +69,7 @@
//if device support condition(s) aren't met, leave things as they are -> a basic, usable experience,
//otherwise, proceed with the enhancements
if ( !jQuery.mobile.gradeA() ) {
- //return;
+ return;
}
//define vars for interal use
@@ -439,7 +445,7 @@
var all = jQuery("");
//workaround to allow scripts to execute when included in page divs
all.get(0).innerHTML = html;
- to = all.find('[data-role="page"], section[role=document]');
+ to = all.find('[data-role="page"]');
//rewrite src and href attrs to use a base url
if( !$.support.dynamicBaseTag ){
@@ -600,7 +606,7 @@
//dom-ready
jQuery(function(){
- var $pages = jQuery("[data-role='page'],section[role='document']");
+ var $pages = jQuery("[data-role='page']");
//set up active page
$startPage = $.activePage = $pages.first();