Skip to main content

Bug Tracker

Side navigation

#8929 closed feature (wontfix)

Opened April 20, 2011 11:11PM UTC

Closed April 21, 2011 12:05AM UTC

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
Attachments (0)
Change History (3)

Changed April 20, 2011 11:24PM UTC by timmywil comment:1

component: unfiledmanipulation
keywords: → needsreview
priority: undecidedlow
status: newopen
type: enhancementfeature

Changed April 20, 2011 11:31PM UTC by ajpiano comment:2

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.

Changed April 21, 2011 12:05AM UTC by rwaldron comment:3

resolution: → wontfix
status: openclosed

Second ajpiano