Skip to content

Commit

Permalink
more docs around webgl and inline svg test. fixes Modernizr#222
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed May 22, 2011
1 parent 1ec607e commit f43048a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,13 @@ window.Modernizr = (function( window, document, undefined ) {
return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
};

// This WebGL test false positives in FF depending on graphics hardware. But really it's quite impossible to know
// wether webgl will succeed until after you create the context. You might have hardware that can support
// a 100x100 webgl canvas, but will not support a 1000x1000 webgl canvas. So this feature inference is weak,
// but intentionally so.
// This WebGL test may false positive.
// But really it's quite impossible to know whether webgl will succeed until after you create the context.
// You might have hardware that can support a 100x100 webgl canvas, but will not support a 1000x1000 webgl
// canvas. So this feature inference is weak, but intentionally so.

// It is known to false positive in FF4 with certain hardware and the iPad 2.

tests['webgl'] = function() {
return !!window.WebGLRenderingContext;
};
Expand Down Expand Up @@ -738,14 +741,15 @@ window.Modernizr = (function( window, document, undefined ) {
return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
};

// specifically for SVG inline in HTML, not within XHTML
// test page: paulirish.com/demo/inline-svg
tests['inlinesvg'] = function() {
var div = document.createElement('div');
div.innerHTML = '<svg/>';
return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
};

// Thanks to F1lt3r and lucideer
// http://github.com/Modernizr/Modernizr/issues#issue/35
// Thanks to F1lt3r and lucideer, ticket #35
tests['smil'] = function() {
return !!document.createElementNS && /SVG/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
};
Expand Down

0 comments on commit f43048a

Please sign in to comment.