Bug Tracker

Opened 9 years ago

Closed 9 years ago

#8929 closed feature (wontfix)

Provide auto-trim option for .text()

Reported by: AlistairB Owned by:
Priority: low Milestone: 1.next
Component: manipulation Version: 1.5.2
Keywords: needsreview Cc:
Blocked by: Blocking:

Description

I am constantly writing code like this:

var myId = $.trim($(".some-element").text());

It would be nice to have a leaner way to do this. eg.

var myId = $(".some-element").text(true);

var myId = $(".some-element").textTrim(); //there isprobably a better name for this

Change History (3)

comment:1 Changed 9 years ago by timmywil

Component: unfiledmanipulation
Keywords: needsreview added
Priority: undecidedlow
Status: newopen
Type: enhancementfeature

comment:2 Changed 9 years ago by ajpiano

If you do this a lot, write a utility function.

$.fn.textTrim = function() { 
return $.trim(this.text());
}

I don't think we should add this to core.

comment:3 Changed 9 years ago by Rick Waldron

Resolution: wontfix
Status: openclosed

Second ajpiano

Note: See TracTickets for help on using tickets.