| 149 | } |
| 150 | |
| 151 | protected _toggleClass(className:string, toggle:boolean = false):void { |
| 152 | if (!this.dom) { |
| 153 | return; |
| 154 | } |
| 155 | if (this.dom.classList) { |
| 156 | this.dom.classList.toggle(className, toggle); |
| 157 | } else { |
| 158 | // Fallback to traditional method |
| 159 | var classList:string[] = this.dom.className.split(' '); |
| 160 | var index = classList.indexOf(className); |
| 161 | if (index >= 0 && !toggle) { |
| 162 | classList.splice(index, 1); |
| 163 | this.dom.className = classList.join(' '); |
| 164 | } else if (index < 0 && toggle) { |
| 165 | classList.push(className) |
| 166 | this.dom.className = classList.join(' '); |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Initializes the DOM element (or canvas) backing the comment |