Is there any standard for WEB/DOM/BOM API which all browsers adhere to? Something like ECMAScript.
var aElements = document.querySelectorAll('a');
How to make sure the line mentioned above works across the browsers I intend to support?
Is there any standard for WEB/DOM/BOM API which all browsers adhere to? Something like ECMAScript.
var aElements = document.querySelectorAll('a');
How to make sure the line mentioned above works across the browsers I intend to support?
Theoretically, yes (in most cases), there is standards.
Practically, no, you can't be sure something works cross browser. For that you need to test it on all you intend to support.
Below you find some useful links, where others have made some of these tests, and put it together, to make life somewhat simpler for us developers...so a big Thank you to them, as official resources can be a pain to read and understand.
The reason is quite simple, browser manufacturer can, and sometimes do, interpret set standards in their own way, which can lead to different behavior (often called "browser bugs").
There is also the time between a given standard is set to take into account, and for all manufacturer to actually implement it. This is often where prefixed properties comes into play, before drafted new/updated properties have been standardized.
Some useful links: