From 2942be780f3f243dbf82ca012bba284846afee13 Mon Sep 17 00:00:00 2001 From: timmywil <tim.willison@thisismedium.com> Date: Fri, 22 Apr 2011 00:27:52 -0400 Subject: Combine the support tests for radioValue and appendChecked --- src/support.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/support.js') diff --git a/src/support.js b/src/support.js index 8f2beebbc..178bddf05 100644 --- a/src/support.js +++ b/src/support.js @@ -115,13 +115,15 @@ jQuery.support = (function() { div.cloneNode( true ).fireEvent( "onclick" ); } + // Check if a radio maintains it's value + // after being appended to the DOM input = document.createElement("input"); input.value = "t"; input.setAttribute("type", "radio"); support.radioValue = input.value === "t"; - div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; - + input.setAttribute("checked", "checked"); + div.appendChild( input ); fragment = document.createDocumentFragment(); fragment.appendChild( div.firstChild ); @@ -148,6 +150,10 @@ jQuery.support = (function() { body.appendChild( div ); document.documentElement.appendChild( body ); + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + support.boxModel = div.offsetWidth === 2; if ( "zoom" in div.style ) { @@ -186,14 +192,6 @@ jQuery.support = (function() { support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); div.innerHTML = ""; - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM - input = document.createElement("input"); - input.setAttribute("type", "checkbox"); - input.checked = true; - div.appendChild( input ); - support.appendChecked = input.checked; - // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. For more // info see bug #3333 -- cgit v1.2.3