X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fsupport.js;h=67b41c4a7a34b79b347ea2a21a7f92c916837fad;hb=3e38a861fee065fa1a6e7678eefe90b2379fed8e;hp=878db1f0ba401d1986b8dbbc0c705fafb66c50ac;hpb=0cdcef5b364fa3c89d7f27935e77b453f4a56efd;p=jquery.git
diff --git a/src/support.js b/src/support.js
index 878db1f..67b41c4 100644
--- a/src/support.js
+++ b/src/support.js
@@ -61,12 +61,14 @@
optSelected: opt.selected,
// Will be defined later
+ deleteExpando: true,
optDisabled: false,
checkClone: false,
scriptEval: false,
noCloneEvent: true,
boxModel: null,
inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
reliableHiddenOffsets: true
};
@@ -90,6 +92,15 @@
delete window[ id ];
}
+ // Test to see if it's possible to delete an expando from an element
+ // Fails in Internet Explorer
+ try {
+ delete script.test;
+
+ } catch(e) {
+ jQuery.support.deleteExpando = false;
+ }
+
root.removeChild( script );
if ( div.attachEvent && div.fireEvent ) {
@@ -120,17 +131,25 @@
document.body.appendChild( div );
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
- // Check if natively block-level elements act like inline-block
- // elements when setting their display to 'inline'
- // (IE < 8 does this)
- if ( 'zoom' in div.style ) {
- div.style.display = 'inline';
-
- // Layout is necessary to trigger this âfeatureâ
+ if ( "zoom" in div.style ) {
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ // (IE < 8 does this)
+ div.style.display = "inline";
div.style.zoom = 1;
jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
+
+ // Check if elements with layout shrink-wrap their children
+ // (IE 6 does this)
+ div.style.display = "";
+ div.innerHTML = "
";
+ jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
}
+ div.innerHTML = "";
+ var tds = div.getElementsByTagName("td");
+
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
@@ -138,48 +157,40 @@
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
- div.innerHTML = '';
- jQuery.support.reliableHiddenOffsets = div.getElementsByTagName('td')[0].offsetHeight === 0;
- div.innerHTML = '';
+ jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
- document.body.removeChild( div ).style.display = 'none';
- div = null;
+ tds[0].style.display = "";
+ tds[1].style.display = "none";
+
+ // Check if empty table cells still have offsetWidth/Height
+ // (IE < 8 fail this test)
+ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
+ div.innerHTML = "";
+
+ document.body.removeChild( div ).style.display = "none";
+ div = tds = null;
});
// Technique from Juriy Zaytsev
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
- var eventSupported = function( eventName ) {
- var el = document.createElement("div");
- eventName = "on" + eventName;
-
- var isSupported = (eventName in el);
- if ( !isSupported ) {
- el.setAttribute(eventName, "return;");
- isSupported = typeof el[eventName] === "function";
- }
- el = null;
-
- return isSupported;
+ var eventSupported = function( eventName ) {
+ var el = document.createElement("div");
+ eventName = "on" + eventName;
+
+ var isSupported = (eventName in el);
+ if ( !isSupported ) {
+ el.setAttribute(eventName, "return;");
+ isSupported = typeof el[eventName] === "function";
+ }
+ el = null;
+
+ return isSupported;
};
-
+
jQuery.support.submitBubbles = eventSupported("submit");
jQuery.support.changeBubbles = eventSupported("change");
// release memory in IE
root = script = div = all = a = null;
})();
-
-jQuery.props = {
- "for": "htmlFor",
- "class": "className",
- readonly: "readOnly",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- rowspan: "rowSpan",
- colspan: "colSpan",
- tabindex: "tabIndex",
- usemap: "useMap",
- frameborder: "frameBorder"
-};
-
})( jQuery );