diff options
-rw-r--r-- | components/script/dom/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 8d13c104aa1..a5d8e7a707a 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -157,18 +157,18 @@ //! Inheritance and casting //! ======================= //! -//! For all DOM interfaces `Foo` in an inheritance chain, a -//! `dom::bindings::inheritance::FooCast` provides methods to cast -//! to other types in the inheritance chain. For example: +//! All DOM interfaces part of an inheritance chain (i.e. interfaces +//! that derive others or are derived from) implement the trait `Castable` +//! which provides both downcast and upcasts. //! //! ```ignore -//! # use script::dom::bindings::inheritance::{NodeCast, HTMLElementCast}; +//! # use script::dom::bindings::inheritance::Castable; //! # use script::dom::element::Element; //! # use script::dom::node::Node; //! # use script::dom::htmlelement::HTMLElement; //! fn f(element: &Element) { //! let base = element.upcast::<Node>(); -//! let derived = element.downcast::<HTMLElement>(); +//! let derived = element.downcast::<HTMLElement>().unwrap(); //! } //! ``` //! |