Permalink
Browse files

Fix remove_positions to remove positions in children too. Add guards …

…to check data type
  • Loading branch information...
davidjulien committed Jul 29, 2011
1 parent cbafd58 commit 5990be89161d93138e42df94a26c1cccdb6f72b2
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/mochiweb_xpath.erl
View
@@ -320,11 +320,11 @@ add_positions_aux(Data, _) ->
%% @doc Remove position from each node
%% @spec remove_positions(ExtendedDoc) -> Doc
%% @type ExtendedDoc = {atom(), [{binary(), any()}], [extended_node()], [non_neg_integer()]}
-remove_positions([_|_] = Nodes) ->
+remove_positions(Nodes) when is_list(Nodes) ->
[ remove_positions(SubNode) || SubNode <- Nodes ];
remove_positions({Tag, Attrs, Children, _}) ->
- {Tag, Attrs, Children};
-remove_positions(Data) ->
+ {Tag, Attrs, remove_positions(Children)};
+remove_positions(Data) when is_binary(Data) ->
Data.
%% @doc Get node according to a position relative to root node

0 comments on commit 5990be8

Please sign in to comment.