This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically | |
// Example: | |
// $(document).ready(function() { | |
// ProvideHtml5.autofocus() | |
// ProvideHtml5.datepicker() | |
// ProvideHtml5.forcenumber() | |
// }) | |
var ProvideHtml5 = { | |
autofocus = function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically | |
// Example: | |
// $(document).ready(function() { | |
// ProvideHtml5.autofocus() | |
// ProvideHtml5.datepicker() | |
// ProvideHtml5.forcenumber() | |
// }) | |
var ProvideHtml5 = { | |
autofocus = function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- either: --> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<!-- or --> | |
<!--[if IE]> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// actual representation of snow in Brighton - dirty code, but small :) | |
// run in your console | |
a=document.createElement("b");document.body.appendChild(a);with(a.style){position="fixed";left=top=0;height=width="100%";background="#fff"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find: function(q, context) { | |
var ele = [], list, i, j, x; | |
this.cache = context; | |
// this doesn't feel quite right, we should be able to do [#foo,bar].querySelectorAll (or something) - TODO add loop | |
if (context == undefined && this.length == 1) { | |
return xui(q, this[0]); // results = [].slice.call(this) | |
} else if (context == undefined && this.length > 1) { | |
// do some sort of loop - maybe this: | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
function detectMutation() { | |
mutationSupported = true; | |
this.removeEventListener('DOMAttrModified', detectMutation, false); | |
} | |
var forEach = [].forEach, | |
regex = /^data-(.+)/, | |
el = document.createElement('div'), | |
mutationSupported = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mutationSupported = (function () { | |
var el = document.createElement('div'), | |
mutationSupported = false; | |
function detectMutation() { | |
mutationSupported = true; | |
this.removeEventListener('DOMAttrModified', detectMutation, false); | |
} | |
el.addEventListener('DOMAttrModified', detectMutation, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!navigator.geolocation) { | |
navigator.geolocation = (function (window, document) { | |
function getCurrentPosition(callback) { | |
var geourl = 'http://www.google.com/jsapi?' + Math.random(), | |
iframe = document.createElement('iframe'), | |
doc, win; | |
iframe.style.display = 'none'; | |
window.document.body.appendChild(iframe); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// original (http://html5shiv.googlecode.com/svn/trunk/html5.js) | |
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})() | |
// @rem version - 68 characters less, and much more maintainable than @pornelski - how do you like /them/ apples? :-) | |
// that said - change @pornelski's version so it uses spaces and it's easy maintainable, and still the shortest. /hattip to @pornelski | |
/*@cc_on(function(e){for(;e[0];document.createElement(e.pop())){}})('abbr article aside audio canvas details figure footer header hgroup mark menu meter nav output progress section time video'.split(' '))@*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"string" instanceof String; // false. | |
// 'course it isn't not a string, it may look like a string | |
// but actually it's masquerading as a banana. |