For loops and misc changes

This commit is contained in:
Keegan McAllister 2013-08-09 15:46:10 -07:00
parent 1bdaff0fad
commit 307f1074d3
42 changed files with 220 additions and 243 deletions

View file

@ -270,11 +270,11 @@ impl Document {
fail!("no SVG document yet")
},
_ => {
let _ = for self.root.traverse_preorder |node| {
let _ = for node in self.root.traverse_preorder() {
if node.type_id() != ElementNodeTypeId(HTMLTitleElementTypeId) {
loop;
}
for node.children().advance |child| {
for child in node.children() {
if child.is_text() {
do child.with_imm_text() |text| {
let s = text.parent.Data();
@ -299,17 +299,17 @@ impl Document {
},
_ => {
let (_scope, cx) = self.get_scope_and_cx();
let _ = for self.root.traverse_preorder |node| {
let _ = for node in self.root.traverse_preorder() {
if node.type_id() != ElementNodeTypeId(HTMLHeadElementTypeId) {
loop;
}
let mut has_title = false;
for node.children().advance |child| {
for child in node.children() {
if child.type_id() != ElementNodeTypeId(HTMLTitleElementTypeId) {
loop;
}
has_title = true;
for child.children().advance |title_child| {
for title_child in child.children() {
child.remove_child(title_child);
}
let new_text = unsafe {
@ -427,7 +427,7 @@ impl Document {
pub fn createHTMLCollection(&self, callback: &fn(elem: &Element) -> bool) -> @mut HTMLCollection {
let mut elements = ~[];
let _ = for self.root.traverse_preorder |child| {
let _ = for child in self.root.traverse_preorder() {
if child.is_element() {
do child.with_imm_element |elem| {
if callback(elem) {
@ -441,7 +441,7 @@ impl Document {
}
pub fn content_changed(&self) {
for self.window.iter().advance |window| {
for window in self.window.iter() {
window.content_changed()
}
}