Language / Prior Art | ‘Valid’ HTML | HTML Mapping | Example | Example with Args |
---|---|---|---|---|
‘Valid’ | CSS Selectable | CSS Mapping | CSS Select | CSS Selector w Args |
JavaScript MooTools | Multiple instance Separate Args | new Foo(element); new Bar(element) |
new Foo(element, {a:"a", bB:"b B", c:{c:1}}); new Bar(element, {d:"d"}) |
|
— | — | — | — | — |
HTML attr Dojo <1.6 | NO |
// JS Module Pattern: | |
// http://j.mp/module-pattern | |
// Redefine: $, window, document, undefined. | |
var APP = (function($, window, document, undefined) { | |
// Automatically calls all functions in APP.init | |
$(document).ready(function() { | |
APP.go(); | |
}); |
//EnhanceJS isIE test idea | |
//detect IE and version number through injected conditional comments (no UA detect, no need for cond. compilation / jscript check) | |
//version arg is for IE version (optional) | |
//comparison arg supports 'lte', 'gte', etc (optional) | |
function isIE(version, comparison) { | |
var cc = 'IE', | |
b = document.createElement('B'), |
/* | |
* object.watch polyfill | |
* | |
* 2012-04-03 | |
* | |
* By Eli Grey, http://eligrey.com | |
* Public Domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ |
sub, sup { | |
/* Specified in % so that the sup/sup is the | |
right size relative to the surrounding text */ | |
font-size: 75%; | |
/* Zero out the line-height so that it doesn't | |
interfere with the positioning that follows */ | |
line-height: 0; | |
/* Where the magic happens: makes all browsers position |
function multiply(a, b) { | |
return a * b; | |
} | |
function divide(a, b) { | |
if (b === 0) { | |
throw "Don't try to divide by zero!"; | |
} | |
return Math.round(a / b); |
//set location of "noext!" plugin | |
//(this setting should be on the top-level of your app, inside your "main.js" or HTML file) | |
//you could also omit this setting and just place the "ext.js" file in the `baseUrl` folder. | |
require({ | |
paths : { | |
noext : 'path_to_plugin/noext' | |
} | |
}); | |
//load file without appending ".js" extension |
Consolidated lists of CSS properties that are inherited by default. | |
Taken from http://www.w3.org/TR/CSS21/propidx.html | |
-------------------------------------------------------------------- | |
One item not in the list was "text-decoration" which affects child elements. A few new properties (text-shadow) also affect child elements | |
List | |
azimuth | |
border-collapse |
#Mobile Device Detection via User Agent RegEx
Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.
I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.
The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".
Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |