Opened 16 years ago

Closed 15 years ago

#961 closed enhancement (wontfix)

prependclass: test first whether the class isn't yet active

Reported by: Jan831 <[email protected]…> Owned by: Bryan Forbes
Priority: high Milestone: 0.9
Component: HTML Version: 0.3
Keywords: Cc:
Blocked By: Blocking:


currently dojo.html.prependClass(node, classStr) prepends classStr to the current Class-attribute of node.

It might be better to have some test first check whether node hasn't already the classStr and remove it in that case, before prepending classStr

it would be in that case like: give an existing class the highest precidence, without having it multiple times in the list of class names

Change History (3)

comment:1 Changed 16 years ago by Jan831 <[email protected]…>

adding this extra test, this would be the new function (in src/html.js)

dojo.html.prependClass = function(node, classStr){
	if (dojo.html.hasClass(node, classStr)) {
	  dojo.html.removeClass(node, classStr, false);
	classStr += " " + dojo.html.getClass(node);
	return dojo.html.setClass(node, classStr);

comment:2 Changed 16 years ago by dylan

Component: GeneralHTML
Milestone: 0.5
Owner: changed from anonymous to Bryan Forbes

comment:3 Changed 15 years ago by Adam Peller

Resolution: wontfix
Status: newclosed

method does not exist in 0.9

Note: See TracTickets for help on using tickets.