##// END OF EJS Templates
add/remove_class now can accept a list of classes
Jonathan Frederic -
Show More
@@ -393,35 +393,41 b' class Widget(BaseWidget):'
393 raise Exception('set_css only accepts 1-3 arguments')
393 raise Exception('set_css only accepts 1-3 arguments')
394
394
395
395
396 def add_class(self, class_name, selector=""):
396 def add_class(self, class_names, selector=""):
397 """Add class[es] to a DOM element
397 """Add class[es] to a DOM element
398
398
399 Parameters
399 Parameters
400 ----------
400 ----------
401 class_name: unicode
401 class_names: unicode or list
402 Class name(s) to add to the DOM element(s). Multiple class names
402 Class name(s) to add to the DOM element(s).
403 must be space separated.
404 selector: unicode (optional)
403 selector: unicode (optional)
405 JQuery selector to select the DOM element(s) that the class(es) will
404 JQuery selector to select the DOM element(s) that the class(es) will
406 be added to.
405 be added to.
407 """
406 """
407 class_list = class_names
408 if isinstance(list, class_list):
409 class_list = ' '.join(class_list)
410
408 self.send({"msg_type": "add_class",
411 self.send({"msg_type": "add_class",
409 "class_list": class_name,
412 "class_list": class_list,
410 "selector": selector})
413 "selector": selector})
411
414
412
415
413 def remove_class(self, class_name, selector=""):
416 def remove_class(self, class_names, selector=""):
414 """Remove class[es] from a DOM element
417 """Remove class[es] from a DOM element
415
418
416 Parameters
419 Parameters
417 ----------
420 ----------
418 class_name: unicode
421 class_names: unicode or list
419 Class name(s) to remove from the DOM element(s). Multiple class
422 Class name(s) to remove from the DOM element(s).
420 names must be space separated.
421 selector: unicode (optional)
423 selector: unicode (optional)
422 JQuery selector to select the DOM element(s) that the class(es) will
424 JQuery selector to select the DOM element(s) that the class(es) will
423 be removed from.
425 be removed from.
424 """
426 """
427 class_list = class_names
428 if isinstance(list, class_list):
429 class_list = ' '.join(class_list)
430
425 self.send({"msg_type": "remove_class",
431 self.send({"msg_type": "remove_class",
426 "class_list": class_name,
432 "class_list": class_list,
427 "selector": selector})
433 "selector": selector})
General Comments 0
You need to be logged in to leave comments. Login now