* (Internal) Removes a class from an element.
(element, name)
| 441 | */ |
| 442 | |
| 443 | function removeClass(element, name) { |
| 444 | var oldList = classList(element), |
| 445 | newList; |
| 446 | |
| 447 | if (!hasClass(element, name)) return; |
| 448 | |
| 449 | // Replace the class name. |
| 450 | newList = oldList.replace(' ' + name + ' ', ' '); |
| 451 | |
| 452 | // Trim the opening and closing spaces. |
| 453 | element.className = newList.substring(1, newList.length - 1); |
| 454 | } |
| 455 | |
| 456 | /** |
| 457 | * (Internal) Gets a space separated list of the class names on the element. |
no test coverage detected