mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
API docs for dom-module.
This commit is contained in:
parent
290596a3d3
commit
8b2ef275a0
@ -1,8 +1,8 @@
|
||||
<link rel="import" href="../utils/boot.html">
|
||||
<link rel="import" href="../utils/resolve-url.html">
|
||||
<script>
|
||||
|
||||
(function() {
|
||||
{
|
||||
'use strict';
|
||||
|
||||
let modules = {};
|
||||
let lcModules = {};
|
||||
@ -37,6 +37,26 @@
|
||||
|
||||
static get observedAttributes() { return ['id'] }
|
||||
|
||||
/**
|
||||
* Retrieves the dom specified by `selector` in the module specified by
|
||||
* `id`. For example, this.import('foo', 'img');
|
||||
* @method register
|
||||
* @param {string} id
|
||||
* @param {string=} selector
|
||||
* @return {Element} Returns the dom which matches `selector` in the module
|
||||
* at the specified `id`.
|
||||
*/
|
||||
static import(id, selector) {
|
||||
if (id) {
|
||||
let m = findModule(id);
|
||||
if (m && selector) {
|
||||
return m.querySelector(selector);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
attributeChangedCallback(name, old, value) {
|
||||
if (old !== value) {
|
||||
this.register();
|
||||
@ -44,7 +64,15 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* The absolute URL of the original location of this `dom-module`.
|
||||
*
|
||||
* This value will differ from this element's `ownerDocument` in the
|
||||
* following ways:
|
||||
* - Takes into account any `assetpath` attribute added during bundling
|
||||
* to indicate the original location relative to the bundled location
|
||||
* - Uses the HTMLImports polyfill's `importForElement` API to ensure
|
||||
* the path is relative to the import document's location since
|
||||
* `ownerDocument` is not currently polyfilled
|
||||
*/
|
||||
get assetpath() {
|
||||
// Don't override existing assetpath.
|
||||
@ -78,27 +106,6 @@
|
||||
styleOutsideTemplateCheck(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the dom specified by `selector` in the module specified by
|
||||
* `id`. For example, this.import('foo', 'img');
|
||||
* @method register
|
||||
* @param {string} id
|
||||
* @param {string=} selector
|
||||
* @return {Element} Returns the dom which matches `selector` in the module
|
||||
* at the specified `id`.
|
||||
*/
|
||||
import(id, selector) {
|
||||
if (id) {
|
||||
let m = findModule(id);
|
||||
if (m && selector) {
|
||||
return m.querySelector(selector);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DomModule.prototype['modules'] = modules;
|
||||
@ -106,8 +113,7 @@
|
||||
customElements.define('dom-module', DomModule);
|
||||
|
||||
// export
|
||||
Polymer.DomModule = new DomModule();
|
||||
|
||||
})();
|
||||
Polymer.DomModule = DomModule;
|
||||
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user