Test for browser rendering/styling quirks. Extracted from jQuery.
$ component install detects/dom-support
var support = require('dom-support');
console.log(support.opacity) // true in Chrome, false in IE
All properties of the dom-support
object are Boolean
.
IE strips leading whitespace when .innerHTML is used
Make sure that tbody elements aren't automatically inserted. IE will insert them into empty tables
Make sure that link elements get serialized correctly by innerHTML. This requires a wrapper element in IE
Get the style information from getAttribute (IE uses .cssText instead)
Make sure that URLs aren't manipulated. (IE normalizes it by default)
Make sure that element opacity exists (IE uses filter instead) Use a regex to work around a WebKit issue.
Verify style float existence (IE uses styleFloat instead of cssFloat
Make sure that if no value is specified for a checkbox that it defaults to "on". (WebKit defaults to "" instead)
Make sure that a selected-by-default option has a working selected property. (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
Tests for enctype support on a form
Makes sure cloning an html5 element does not cause problems
Detect support for bubbling the corresponding event in non-standard event systems (namely IE).
Test to see if it's possible to delete an expando from an element (Fails in IE)
Cloning a node shouldn't copy over any bound event handlers (IE does this)
Make sure checked status is properly cloned
Make sure that the options inside disabled selects aren't marked as disabled (WebKit marks them as disabled)
Check if a radio maintains its value after being appended to the DOM
WebKit doesn't clone checked state correctly in fragments
Check if a disconnected checkbox will retain its checked value of true after appended to the DOM (IE6/7)
reliableHiddenOffsets
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 determining if an element has been hidden directly using 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)
Checks box-sizing & margin behavior
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 Fails in WebKit before Feb 2011 nightlies WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
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)
Check if elements with layout shrink-wrap their children (IE 6 does this)
MIT