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
eCSStender.register( | |
{'selector': 'p'}, | |
'*', | |
function( selector, properties, media, specificity ) | |
{ | |
console.log('eCSStender matched the selector "' + selector + | |
'" in the media type ' + media + '. It’s properties follow:'); | |
console.log(properties); | |
console.log('The specificity of this selector is ' + specificity); | |
} |
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>Circular references between JavaScript and DOM</title> | |
<script type="text/javascript"> | |
// <![CDATA[ | |
var obj; | |
window.onload = function() | |
{ | |
obj = document.getElementById("DivElement"); | |
document.getElementById("DivElement").expandoProperty = obj; |
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
window.onload = function() | |
{ | |
var | |
body = document.getElementsByTagName('body')[0], | |
div = document.createElement('div'), | |
parentDiv, childDiv; | |
for ( i = 0; i < 5000; i++ ) | |
{ | |
parentDiv = div.cloneNode(true); | |
parentDiv.onclick = foo; |
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 directPassing ( string ) | |
{ | |
return string.match( /abc/ ); | |
} |
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 usingConstructors( string ) | |
{ | |
var a = new Array(), o = new Object(); | |
} |
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 camelize( str ) | |
{ | |
var | |
HYPHEN = '-', | |
bits = str.split(HYPHEN), | |
length = bits.length, | |
i = 1, | |
new_str; | |
if ( length == 1 ) { return bits[0]; } | |
if ( str.charAt(0) == HYPHEN ) { |
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 camelize( str ) | |
{ | |
var | |
HYPHEN = '-', | |
bits = str.split(HYPHEN), | |
length = bits.length, | |
i = 1, | |
new_str; | |
if ( length == 1 ) { return bits[0]; } | |
if ( str.charAt(0) == HYPHEN ) { |
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 f( a ) | |
{ | |
if ( a == 1 ) | |
{ | |
// do something | |
} | |
} |
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 ( a++, b == 5 ) | |
{ | |
// always increments a, but ONLY enters the block if b == 5 | |
} |
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 someFunction( n ) | |
{ | |
n |= 1; | |
// same as n = n || 1; | |
// doesn't work with anything but numbers | |
} |
OlderNewer