.replaceClass()
.replaceClass( oldClassName, newClassName)
- 返回: domtify
将匹配集合中的元素旧的类名替换成新的类名。
NOTE
该方法不存在于jQuery的api中,是domtify中独有的方法,根据jQuery的api设计风格以及replaceAPI设计而来。
.replaceClass( oldClassName, newClassName) from @1.0
- oldClassName
- 类型: String
- 描述: 要被替换的旧的类名
- newClassName
.replaceClass( classNames) from @1.0
- classNames
- 类型: PlainObject
- 描述: 可以通过传入对象方式批量替换,
key
代表oldClassName
,value
代表newClassName
。
.replaceClass( classNames) from @1.0
- classNames
- 类型: Function( Integer index, String currentClassName ) => PlainObject
- 描述: 该函数接收集合中元素的索引位置和现有类名作为参数。在函数内部,
this
引用集合中的当前元素,返回一个key
是oldClassName
,value
是newClassName
的对象。