This is a module for unified feature detection. If there is a dom api corresponding to these detected values and its behavior is the same as that of most standard browsers, it is true; otherwise, it is false. If the value of false is greater, the browser lags behind. In my test list, ff9 is the best, all of which are true, not to mention which one is the worst. Even ie9 is not satisfactory. I still need to make n compatibility for it.Code. WebKit is not as good as you think. There is a long way to go to standardization.
Improvements in the current version:
- Features such as boxmodel, inlineblock, keepsize, and csspercentedmargin can be detected only after domready. Therefore, the feature is processed later.
- Some features were renamed, cloneall was renamed to clonenode, attrselected was renamed to optselected, inlineblockneedslayout was renamed to inlineblock, and shrinkwrapblocks was renamed to keepsize.
- Remove reliablehiddenoffsets and add csspercentedmargin, clonehtml5, and clonechecked.
The following is a list of features for mass framework sniffing:
Name |
Details |
Inserttbody |
The standard browser adds tbody only when there is no tbody between the table and TR, while ie678 is too stupid, that is, the tbody is empty in it. |
Checkon |
In most browsers, the value of checkbox is on by default, and only chrome returns an empty string. |
Optselected |
When a new option element is added to the select element, this option is selected, but IE and Safari did not, you need to access its parent element before it can be selected (Bug) |
Optdisabled |
Determine whether the option element inside the select element of disabled also has the diabled attribute. |
Attrhref |
Ie67 cannot distinguish href attributes from features (Bug) |
Attrstyle |
Ie67 does not have the style feature (feature value type is text), and only El. style (cssstyledeclaration) (Bug) |
Attrprop |
For some special features such as class, for, Char, and ie67, You need to map to use getattribute to get the value (Bug) |
Cssopacity |
Whether the opacity style value can be returned correctly |
Traverseall |
Getelementbytagname ("*") of ie678 cannot traverse the param element (Bug) of the object element) |
Createall |
Ie678 cannot generate link, style, and script nodes through innerhtml (Bug) |
Clonehtml5 |
Ie6789 because the HTML5 new tags cannot be identified, these new elements are also incorrect (Bug) |
Clonenode |
In a standard browser, clonenode (true) does not copy events to prevent loop references from releasing memory, but IE does not take this into account and copies the events (inconformity) |
Clonechecked |
After the checkbox and radio controls of ie6789 are implemented in clonenode (true), the new elements do not inherit the original checked attribute (Bug) |
Fastfragment |
Fastfragment supports the createcontextualfragment API. This method originated from ff3. Therefore, many Browsers Do not support or implement bugs, but it is the most efficient way to convert strings into document fragments. |
Inlineblock |
In ie678, when the size and haslayout of non-replacement elements are set, the parent-level elements are extended (inconformity) |
Csspercentedmargin |
Does the getcomputedstyle API Support automatic conversion of original margin percentage values to pixel values? |
Boxmodel |
Whether to follow the W3C box boxmodel to calculate the element size (ie has a weird mode, inconformity) |
Source Code address