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
// this is how I fixed IE6-8 crashing on | |
// dynamic insertion of at-rules inside | |
// stylesheets (for example @font-face) | |
// UPDATE: | |
// Fix by MS, move up the style insertion | |
// before the stylesheet rule manipulation | |
function setStyle(rules) { | |
var d = document, |
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
// TODO: should probably convert result to plain array (since different engines return different things -- arrays, nodelists, objects, etc.) | |
var query = (function() { | |
var engine, engines = 'NW.Dom.select,base2.dom.querySelectorAll,Sizzle,$$,$,YAHOO.util.Selector.query,dojo.query,Ext.DomQuery.select'.split(','); | |
while ((engine = engines.shift())) { | |
if (Function('try{return ' + engine + '}catch(e){}')()) { | |
return Function('cssExpr, ctx', 'ctx || (ctx = document);return ' + engine + '(' + | |
(engine.indexOf('base2') > -1 ? 'ctx, cssExpr' : 'cssExpr, ctx') + ')'); | |
} | |
} | |
return 'querySelectorAll' in document ? |
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>IE capabilities detection (clientCaps)</title> | |
<script type="text/javascript"> | |
var r = document.documentElement, capabilities; | |
r.addBehavior("#default#clientCaps"); | |
capabilities = |
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
/* | |
* | |
* readfile.js - Spidermonkey/V8 readfile wrapper | |
* | |
* Author: Diego Perini <diego.perini@gmail.com> | |
* | |
* Released under the Creative Commons license: | |
* http://creativecommons.org/licenses/by/3.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
<script type="text/javascript"> | |
// 'load' events should be supported by every browser | |
// this was just an exercise to find a way to test it | |
var isLoadSupported = 'onload' in window, loadHandler = window.onload; | |
document.createElement('body').setAttribute('onload', 'return'); | |
isLoadSupported = isLoadSupported || typeof window.onload == 'function'; | |
window.onload = loadHandler; |
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
/* | |
* | |
* Feature detect support for capturing load events | |
* | |
* Author: Diego Perini | |
* Updated: 2013/06/25 | |
* | |
* the feature test can be performed before | |
* both 'load' and 'DOMContentLoaded' events | |
* |
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
Testing on code snippet at: https://gist.github.com/991057 | |
Note: used "gzip -n9 file" on Mac to do this comparison. | |
Not very readable, minifier obsoleted & gzip makes size grow | |
**************************************************************** | |
function( | |
a, | |
b |
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>NWMatcher Test</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<script type="text/javascript" src="../../src/nwmatcher-noqsa.js"></script> | |
</head> | |
<body> | |
<div class="a"> | |
<div class="a1"></div> |
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
Adobe Flash LSO (Local Shared Objects) are like super-cookies that never expire and cannot be removed by browsers. | |
The Flash plugin installed in your system allows sites to write/share sensitive informations on your hard disk. | |
These are the simple info I currently have on how to make folders immutable on *NIX OS (Mac and Linux). | |
I have not been able to make immutable folders on my Windows XP VM maybe because I only use FAT32. | |
It seems that Windows allows you to lock files and folders on NTFS volumes only (I miss the info). | |
The following are the location of the folder that should be made immutable on each OS, |
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"> | |
<head><title>CSS and Selectors-API parsing differences</title> | |
<style> | |
/* these rules have a correct "selectorText" so their style declaration are applied */ | |
a[href="#"] { background-color: red; } /* style some elements */ | |
a:not([href="#"]) { background-color: lime; } /* style some elements */ | |
/* these rules have a incorrect "selectorText" so their style declaration are not applied */ | |
a:not([href="#"] { background-color: #f00; } /* doesn't style any element */ |