Skip to content

Instantly share code, notes, and snippets.

View termi's full-sized avatar

Егор Халимоненко termi

View GitHub Profile
@bobslaede
bobslaede / modernizr.positionfixed.js
Created September 16, 2011 08:50
Modernizr position fixed check
;(function(Modernizr, window) {
Modernizr.addTest('positionfixed', function () {
var test = document.createElement('div'),
control = test.cloneNode(false),
fake = false,
root = document.body || (function () {
fake = true;
return document.documentElement.appendChild(document.createElement('body'));
}());
@eligrey
eligrey / outerHTML.js
Created June 24, 2011 02:56
Efficient outerHTML polyfill that doesn't use cloneNode(true)
/*
* outerHTML.js
* Cross-browser full HTMLElement.outerHTML implementation.
*
* 2011-11-14
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@remy
remy / details.js
Created April 18, 2010 22:28
Add <details> support - includes stylesheet
/**
* Note that this script is intended to be included at the *end* of the document, before </body>
*/
(function (window, document) {
if ('open' in document.createElement('details')) return;
// made global by myself to be reused elsewhere
var addEvent = (function () {
if (document.addEventListener) {
return function (el, type, fn) {
@remy
remy / gist:350433
Created March 31, 2010 14:58
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@jeffrafter
jeffrafter / Crazy IE getter setter proxy hack.html
Created September 18, 2009 23:34
Crazy IE getter setter proxy hack
<!-- modified from http://alex.dojotoolkit.org/08/jscript/lettable.html -->
<html>
<head>
<title>A Crazy Getter/Setter Hack</title>
</head>
<body>
<script language="VBScript" type="text/VBScript">
Function exec_vb_global(code)
ExecuteGlobal(code)
End Function