Bug Tracker

Opened 11 years ago

Closed 9 years ago

#3594 closed enhancement (invalid)

Patch: removeClass eats RegExp

Reported by: woid Owned by:
Priority: minor Milestone: 1.2
Component: core Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:

Description

Motivation: It is sometimes handy to remove classes using regular expression. Also hasClass should understand them.

About the patch: Its an oneliner in className.has method. So, it affects primary hasClass functionality. removeClass is enhanced by this change automatically. It affects also addClass, toggleClass and maybe other methods calling className.has. I see no point in using RegExp in those other cases, so I have not added guards to keep code clean.

patch against trunk r5939

Attachments (1)

removeClass_eats_RegExp.patch (1.2 KB) - added by woid 11 years ago.

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by woid

comment:1 Changed 11 years ago by woid

Correction: I does not affect hasClass, that function is implemented using is function.

comment:2 Changed 9 years ago by dmethvin

Resolution: invalid
Status: newclosed

The code has changed since this patch was made, so it doesn't work as intended anymore. It would be possible to add the ability for hasClass to take a regexp but that wouldn't impact its use in removeClass.

Note: See TracTickets for help on using tickets.