How to use rax-get-element-by-id - 2 common examples

To help you get started, we’ve selected a few rax-get-element-by-id 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 alibaba / rax / packages / rax-find-dom-node / src / index.js View on Github external
if (instance == null) {
    return null;
  }

  // If a native node, weex may not export ownerDocument property
  if (instance.ownerDocument || instance.nodeType) {
    return instance;
  }

  // Native component
  if (instance._nativeNode) {
    return instance._nativeNode;
  }

  if (typeof instance == 'string') {
    return getElementById(instance);
  }

  if (typeof instance.render !== 'function') {
    throw new Error('findDOMNode: find by neither component nor DOM node.');
  }

  // Composite component
  let internal = instance._internal;

  if (internal) {
    while (!internal._nativeNode) {
      internal = internal._renderedComponent;
      // If not mounted
      if (internal == null) {
        return null;
      }
github alibaba / rax / packages / rax-find-dom-node / src / __tests__ / findDOMNode.weex.js View on Github external
it('getElementById with id', () => {
    let mockFn = jest.fn();
    Host.driver = {
      getElementById: mockFn,
    };
    getElementById('id');
    expect(mockFn).toBeCalledWith('id');
  });

rax-get-element-by-id

Rax getElementById

BSD-3-Clause
Latest version published 1 year ago

Package Health Score

63 / 100
Full package analysis

Popular rax-get-element-by-id functions

Similar packages