How to use the @polymer/polymer/lib/legacy/polymer.dom.js.dom function in @polymer/polymer

To help you get started, we’ve selected a few @polymer/polymer 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 elmsln / lrnwebcomponents / elements / iron-data-table / lib / data-table-column.js View on Github external
value: function() {
        var custom = dom(this).querySelector("template[is=header]");

        if (custom && custom.parentElement) {
          // set dataHost to the context where template has been defined
          var column = custom.parentElement;
          custom._rootDataHost =
            column.dataHost._rootDataHost || column.dataHost;
          return custom;
        }

        return dom(this.root).querySelector("#header");
      }
    },
github nuxeo / nuxeo-ui-elements / widgets / nuxeo-tooltip.js View on Github external
get target() {
      const parentNode = dom(this).parentNode;
      // If the parentNode is a document fragment, then we need to use the host.
      const ownerRoot = dom(this).getOwnerRoot();
      let target;
      if (this.for) {
        target = dom(ownerRoot).querySelector(`#${this.for}`);
      } else {
        target = parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ?
          ownerRoot.host : parentNode;
      }
      return target;
    }
  }
github elmsln / lrnwebcomponents / elements / citation-element / lib / citation-element.js View on Github external
"resource"
        );
      } else {
        let uuid = this.generateResourceID();
        this.relatedResource = uuid;
        dom(this).previousElementSibling.setAttribute("resource", uuid);
      }
      // set prefix on the main element itself
      dom(this).previousElementSibling.setAttribute(
        "prefix",
        this.getAttribute("prefix")
      );
    } else if (newValue === "parent") {
      // find the parent and associate to it's resource ID, if it doesn't have one
      // then let's make one dynamically
      if (dom(this).parentNode.getAttribute("resource")) {
        this.relatedResource = dom(this).parentNode.getAttribute("resource");
      } else {
        let uuid = this.generateResourceID();
        this.relatedResource = uuid;
        dom(this).parentNode.setAttribute("resource", uuid);
      }
      // set prefix on the main element itself
      dom(this).parentNode.setAttribute("prefix", this.getAttribute("prefix"));
    }
  },
github motss / app-datepicker / app-datepicker.js View on Github external
_updateListScroller(_list) {
    var _sl = dom(_list.root).querySelector("#items");
    var _slh = _sl.getBoundingClientRect().height || 12863.994140625;
    var _sli = Math.floor(_slh / (2100 - 1900 + 1) * (this._activeYear - 1900 - 2)) + 1;

    // Adjust center position when datepickers has no buttons and in landscape mode.
    if (!this.$.dp.classList.contains("with-buttons") &&
      window.matchMedia("(orientation: landscape)").matches) {
      _sli = Math.floor(_slh / (2100 - 1900 + 1) * (this._activeYear - 1900 - 1)) + 1;
    }

    // Scroll to selected year.
    this.async(function () {
      _list.scroll(0, _sli);
      // Select initial item for the list.
      _list.selectItem(this._activeYear - 1900);
    }, 17); // wait for at least 17ms to update the scroller position.
github elmsln / lrnwebcomponents / elements / iron-data-table / iron-data-table.js View on Github external
_onCellClick: function(e) {
    // Prevent item selection if row itself is not focused. This means that
    // an element inside the row has been focused.
    // Mobile devices don't move focus from body unless it's an input element that is focused, so this element will never get focused.
    if (this._isFocusable(dom(e).localTarget)) {
      return;
    } else {
      if (this.rowDetail && this.detailsEnabled) {
        if (this._isExpanded(e.model.item, this._expandedItems)) {
          this._fireEvent("collapsing-item", e.model.item, this.collapseItem);
        } else {
          this._fireEvent("expanding-item", e.model.item, this.expandItem);
        }
      }

      if (this.selectionEnabled) {
        if (this._isSelected(e.model.item, this.selectedItems)) {
          this._fireEvent("deselecting-item", e.model.item, this.deselectItem);
        } else {
          this._fireEvent("selecting-item", e.model.item, this.selectItem);
        }
github t2ym / i18n-behavior / test / preprocess2-raw / commented-simple-text-element / commented-simple-text-element.js View on Github external
_langUpdated: function (e) {
        console.log(this.is, 'lang-updated', e.detail);
        if (dom(e).rootTarget === this) {
          this.model = deepcopy(this.text.model);
        }
      }
    });
github t2ym / i18n-behavior / test / src2 / test-runner.js View on Github external
for (var name in properties) {
    var path = name.split(/[.]/);
    if (path.length === 1) {
      element[name] = properties[name];
    }
    else {
      var cursor = element;
      var p = path.shift();
      while (p) {
        if (path.length < 1) {
          cursor[p] = properties[name];
          element.notifyPath(name, properties[name], true);
          break;
        }
        else if (p === 'PolymerDom') {
          cursor = dom(cursor);
        }
        else if (p === 'html') {
          cursor = document.querySelector('html');
        }
        else {
          cursor = cursor[p];
        }
        p = path.shift();
      }
    }
  }
}
github t2ym / i18n-behavior / test / src3 / template-default-lang / null-template-default-lang-element.js View on Github external
_langUpdated: function (e) {
        if (dom(e).rootTarget === this && this.text) {
          this.model = deepcopy(this.text.model);
        }
      }
    });
github elmsln / lrnwebcomponents / elements / lrn-icon / lrn-icon.es6.js View on Github external
_updateIcon() {
    if (this._usesIconset()) {
      if (this._img && this._img.parentNode) {
        dom(this.root).removeChild(this._img);
      }
      if (this._iconName === "") {
        if (this._iconset) {
          this._iconset.removeIcon(this);
        }
      } else if (this._iconsetName && this._meta) {
        this._iconset = this._meta.byKey(this._iconsetName);
        if (this._iconset) {
          this._iconset.applyIcon(this, this._iconName, this.theme);
          window.removeEventListener(
            "lrn-iconset-added",
            this._updateIcon.bind(this)
          );
        } else {
          window.addEventListener(
            "lrn-iconset-added",
github elmsln / lrnwebcomponents / elements / lrn-icon / lib / lrn-icon.js View on Github external
} else {
          this.listen(window, "lrn-iconset-added", "_updateIcon");
        }
      }
    } else {
      if (this._iconset) {
        this._iconset.removeIcon(this);
      }
      if (!this._img) {
        this._img = document.createElement("img");
        this._img.style.width = "100%";
        this._img.style.height = "100%";
        this._img.draggable = false;
      }
      this._img.src = this.src;
      dom(this.root).appendChild(this._img);
    }
  }
});