Skip to main content

Bug Tracker

Side navigation

#7378 closed feature (duplicate)

Opened November 02, 2010 01:48PM UTC

Closed December 30, 2010 04:18AM UTC

Last modified March 10, 2012 05:52AM UTC

New method: $.fn.classlist()

Reported by: rwaldron Owned by: rwaldron
Priority: undecided Milestone: 1.5
Component: attributes Version:
Keywords: manipulation Cc:
Blocked by: Blocking:
Description

Essentially, a jQuery method that wraps the brains of classList where available and provides a fallback where it isn't available. I'll provide more details via jsfiddle's when I get a chance.

Attachments (0)
Change History (9)

Changed November 02, 2010 01:49PM UTC by rwaldron comment:1

component: unfiledattributes
keywords: → manipulation
owner: → rwaldron
status: newassigned

Changed November 02, 2010 01:54PM UTC by rwaldron comment:2

description: Essentially, a jQuery method that wraps the brains of classList where available and provides a fallback where it doesn't. I'll provide more details via jsfiddle's when I get a chance.Essentially, a jQuery method that wraps the brains of classList where available and provides a fallback where it isn't available. I'll provide more details via jsfiddle's when I get a chance.

Changed November 02, 2010 05:28PM UTC by jitter comment:3

I guess you mean the HTML 5 classList.

For reference:

HTML5: classList and HTML5: DOMTokenList

Mozilla element.classList

Webkit svn

Changed November 02, 2010 05:41PM UTC by rwaldron comment:4

_comment0: yes, thats what I'm thinking. Thanks for posting the resource info \ \ Additionally, I put together these minimal requirements: \ \ Should: feature detect (adds a test for classList to jQuery.support), normalize functionality for both native and non-native, support classList functionality \ \ \ I spent the morning writing a draft of this and will have a repo available soon. Its very tight so far and offers: item(), add(), remove(), contains() and toggle() - using jQuery's own methods1288720425658262

yes, thats what I'm thinking. Thanks for posting the resource info

Additionally, I put together these minimal requirements:

Should: feature detect (adds a test for classList to jQuery.support), normalize functionality for both native and non-native, support classList functionality

I spent the morning writing a draft of this and will have a repo available soon. Its very tight so far and offers: item(), add(), remove(), contains() and toggle() - using jQuery's own methods

Additionally, I have 59 unit tests written. Will start writing an api doc asap so it can be use tested.

Changed November 02, 2010 05:42PM UTC by rwaldron comment:5

summary: New method: $.fn.classes()New method: $.fn.classlist()

Changed December 20, 2010 12:46AM UTC by paul.irish comment:6

Since addClass/removeClass etc is the abstraction jQuery provides for classes, why wouldn't those methods just use elem.classList if available for the added perf?

Changing the API for class manipulation as a sort of polyfill seems like its not really jquery's style.

Changed December 20, 2010 12:50AM UTC by rwaldron comment:7

I should've updated this ticket some time ago. Yes - thats the direction I've taken - no new api, but perf boosts where possible.

Changed December 30, 2010 04:18AM UTC by paul.irish comment:8

resolution: → duplicate
status: assignedclosed

Changed December 30, 2010 04:18AM UTC by paul.irish comment:9

Duplicate of #5087.