#7378 closed feature (duplicate)
New method: $.fn.classlist()
Reported by: | Rick Waldron | Owned by: | Rick Waldron |
---|---|---|---|
Priority: | undecided | Milestone: | 1.5 |
Component: | attributes | Version: | |
Keywords: | manipulation | Cc: | |
Blocked by: | Blocking: |
Description (last modified by )
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.
Change History (9)
comment:1 Changed 12 years ago by
Component: | unfiled → attributes |
---|---|
Keywords: | manipulation added |
Owner: | set to Rick Waldron |
Status: | new → assigned |
comment:2 Changed 12 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 12 years ago by
comment:4 Changed 12 years ago by
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.
comment:5 Changed 12 years ago by
Summary: | New method: $.fn.classes() → New method: $.fn.classlist() |
---|
comment:6 Changed 12 years ago by
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.
comment:7 Changed 12 years ago by
I should've updated this ticket some time ago. Yes - thats the direction I've taken - no new api, but perf boosts where possible.
comment:8 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
I guess you mean the HTML 5
classList
.For reference:
HTML5: classList and HTML5: DOMTokenList
Mozilla element.classList
Webkit svn