Bug Tracker

Modify

Ticket #5696 (closed enhancement: wontfix)

Opened 3 years ago

Last modified 3 years ago

Minor Feature: Slugify

Reported by: umbrae Owned by:
Priority: trivial Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc: umbrae@…
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by john

  • Status changed from new to closed
  • Resolution set to wontfix

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.