The assertion of the Dart folks over at Google is that the API which has grown organically is inconsistent and unmaintainable. Based on some of their examples I canâ€™t really disagree. Letâ€™s take a look at a couple of them.
getElementsById() getElementsByTagName() getElementsByName() getElementsByClassName() querySelector() querySelectorAll() document.links document.images document.forms document.scripts formElement.elements selectElement.options
Thatâ€™s pretty clear. In Dart your choices are
Thatâ€™s it. All the power of selecting items is still there but it now hidden in the parameters passed to these two functions. The parameters are written in the same DSL as CSS so it is something that web developers already know. Vendor prefixes are another big issue in modern development. When browser vendors create newÂ functionalityÂ they hide it behind a vendor prefix until it is ready for general consumption. Itâ€™s not a big deal if youâ€™re on a rapidly updating browser like FireFox or Chrome but if youâ€™re on IE with yearly release cycles the it is tedious to deal with.
navigator.getMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
Dart abstracts away all those silly vendor prefixes and give you
window.navigator.getUserMedia(audio:true, video: true)
Way nicer! You can still have all the nice syntactic sugar of jQuery but now jQuery itself can be much smaller and easier to maintain because it doesnâ€™t have to smooth out the weirdÂ behaviorsÂ between browsers.