View allDefined.js
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 isDefined(val) { | |
return val != null; | |
} | |
function allDefined() { | |
var | |
i = -1, | |
a = arguments, | |
l = as.length; | |
while (++i < l) if (a[i] == null) return false; |
View agnostic-html-shim.htc.html
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
<PUBLIC:COMPONENT lightWeight="true"> | |
<PUBLIC:ATTACH EVENT="onreadystatechange" FOR="document" ONEVENT="shim()"> | |
<SCRIPT> | |
// an agnostic html shim | |
// it doesn't believe in any particular element... yet! | |
// usage: <style> body { *behavior: url(iepp.htc); } </style> or anything like that | |
// | |
function shim() { | |
// stop if we already believe | |
var doc = element.document;//, elem = doc.createElement('i'); elem.innerHTML = "<iii>"; if (elem.childNodes.length) return; |
View cloneNode.js
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 (win, doc) { | |
// clone element with outerHTML | |
function cloneNodeWithHTML(node) { | |
var xEl = doc.createElement('x-element'); | |
xEl.innerHTML = node.outerHTML || node.nodeValue; | |
return xEl.firstChild; | |
} | |
// match textnodes | |
function matchInnerNodes (nodeA, nodeB) { | |
// get childNodes Length |
View cross-browser-text-selection.js
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 (win, doc) { | |
function getRangeAtCollapse(range, collapsed) { | |
// get range as item | |
if (range.item) { | |
var rangeItem = range.item(0); | |
// return the data | |
return { node: rangeItem }; | |
} | |
// get range as text | |
var |
View ie-currentStyle-without-reflow.js
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 (doc) { | |
var docEl = document.documentElement; | |
// get current style | |
window.getCurrentStyle = function (node) { | |
if (!node || !node.nodeName) return; | |
var docElClone = docEl.cloneNode(true), a, l, i; | |
for (a = docEl.getElementsByTagName(node.nodeName), l = a.length, i = 0; a[i] !== node; ++i); | |
return docElClone.getElementsByTagName(node.nodeName)[i].currentStyle; | |
}; | |
})(document); |
View processStyle.js
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 (win, doc) { | |
var frag = doc.createDocumentFragment(); | |
// expand css | |
function expandCSS(responseText, dirname) { | |
return responseText | |
// correct urls | |
.replace(/url\(['"]?(.+?)['"]?\)/g, 'url(' + dirname + '$1)') | |
// uncorrect behavior urls | |
.replace(/behavior:\s*url\((.*?)\)/g, function (url) { return url.replace(dirname, ''); }) | |
// import imports |
View cssToObject.js
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
cssString = '#navbar, #sidebar { width: 80%; height: 23px; ul, ol { list-style-type: none; } li { float: left; a { font-weight: bold; } } } #main { background: #000; }'; | |
cssObject = [{ | |
type: 'rule', | |
selectors: [ '#navbar', '#sidebar' ], | |
declarations: [{ | |
type: 'declaration', | |
property: 'width', | |
value: '80%' | |
}, { |
View orientation-tests.txt
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
innerWidth / innerHeight tests @ http://sandbox.thewikies.com/orientation/ | |
-------------------------------------------------------------------------------- | |
Tested (14 devices, 28 browsers): | |
Droid 2 Global Android 2.2 | |
iPhone 4 iOS5 (Safari, Opera Mini) | |
Motorola Atrix Android 2.3.4 (Stock browser, Dolphin, Skyfire, Opera Mini, Firefox) | |
Samsung Galaxy S9000 Android 2.3 (Webkit, Opera Mobile) | |
Samsung Galaxy Y Android 2.3.5 |
OlderNewer