aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/node.rs')
-rw-r--r--src/components/script/dom/node.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs
index 6e94d2f8ef0..7bf7e53b7ac 100644
--- a/src/components/script/dom/node.rs
+++ b/src/components/script/dom/node.rs
@@ -349,6 +349,13 @@ impl<'self, View> AbstractNode<View> {
self.transmute(f)
}
+ pub fn with_mut_text<R>(self, f: &fn(&mut Text) -> R) -> R {
+ if !self.is_text() {
+ fail!(~"node is not text");
+ }
+ self.transmute_mut(f)
+ }
+
pub fn is_element(self) -> bool {
match self.type_id() {
ElementNodeTypeId(*) => true,