Dompletion: DOM-Aware JavaScript Code Completion

Kartik Bajaj, Karthik Pattabiraman and Ali Mesbah, To appear in the Proceedings of the IEEE/ACM International Conference on Automated Software Engineering (ASE), 2014. [ PDF | Talk ] (Acceptance Rate: 20%)

Abstract: JavaScript is a scripting language that plays a prominent role in modern web applications. It is dynamic in nature and interacts heavily with the Document Object Model (DOM) at runtime. These characteristics make providing code completion support to JavaScript programmers particularly challenging. We propose an automated technique that reasons about existing DOM structures, dynamically analyzes the JavaScript code, and provides code completion suggestions for JavaScript code that interacts with the DOM through its APIs. Our automated code completion scheme is implemented in an open source tool called DOMPLETION. The results of our empirical evaluation indicate that (1) DOM structures exhibit patterns, which can be extracted and reasoned about in the context of code completion suggestions; (2) DOMPLETION can provide code completion suggestions with a recall of 89% and precision of 90% with an average time of 2.8 seconds.