123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
- import _createClass from 'babel-runtime/helpers/createClass';
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
- import _inherits from 'babel-runtime/helpers/inherits';
-
-
- import onsElements from '../ons/elements';
- import util from '../ons/util';
- import BaseElement from './base/base-element';
-
-
-
- var TemplateElement = function (_BaseElement) {
- _inherits(TemplateElement, _BaseElement);
-
-
-
-
- function TemplateElement() {
- _classCallCheck(this, TemplateElement);
-
- var _this = _possibleConstructorReturn(this, (TemplateElement.__proto__ || _Object$getPrototypeOf(TemplateElement)).call(this));
-
- _this.template = _this.innerHTML;
-
- while (_this.firstChild) {
- _this.removeChild(_this.firstChild);
- }
- return _this;
- }
-
- _createClass(TemplateElement, [{
- key: 'connectedCallback',
- value: function connectedCallback() {
- if (this.parentNode) {
-
-
- if (this.parentNode !== document.body) {
-
- util.warn('ons-template (id = ' + this.getAttribute('id') + ') must be located just under document.body' + (this.parentNode.outerHTML ? ':\n\n' + this.parentNode.outerHTML : '.'));
- }
- }
-
- var event = new CustomEvent('_templateloaded', { bubbles: true, cancelable: true });
- event.template = this.template;
- event.templateId = this.getAttribute('id');
-
- this.dispatchEvent(event);
- }
- }]);
-
- return TemplateElement;
- }(BaseElement);
-
- export default TemplateElement;
-
-
- onsElements.Template = TemplateElement;
- customElements.define('ons-template', TemplateElement);
|