Skip to Main content Skip to Navigation
Conference papers

A declarative-friendly API for Web document manipulation

Abstract : The Document Object Model (DOM) is the document manipulation API provided to the JavaScript developer by the browser. It allows to modify parts of the current Web page from a client side script. The principle is interesting and powerful, and no modern Web development could be possible without it. But the implementation is not satisfactory when seeking predictability and reliability, such as expected with declarative languages or static type systems. Primitives are too generic, and when called in abnormal conditions can either throw exceptions or perform implicit imperative actions. In particular, DOM primitives can conditionally and implicitly move nodes in the document, in a way very difficult to be statically prevented or even detected. In this article, we introduce cDOM, an alternative document model that performs implicit deep copies instead of moves. By not moving their children implicitly, it preserves the structure of nodes after their creation and between explicit mutations. Moreover, it manages to provide a sensible way to duplicate side data embedded in the document (such as event handlers), so that the copies are completely similar in structure to the originals. It thus provides a more usual semantics, over which existing declarative abstractions and type systems can be used in a sound way.
Complete list of metadatas

https://hal.archives-ouvertes.fr/hal-00826790
Contributor : Vincent Balat <>
Submitted on : Tuesday, May 28, 2013 - 12:17:08 PM
Last modification on : Friday, March 27, 2020 - 4:00:05 AM

Links full text

Identifiers

Citation

Benjamin Canou, Emmanuel Chailloux, Vincent Balat. A declarative-friendly API for Web document manipulation. International Symposium on Practical Aspects of Declarative Languages (PADL 2013), Jan 2013, Rome, Italy. pp.109-124, ⟨10.1007/978-3-642-45284-0_8⟩. ⟨hal-00826790⟩

Share

Metrics

Record views

193