Bug Tracker

Opened 13 years ago

Closed 13 years ago

#5696 closed enhancement (wontfix)

Minor Feature: Slugify

Reported by: umbrae Owned by:
Priority: trivial Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc: [email protected]
Blocked by: Blocking:

Description

Not a huge deal, but I find a function to turn text into a URL friendly slug like this often useful:

jQuery.slugify = function(s) {
	return s.replace(/\s+/g,'-').replace(/[^a-zA-Z0-9\-]/g,'').toLowerCase();
}

Might be worth sticking into jQuery core for everyone else. (Although I know that string operations are extremely sparse in the jQuery framework. Only trim() as far as I know.)

If this is worth a patch, I can spend the minute and turn it into one. Let me know.

Change History (1)

comment:1 Changed 13 years ago by john

Resolution: wontfix
Status: newclosed

This isn't something that we're going to be landing - should make for a fine plugin, though.

Note: See TracTickets for help on using tickets.