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
/* can you spot what is happening here */ | |
/* the alert("X") should never execute */ | |
<script> | |
onload = function() { | |
var fn = function() { | |
alert("X"); | |
} | |
(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
<html> | |
<head> | |
<title>Quirk Mode Test for Safari 2.0.x and other old browsers</title> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<script type="text/javascript"> | |
// adapted from http://code.google.com/p/doctype/wiki/ArticleCompatMode | |
document.compatMode || (document.compatMode = | |
(function() { | |
var el; (el = document.createElement('div')).style.width = 1; | |
return el.style.width == '1px' ? 'BackCompat' : 'CSS1Compat'; |
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
// first alert(1), then alert(2) | |
var foo = 1; | |
alert(1); | |
var bar = (function(){ alert(2); })(); | |
// first alert(2), then alert(1) | |
var foo=1,bar=(function(){alert(2);})();alert(1); |
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
<!doctype html> | |
<html lang="en" dir="ltr"> | |
<head> | |
<title>NodeList/HTMLCollection conversion/concatenation to array (testing)</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<script type="text/javascript"> | |
// get elapsed time | |
function timeElapsed(t) { return ((new Date()).getTime() - t); } | |
onload = 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>DOM Event test: order of execution</title> | |
<script type="text/javascript"> | |
// W3C DOM Event test | |
(function() { | |
if (document.addEventListener) { |
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
js> File | |
function File() { | |
[native code] | |
} | |
js> Object.prototype.toString.call(File) | |
[object Function] | |
js> | |
js> stats("File") | |
0 0x10084a200 "separator" ENUMERATE READONLY slot 11 flags 4 shortid 0 | |
0 0x10084a1c8 "error" ENUMERATE slot 10 flags 0 shortid 0 |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Focus Test</title> | |
<style type="text/css"> | |
:focus { background-color: red; } | |
</style> | |
<script type="text/javascript"> | |
window.onload = function() { document.body.setAttribute("tabindex", "1"); }; |
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
Prototype._original_property = window.NW; | |
//= require "repository/src/nwmatcher" | |
Prototype.Selector = (function(engine) { | |
function select(selector, scope) { | |
return engine.select(selector, scope || document, Element.extend); | |
} | |
return { | |
engine: engine, |
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 loadScript = (function(global) { | |
return function(url) { | |
var script, | |
// document reference | |
doc = global.document, | |
// root element reference |
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
<html> | |
<head> | |
<title>TouchEvent detection for iPhone/iPod/iPad</title> | |
<script type="text/javascript"> | |
var isTouch = (function() { | |
var event, feature = false, | |
support = function() { feature = true; }, | |
element = document.createElement('div'); |
OlderNewer