Skip to content

Instantly share code, notes, and snippets.

View kangax's full-sized avatar

Juriy Zaytsev kangax

View GitHub Profile
<p class=">">
// outerHTML in Chrome (17): <p class="&gt;">
// outerHTML in Opera (12): <p class=">">
<input disabled>
// outerHTML in Chrome (17) and Opera (12): <input disabled="">
<input />
function makeFunc(o) {
return function() {
o.otherMethod();
};
}
var obj = {
method: makeFunc({
otherMethod: function() {
throw 1;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://raw.github.com/kangax/fabric.js/gh-pages/dist/all.js"></script>
</head>
<body>
<canvas id="c" width="600" height="500"></canvas>
<script>
@kangax
kangax / gist:1051534
Created June 28, 2011 16:28 — forked from maxim/progressify.rb
Progressify - a progress bar approximator for smoothness
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Progressify</title>
<script>
var Plot = (function() {
function Point(duration, progress) {
this.duration = duration;
@kangax
kangax / gist:1032025
Created June 17, 2011 18:48
IE9 developer tools annoyances
  1. Can't debug in minimized pane

  2. console.log(1, 2, 3) shows 123 (not 1 2 3)

  3. console.log(undefined, "undefined") shows undefinedundefined. Ditto for null and "null"

  4. Object properties that are on prototype chain are displayed in console (e.g. console.log("foo") displays object with anything defined on String.prototype)

  5. Can't inspect logged object (by clicking on it) [CLOSED BY DESIGN]

Prototype 1.7 + IE9
>> $$('.main')[0].outerHTML.substring(0,59)
"<section style="opacity: 0;" class="main promotion_editor">"
>> $$('.main')[0].getOpacity()
1
/**
* Provides requestAnimationFrame in a cross browser way.
* @author greggman / http://greggman.com/
*/
if (!window.requestAnimationFrame) {
window.requestAnimationFrame =
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
A UnicodeEscapeSequence cannot be used to put a character into an IdentifierName that would otherwise be illegal. In other words, if a \ UnicodeEscapeSequence sequence were replaced by its UnicodeEscapeSequence's CV, the result must still be a valid IdentifierName that has the exact same sequence of characters as the original IdentifierName.
ES5, 7.6
// Chrome pet peeve with console logging
var arr = [ ];
for (var i = 0; i < 3; i++) {
arr.push(i);
console.log('foo', arr);
}
/*
Actual: