Opened 12 years ago
Closed 11 years ago
#9560 closed enhancement (fixed)
[patch][cla] dojo.removeClass w/o class name should remove all classes
Reported by: | Les | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | low | Milestone: | 1.4 |
Component: | Core | Version: | 1.3.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
It should be easy to remove all class names from an element, e.g.:
This code removes the 'someClass' class.
dojo.removeClass("someNode", "someClass");
This code should remove all classes from someNode.
dojo.removeClass("someNode");
I think this would be an improvement for chaining.
Attachments (1)
Change History (12)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Summary: | dojo.removeClass w/o class name should remove all classes → [patch][cla] dojo.removeClass w/o class name should remove all classes |
---|
i can't decide if I think this confuses me or is good functionality. It does fill a gap transparently with removeClass, but really
dojo.clearClass = function(node){ dojo.byId(node).className = ""; }
is "less confusing" and can be put in NodeList? too. Hiding in removeClass is less bytes, but adds extra check to code path.
patch is against [18844] in trunk.
comment:3 Changed 12 years ago by
IMHO, it is confusing, and doesn't save much code.
It makes more sense in the context of NodeList. Probably should be an extension, rather than part of the base.
comment:4 Changed 12 years ago by
removeClass() is available in jQuery. I thought it should be added to dojo, since the NodeList? methods are intended to match the API naming and behavior as the similarly named methods in jQuery.
comment:5 Changed 12 years ago by
Milestone: | tbd → 1.4 |
---|
Seems fine to me, and as Les mentions we get better compatibility with jquery methods.
comment:6 Changed 12 years ago by
Component: | General → Core |
---|---|
Owner: | changed from anonymous to Eugene Lazutkin |
Status: | new → assigned |
Should be combined with #9577.
comment:7 Changed 12 years ago by
comment:8 Changed 12 years ago by
comment:9 Changed 12 years ago by
Priority: | normal → low |
---|
Now I want to update the docs on Dojo Campus but I don't know what is the correct way to do it: this functionality is unreleased yet. Do we mark it somehow? Do we update some special area? How do we handle docs for different versions?
comment:10 Changed 11 years ago by
Previously we were (in theory) marking new stuff with "New in 1.4" but I think at this point you can just document it.
comment:11 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
All information is added to the release nodes, and the documentation is updated.
Example (remove all classes, add class 'myClass'):