Skip to content

Commit

Permalink
add wsdoc option + better handling of jquery mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander.Frakas committed Jan 23, 2014
1 parent 123b50a commit 03b425a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
9 changes: 5 additions & 4 deletions demos/demos/webforms/jquery-mobile.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<script src="../../demo-js/src/modernizr-special.js"></script>

<script src="../../js-webshim/minified/polyfiller.js"></script>
<script src="../../../js-webshim/minified/polyfiller.js"></script>

<!-- jQM: make some small style adjustments -->
<style>
Expand Down Expand Up @@ -88,11 +88,12 @@
});
})();

//jQM: set wsdoc to active page or false
webshims.setOptions('wsdoc', $('.ui-page-active').updatePolyfill().get(0) || false);



//jQM: update polyfills on pageinit
//jQM: update polyfills on pageinit and change active page
$(document).on('pageinit', function(e){
webshims.setOptions('wsdoc', e.target);
$(e.target).updatePolyfill();
});

Expand Down
11 changes: 6 additions & 5 deletions demos/js-webshim/dev/polyfiller.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
// extendNative: false,
loadStyles: true,
disableShivMethods: true,
wsdoc: document,
wspopover: {appendTo: 'auto', hideOnBlur: true},
ajax: {},
loadScript: function(src, success, fail){
Expand Down Expand Up @@ -651,13 +652,10 @@
*/

(function(){
var doc = document;
//Overwrite DOM-Ready and implement a new ready-method
$.isDOMReady = $.isReady;
var onReady = function(e){
if(webCFG.readyEvt && e && e.type === webCFG.readyEvt){
doc = e.target || document;
}

$.isDOMReady = true;
isReady('DOM', true);
setTimeout(function(){
Expand Down Expand Up @@ -725,7 +723,10 @@
webshims.ready('DOM', function(){fn(context, elem);});
};
readyFns.push(readyFn);
readyFn(doc, emptyJ);

if(webCFG.wsdoc){
readyFn(webCFG.wsdoc, emptyJ);
}
},
triggerDomUpdate: function(context){
if(!context || !context.nodeType){
Expand Down
2 changes: 1 addition & 1 deletion demos/js-webshim/minified/polyfiller.js

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions js-webshim/dev/polyfiller.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
// extendNative: false,
loadStyles: true,
disableShivMethods: true,
wsdoc: document,
wspopover: {appendTo: 'auto', hideOnBlur: true},
ajax: {},
loadScript: function(src, success, fail){
Expand Down Expand Up @@ -651,13 +652,10 @@
*/

(function(){
var doc = document;
//Overwrite DOM-Ready and implement a new ready-method
$.isDOMReady = $.isReady;
var onReady = function(e){
if(webCFG.readyEvt && e && e.type === webCFG.readyEvt){
doc = e.target || document;
}

$.isDOMReady = true;
isReady('DOM', true);
setTimeout(function(){
Expand Down Expand Up @@ -725,7 +723,10 @@
webshims.ready('DOM', function(){fn(context, elem);});
};
readyFns.push(readyFn);
readyFn(doc, emptyJ);

if(webCFG.wsdoc){
readyFn(webCFG.wsdoc, emptyJ);
}
},
triggerDomUpdate: function(context){
if(!context || !context.nodeType){
Expand Down
2 changes: 1 addition & 1 deletion js-webshim/minified/polyfiller.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/polyfiller.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
// extendNative: false,
loadStyles: true,
disableShivMethods: true,
wsdoc: document,
wspopover: {appendTo: 'auto', hideOnBlur: true},
ajax: {},
loadScript: function(src, success, fail){
Expand All @@ -117,7 +118,7 @@
features: {},
featureList: [],
setOptions: function(name, opts){
if (typeof name == 'string' && opts !== undefined) {
if (typeof name == 'string' && arguments.length > 1) {
webCFG[name] = (!$.isPlainObject(opts)) ? opts : $.extend(true, webCFG[name] || {}, opts);
} else if (typeof name == 'object') {
$.extend(true, webCFG, name);
Expand Down Expand Up @@ -723,8 +724,8 @@
};
readyFns.push(readyFn);

if(!webCFG.noDocumentInit){
readyFn(document, emptyJ);
if(webCFG.wsdoc){
readyFn(webCFG.wsdoc, emptyJ);
}
},
triggerDomUpdate: function(context){
Expand Down

0 comments on commit 03b425a

Please sign in to comment.