Reputation: 2057
How can I tell if a given javascript function will work across browsers? For instance, I want to use String.trim() and I see that it works in Firefox, but will it work in all the other major browsers? I imagine there is a good doc online somewhere, but I can't find it.
Upvotes: 0
Views: 360
Reputation: 828100
QuirksMode can give you information but mostly about CSS and DOM.
String.prototype.trim
is a new method, from the ECMAScript 5th Edition Standard.
To check the availability of the new ES5 methods on various browsers, give a look to the following table:
Usually if you are checking which built-in standard methods are available and work propertly across browsers, you can run conformance tests:
Upvotes: 3
Reputation: 3079
The book Dynamic HTML The Definitive Reference by Danny Goodman is a huge help for this type of research.
For example, for the function String.replace(), it tells me it is supported by the following browsers and versions (since): IE 4, NN 4, Moz all, Saf all, Op 7, and has been included in ECMA 3.
Upvotes: 1
Reputation: 72039
Check out the W3Schools JavaScript site, especially the complete references for the various objects. As an example, here's the complete String
reference.
Upvotes: 1