How to use the dom-lib.ownerDocument function in dom-lib

To help you get started, we’ve selected a few dom-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rsuite / rsuite / src / utils / overlayPositionUtils.js View on Github external
getContainerDimensions(containerNode) {
        let width, height, scroll;
        if (containerNode.tagName === 'BODY') {
            width = window.innerWidth;
            height = window.innerHeight;
            scroll = scrollTop(ownerDocument(containerNode).documentElement) || scrollTop(containerNode);
        } else {
            ({ width, height } = getOffset(containerNode));
            scroll = scrollTop(containerNode);
        }
        return { width, height, scroll };
    },
github rsuite / rsuite / src / Modal / Modal.tsx View on Github external
getStyles(dialogElement?: HTMLElement) {
    const { container, overflow, drawer } = this.props;
    const node: any = dialogElement || this.dialogRef.current;
    const doc: any = ownerDocument(node);
    const scrollHeight = node ? node.scrollHeight : 0;

    const bodyIsOverflowing = isOverflowing(container || doc.body);
    const modalIsOverflowing = scrollHeight > doc.documentElement.clientHeight;

    const styles: {
      modalStyles: React.CSSProperties;
      bodyStyles: React.CSSProperties;
    } = {
      modalStyles: {
        [isRTL() ? 'paddingLeft' : 'paddingRight']:
          bodyIsOverflowing && !modalIsOverflowing ? getScrollbarSize() : 0,
        [isRTL() ? 'paddingRight' : 'paddingLeft']:
          !bodyIsOverflowing && modalIsOverflowing ? getScrollbarSize() : 0
      },
      bodyStyles: {}
github rsuite / rsuite / src / fixtures / Portal.js View on Github external
_mountOverlayTarget() {
        if (!this._overlayTarget) {
            this._overlayTarget = document.createElement('div');
            this._portalContainerNode = getContainer(this.props.container, ownerDocument(this).body);
            this._portalContainerNode.appendChild(this._overlayTarget);
        }
    },
github rsuite / rsuite / src / fixtures / BaseModal.js View on Github external
onShow() {
        let doc = ownerDocument(this);
        let container = getContainer(this.props.container, doc.body);


        modalManager.add(this, container, this.props.containerClassName);
        this._onDocumentKeyupListener = on(doc, 'keyup', this.handleDocumentKeyUp);
        this._onFocusinListener = onFocus(this.enforceFocus);

        this.focus();

        if (this.props.onShow) {
            this.props.onShow();
        }
    },