MCPcopy Index your code
hub / github.com/jabbany/CommentCoreLibrary / _toggleClass

Method _toggleClass

src/core/Comment.ts:151–169  ·  view source on GitHub ↗
(className:string, toggle:boolean = false)

Source from the content-addressed store, hash-verified

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

Callers 3

colorMethod · 0.95
shadowMethod · 0.95
initMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected