What is the difference between feature detection and feature inference

6

I wanted to know what the main difference between the two feature and feature inference forms >     

asked by anonymous 03.06.2014 / 05:04

1 answer

6

Feature detection is to verify that the function is available to be used explicitly.

Feature inference is to check if a function is available and, based on that, assume that another function is also available.

Feature Detection:

if (window.XMLHttpRequest) {
    new XMLHttpRequest();
}

Feature inference:

if (document.getElementsByTagName){
element = document.getElementById(id);
}

Source: Question SO In

    
03.06.2014 / 05:07