Skip to content

Instantly share code, notes, and snippets.

document.activeElement
document.addBinding
document.addEventListener
document.addEventSource
document.adoptNode
document.alinkColor
document.all
document.anchors
document.appendChild
document.applets
// function $testFunk(arg1,arg2,arg3){
// this.arg1 = arg1;
// this.arg2 = arg2;
// this.arg3 = arg3;
// };
// var shmoo = {
// fred: new $testFunk(1,2,3),
// fred1: new $testFunk(1,2,3),
// fred2: new $testFunk(1,2,3),
// fred3: new $testFunk(1,2,3)
//IE6
'RENDERING_INTENT_ABSOLUTE_COLORIMETRIC' is null or not an object
'RENDERING_INTENT_RELATIVE_COLORIMETRIC' is null or not an object
'SVG_PRESERVEASPECTRATIO_UNKNOWN' is null or not an object
'SVG_PRESERVEASPECTRATIO_XMAXYMAX' is null or not an object
'SVG_PRESERVEASPECTRATIO_XMAXYMID' is null or not an object
'SVG_PRESERVEASPECTRATIO_XMAXYMIN' is null or not an object
'SVG_PRESERVEASPECTRATIO_XMIDYMAX' is null or not an object
'SVG_PRESERVEASPECTRATIO_XMIDYMID' is null or not an object
'SVG_PRESERVEASPECTRATIO_XMIDYMIN' is null or not an object
@subtleGradient
subtleGradient / HOWTO.js
Created May 3, 2009 16:58
A better Function binds idiom?
/*
How to bind a function to an object manually
*/
function myFunkyFunction(){
alert(this.innerHTML);
};
(function(){
var div1 = document.createElement('div'); document.body.appendChild(div1); div1.innerHTML = 'myDiv 1';
// -*- Mode: MooTools Javascript; tab-width: 4; -*-
// @require 'mootools'
var MyClass = new Class({
Implements: Events,
initialize: function(){
},
Function.prototype.remember = function remember(delay,maxConcurrentRuns){
maxConcurrentRuns = maxConcurrentRuns || 1;
var self = this, tim, result, block=0;
function resetBlock(){ block --; };
function rememberWrapper(){
if (block < maxConcurrentRuns) {
block ++;
result = self.apply(this,arguments);
if (delay) setTimeout(resetBlock, delay);
}
// inspired by jQuery watch: http://plugins.jquery.com/files/jquery-watch.js.txt
(function(){
var watch = Object.prototype.watch,
unwatch = Object.prototype.unwatch,
watched = [],
timer;
Object.watch = function(obj, prop, fn){
// MooTools Method Wrappers
var MyClass = new Class({
Implements: Bind,
MethodMutators:true,
initilize: function(){
this.setBinds();
String.prototype.toRegExp = function(){
var match = this.match(/^\/(.*)\/([gimsx]{0,5})$/);
console.log(match)
return (match) ? new RegExp(match[1], match[2]) : new RegExp(this);
}
document.write("/flarm/gim" === /flarm/mig.toString());document.write('\n');
document.write("/flarm/gim".toRegExp().toString() === /flarm/mig.toString());document.write('\n');
document.write("/fl\
// -*- Mode: MooTools Javascript; tab-width: 4; -*-
// Proposed syntax. Not fully functional atm.
/*
EG: a menu system
a menu is open while in the the menu-open state
when the menu-open state is removed, the menu should be closed
the menu-open state must be false 100 ms after the last mouseout even it fired
*/