anchor.diff:              {[Tag | NewT],true};
           {T,false} ->
               case trim_last(Content,What) of
  -                {[],NewState} ->
  -                    {T,NewState};
  +                {[],true} ->
  +                    %% If the content became empty and we processed some text
  +                    %% we remove the element.
  +                    {[],true};
                   {NewContent,NewState} ->
                       {[{Elem,Attr,NewContent}|T],NewState}
               end
       end;
   trim_last([],_What) ->
       {[],false}.
  +
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %% API function for dealing with the function documentation
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
positive.code: %% This is complicated by the fact that the first or last element
  %% may not have any binary, or have the binary deeply nested within.
  trim_first_and_last(Content, What) when What < 256 ->
      {NewContent,_State} = trim_last(trim_first(Content,What),What),
      NewContent.
  
  trim_first(Content,What) ->
      {NewContent,_State} = trim_first(Content,false,What),
      NewContent.
  trim_first([Bin|T],false,What) when is_binary(Bin) ->
      case Bin of
          <<What>> ->
              {T,true};
  
negative.code: trim_inline([{Elem,Attr,Content}|T],TrimSpace) ->
      {NewContent,ContentTrimSpace} = trim_inline(Content,TrimSpace),
      {NewT,TTrimSpace} = trim_inline(T,ContentTrimSpace),
      IsAnchor = (Elem =:= a) andalso proplists:is_defined(id,Attr),
      if NewContent == [] andalso (not IsAnchor) ->
              %% Remove if all content has been trimmed and this is not an anchor
              {NewT, TTrimSpace};
         true ->
              {[{Elem,Attr,NewContent} | NewT], TTrimSpace}
  