yiminghe / dom-scroll-into-view

scroll dom node into view automatically
156 stars 24 forks source link

When using dom-scroll-into view with rc-tree component, it say var doc = elem.ownerDocument is not defined. #5

Open yadavsunil00001 opened 7 years ago

yadavsunil00001 commented 7 years ago

i am trying to use this wrapper for rc-tree but it saying elem.ownerDocument is not defined. `

            <div id="container">
            <Tree id="ex1"
              selectable={true}
              multiple={true}
              checkable={true}
              onCheck={this.onCheck}
              checkedKeys={this.state.checkedKeys}
              loadData={this.onLoadData}
              showLine={true}
              showIcon={false}
              checkStrictly={true}
              onExpand={this.onExpand}
              expandedKeys={this.state.Expanded}
              selectedKeys={this.state.Selected}
            >
              {treeNodes}
            </Tree >
            </div>

`

My function to scroll look like this.

scrollIntoView($('#ex1')[0], $('#container')[0], {

})

How to solve the problem.

Please suggest if there is alternative way to do this.

The roor look like this

var box = undefined;
  11 | var x = undefined;
  12 | var y = undefined;
> 13 | var doc = elem.ownerDocument;
  14 | var body = doc.body;
  15 | var docElem = doc && doc.documentElement;
  16 | // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式