Skip to content

Commit

Permalink
Merge pull request #40 from alexesDev/speed_up
Browse files Browse the repository at this point in the history
Don't remove_child if not needed
  • Loading branch information
timoschilling committed Nov 11, 2014
2 parents aa78699 + ff2e038 commit 7586820
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/arbre/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def add_child(child)

if child.respond_to?(:parent)
# Remove the child
child.parent.remove_child(child) if child.parent
child.parent.remove_child(child) if child.parent && child.parent != self
# Set ourselves as the parent
child.parent = self
end
Expand Down

0 comments on commit 7586820

Please sign in to comment.