aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/mod.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-02-01 17:52:40 +0100
committerMs2ger <ms2ger@gmail.com>2015-02-05 14:41:12 +0100
commite596afe22d622fc292c4506a8f6550179198662d (patch)
tree6eeb6c8cc7202bf4d510c2b20fdd62baef5c2156 /components/script/dom/bindings/mod.rs
parent8e9939d01f83187943adf359e579827d509f0b8a (diff)
downloadservo-e596afe22d622fc292c4506a8f6550179198662d.tar.gz
servo-e596afe22d622fc292c4506a8f6550179198662d.zip
Document the DOM.
This is by no means complete, but it is a good place to start.
Diffstat (limited to 'components/script/dom/bindings/mod.rs')
-rw-r--r--components/script/dom/bindings/mod.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs
index 54d564965e2..c5709f01e8f 100644
--- a/components/script/dom/bindings/mod.rs
+++ b/components/script/dom/bindings/mod.rs
@@ -3,6 +3,27 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! The code to expose the DOM to JavaScript through IDL bindings.
+//!
+//! Exposing a DOM object to JavaScript
+//! ===================================
+//!
+//! As [explained earlier](../index.html#a-dom-object-and-its-reflector), the
+//! implementation of an interface `Foo` involves two objects: the DOM object
+//! (implemented in Rust) and the reflector (a `JSObject`).
+//!
+//! In order to expose the interface's members to the web, properties
+//! corresponding to the operations and attributes are defined on an object in
+//! the reflector's prototype chain or on the reflector itself.
+//!
+//! Typically, these properties are either value properties whose value is a
+//! function (for operations) or accessor properties that have a getter and
+//! optionally a setter function (for attributes, depending on whether they are
+//! marked `readonly`).
+//!
+//! All these JavaScript functions are set up such that, when they're called,
+//! they call a Rust function in the generated glue code. This glue code does
+//! some sanity checks and [argument conversions](conversions/index.html), and
+//! calls into API implementation for the DOM object.
#![allow(unsafe_blocks)]
#![deny(missing_docs, non_snake_case)]