Skip to content

Commit

Permalink
test stubs, urls to the techniques.
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanMcMillan committed Apr 3, 2011
1 parent c14d17b commit 24e982f
Showing 1 changed file with 56 additions and 3 deletions.
59 changes: 56 additions & 3 deletions exploration/cgrade.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,63 @@
(function(document) {
var target,
var target, tests = {}, test = 'standards-mode',
docElem = document.documentElement,
SCRIPT = "script",
TEXTJS = "text/javascript",
STYLE = "style",
TEXTCSS = "text/css";

tests['pass'] = {
pre: function() { return true;},
test: function() {
return true;
}
};

tests['fail'] = {
pre: function() { return false;},
test: function() {
return false;
}
};

tests['standards-mode'] = {
pre: function() { return true;},
test: function() {
// http://acidmartin.wordpress.com/2008/10/21/using-compatmode-to-determine-the-standards-compliance-mode-of-the-page-on-the-client/
return document.compatMode === 'CSS1Compat';
}
};

tests['css2-selectors'] = {
pre: function() { return true;},
test: function() {

}
};

tests['inline-block'] = {
pre: function() { return true;},
test: function() {

}
};

tests['inline-block-no-workaround'] = {
pre: function() { return true;},
test: function() {

}
};

tests['w3c-events'] = {
pre: function() { return true;},
test: function() {

}
};

function theTest() {
return true;
return tests[test].test();
}

function preTest() {
Expand All @@ -21,6 +72,7 @@
}

function putInHead(elem) {
// http://www.stevesouders.com/blog/2010/05/11/appendchild-vs-insertbefore/
target.parentNode.insertBefore(elem, target);
}

Expand All @@ -33,10 +85,11 @@
}

function insertFoucPreventer() {
$(document.documentElement).removeClass("no-js").addClass("js loading");
docElem.className = docElem.className.replace(/\bno-js\b/i, "js loading");

var style = buildDynamicTag(STYLE, TEXTCSS);
var css = ".loading .hideload {display:none};";
// http://www.phpied.com/dynamic-script-and-style-elements-in-ie/
if (style.styleSheet) {
//weird IE way
style.styleSheet.cssText = css;
Expand Down

0 comments on commit 24e982f

Please sign in to comment.