adds trunc_words function in dom_elem_helper