JavaScript - Feature Detection
// JavaScript - Feature detection versus Feature Inference:
Feature inference is less reliable than feature detection. Feature inference
is making assumption that a particular feature is available based on another
feature is available or not. For example, Chrome implements the Text function.
I also know Chrome doesn’t have applyElement like IE does.
if(typeof applyElement != 'undefined') {
// now I know I'm not in IE, I'll just assume Text is available
text = new Text('Oh, how quick that fox was!');
}
Someone looked at that code in Firefox which doesn’t implement applyElement or
Text! They got an error.
page revision: 0, last edited: 14 Nov 2016 08:36





