arielsalminen / feature.js

Feature.js is a fast, simple and lightweight browser feature detection library in 1kb.
https://featurejs.com/
3.17k stars 115 forks source link

Faster Canvas support detection #30

Closed jbmonroe closed 5 years ago

jbmonroe commented 8 years ago
canvas : function () { return !!window.HTMLCanvasElement; },

It's tons faster since it doesn't require the overhead of creating an element.

This also works:

canvas : function () { return !!window.CanvasRenderingContext2D; },

See http://stackoverflow.com/questions/2745432/best-way-to-detect-that-html5-canvas-is-not-supported

meowsus commented 5 years ago

Thanks for the suggestion, @jbmonroe. I'll check it out!

meowsus commented 5 years ago

Ah! This method is already implemented! Closing.