Copied from jquery-textext