mirror of
https://github.com/ariya/phantomjs.git
synced 2024-09-11 12:55:33 +03:00
examples/feature.js: Show supported/unsupported features.
Feature detection is done via Modernizr.
This commit is contained in:
parent
c6db0354ea
commit
da629874d3
@ -4,6 +4,10 @@ Version 1.3.0
|
||||
|
||||
Version 1.3.0 is the next minor update. It is still in the development.
|
||||
|
||||
Examples
|
||||
|
||||
* Added a new example on using Modernizr to detect features.
|
||||
|
||||
2011-06-21: Version 1.2.0
|
||||
|
||||
Version 1.2.0 is a major update. It introduces a whole set of new API.
|
||||
|
30
examples/features.js
Normal file
30
examples/features.js
Normal file
@ -0,0 +1,30 @@
|
||||
var feature, supported = [], unsupported = [];
|
||||
|
||||
phantom.injectJs('modernizr.js');
|
||||
console.log('Detected features (using Modernizr ' + Modernizr._version + '):');
|
||||
for (feature in Modernizr) {
|
||||
if (Modernizr.hasOwnProperty(feature)) {
|
||||
if (feature[0] !== '_' && typeof Modernizr[feature] !== 'function' &&
|
||||
feature !== 'input' && feature !== 'inputtypes') {
|
||||
if (Modernizr[feature]) {
|
||||
supported.push(feature);
|
||||
} else {
|
||||
unsupported.push(feature);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log('Supported:');
|
||||
supported.forEach(function (e) {
|
||||
console.log(' ' + e);
|
||||
});
|
||||
|
||||
console.log('');
|
||||
console.log('Not supported:');
|
||||
unsupported.forEach(function (e) {
|
||||
console.log(' ' + e);
|
||||
});
|
||||
phantom.exit();
|
||||
|
1116
examples/modernizr.js
Normal file
1116
examples/modernizr.js
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user