aboutsummaryrefslogtreecommitdiffstats
path: root/src/support.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2012-09-30 20:54:28 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-09-30 20:54:28 -0400
commit22fac5c2e40b00911933040afaf9adcdd2c00ac2 (patch)
tree4185db0022a84a22635346724870954b1d50ca94 /src/support.js
parentf9ef91d6d68dc7317bb12c1ae2a8201f28facff1 (diff)
downloadjquery-22fac5c2e40b00911933040afaf9adcdd2c00ac2.tar.gz
jquery-22fac5c2e40b00911933040afaf9adcdd2c00ac2.zip
Fix #12357: be more kind to non-browser environments. Close gh-938.
Diffstat (limited to 'src/support.js')
-rw-r--r--src/support.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/support.js b/src/support.js
index 68ca91b3a..f998f1270 100644
--- a/src/support.js
+++ b/src/support.js
@@ -13,24 +13,23 @@ jQuery.support = (function() {
clickFn,
div = document.createElement("div");
- // Preliminary tests
+ // Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+ // Support tests won't run in some limited or non-browser environments
all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ];
- a.style.cssText = "top:1px;float:left;opacity:.5";
-
- // Can't get basic test support
- if ( !all || !all.length ) {
+ if ( !all || !a || !all.length ) {
return {};
}
- // First batch of supports tests
+ // First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
+ a.style.cssText = "top:1px;float:left;opacity:.5";
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
@@ -72,7 +71,7 @@ jQuery.support = (function() {
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
- // Tests for enctype support on a form(#6743)
+ // Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems