MCPcopy Index your code
hub / github.com/reactstrap/reactstrap / init

Function init

src/Modal.js:356–390  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

354 }
355
356 init() {
357 try {
358 this._triggeringElement = document.activeElement;
359 } catch (err) {
360 this._triggeringElement = null;
361 }
362
363 if (!this._element) {
364 this._element = document.createElement('div');
365 this._element.setAttribute('tabindex', '-1');
366 this._element.style.position = 'relative';
367 this._element.style.zIndex = this.props.zIndex;
368 this._mountContainer = getTarget(this.props.container);
369 this._mountContainer.appendChild(this._element);
370 }
371
372 this._originalBodyPadding = getOriginalBodyPadding();
373 if (Modal.openCount < 1) {
374 Modal.originalBodyOverflow = window.getComputedStyle(
375 document.body,
376 ).overflow;
377 }
378 conditionallyUpdateScrollbar();
379
380 if (Modal.openCount === 0) {
381 document.body.className = classNames(
382 document.body.className,
383 mapToCssModules('modal-open', this.props.cssModule),
384 );
385 document.body.style.overflow = 'hidden';
386 }
387
388 this.modalIndex = Modal.openCount;
389 Modal.openCount += 1;
390 }
391
392 destroy() {
393 if (this._element) {

Callers

nothing calls this directly

Calls 4

getTargetFunction · 0.90
getOriginalBodyPaddingFunction · 0.90
mapToCssModulesFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…