A declarative-friendly API for Web document manipulation - Archive ouverte HAL Accéder directement au contenu
Communication Dans Un Congrès Année : 2013

A declarative-friendly API for Web document manipulation

Résumé

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.

Dates et versions

hal-00826790 , version 1 (28-05-2013)

Identifiants

Citer

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⟩
86 Consultations
0 Téléchargements

Altmetric

Partager

Gmail Facebook X LinkedIn More