polymer-rails 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/polymer/polymer-micro.html +528 -21
  3. data/app/assets/javascripts/polymer/polymer-mini.html +1304 -27
  4. data/app/assets/javascripts/polymer/polymer.html +3771 -51
  5. data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.js +44 -14
  6. data/app/assets/javascripts/webcomponentsjs/webcomponents.js +7106 -0
  7. data/lib/polymer-rails/version.rb +1 -1
  8. metadata +4 -64
  9. data/app/assets/javascripts/polymer/src/lib/annotations/annotations.html +0 -262
  10. data/app/assets/javascripts/polymer/src/lib/annotations/demo/app-chrome.html +0 -60
  11. data/app/assets/javascripts/polymer/src/lib/array-observe.html +0 -118
  12. data/app/assets/javascripts/polymer/src/lib/array-splice.html +0 -262
  13. data/app/assets/javascripts/polymer/src/lib/async.html +0 -68
  14. data/app/assets/javascripts/polymer/src/lib/base.html +0 -117
  15. data/app/assets/javascripts/polymer/src/lib/bind/accessors.html +0 -223
  16. data/app/assets/javascripts/polymer/src/lib/bind/demo/app-chrome.html +0 -28
  17. data/app/assets/javascripts/polymer/src/lib/bind/demo/app.html +0 -29
  18. data/app/assets/javascripts/polymer/src/lib/bind/demo/src/annotations-bind-demo.html +0 -76
  19. data/app/assets/javascripts/polymer/src/lib/bind/demo/src/bind-demo.html +0 -83
  20. data/app/assets/javascripts/polymer/src/lib/bind/effects.html +0 -80
  21. data/app/assets/javascripts/polymer/src/lib/case-map.html +0 -46
  22. data/app/assets/javascripts/polymer/src/lib/collection.html +0 -179
  23. data/app/assets/javascripts/polymer/src/lib/css-parse.html +0 -131
  24. data/app/assets/javascripts/polymer/src/lib/debounce.html +0 -69
  25. data/app/assets/javascripts/polymer/src/lib/dom-api.html +0 -467
  26. data/app/assets/javascripts/polymer/src/lib/dom-module.html +0 -68
  27. data/app/assets/javascripts/polymer/src/lib/event-api.html +0 -92
  28. data/app/assets/javascripts/polymer/src/lib/expr/focus.html +0 -22
  29. data/app/assets/javascripts/polymer/src/lib/expr/gestures.html +0 -1
  30. data/app/assets/javascripts/polymer/src/lib/expr/log.html +0 -21
  31. data/app/assets/javascripts/polymer/src/lib/expr/sinspect.html +0 -235
  32. data/app/assets/javascripts/polymer/src/lib/expr/style-auditor.html +0 -123
  33. data/app/assets/javascripts/polymer/src/lib/expr/style-protector.html +0 -52
  34. data/app/assets/javascripts/polymer/src/lib/gestures.html +0 -284
  35. data/app/assets/javascripts/polymer/src/lib/lang.html +0 -21
  36. data/app/assets/javascripts/polymer/src/lib/module.html +0 -56
  37. data/app/assets/javascripts/polymer/src/lib/polymer-bootstrap.html +0 -78
  38. data/app/assets/javascripts/polymer/src/lib/resolve-url.html +0 -82
  39. data/app/assets/javascripts/polymer/src/lib/settings.html +0 -52
  40. data/app/assets/javascripts/polymer/src/lib/style-defaults.html +0 -32
  41. data/app/assets/javascripts/polymer/src/lib/style-transformer.html +0 -185
  42. data/app/assets/javascripts/polymer/src/lib/style-util.html +0 -77
  43. data/app/assets/javascripts/polymer/src/lib/template/templatizer.html +0 -132
  44. data/app/assets/javascripts/polymer/src/lib/template/x-array-selector.html +0 -178
  45. data/app/assets/javascripts/polymer/src/lib/template/x-autobind.html +0 -80
  46. data/app/assets/javascripts/polymer/src/lib/template/x-if.html +0 -115
  47. data/app/assets/javascripts/polymer/src/lib/template/x-repeat.html +0 -510
  48. data/app/assets/javascripts/polymer/src/lib/template/x-template.html +0 -39
  49. data/app/assets/javascripts/polymer/src/lib/x-style.html +0 -115
  50. data/app/assets/javascripts/polymer/src/micro/attributes.html +0 -180
  51. data/app/assets/javascripts/polymer/src/micro/constructor.html +0 -74
  52. data/app/assets/javascripts/polymer/src/micro/extends.html +0 -79
  53. data/app/assets/javascripts/polymer/src/micro/mixins.html +0 -40
  54. data/app/assets/javascripts/polymer/src/micro/properties.html +0 -96
  55. data/app/assets/javascripts/polymer/src/micro/tag.html +0 -28
  56. data/app/assets/javascripts/polymer/src/mini/ready.html +0 -180
  57. data/app/assets/javascripts/polymer/src/mini/shadow.html +0 -41
  58. data/app/assets/javascripts/polymer/src/mini/shady.html +0 -365
  59. data/app/assets/javascripts/polymer/src/mini/template.html +0 -56
  60. data/app/assets/javascripts/polymer/src/polymer-lib.html +0 -15
  61. data/app/assets/javascripts/polymer/src/standard/annotations.html +0 -198
  62. data/app/assets/javascripts/polymer/src/standard/configure.html +0 -160
  63. data/app/assets/javascripts/polymer/src/standard/effects.html +0 -215
  64. data/app/assets/javascripts/polymer/src/standard/events.html +0 -127
  65. data/app/assets/javascripts/polymer/src/standard/notify-path.html +0 -260
  66. data/app/assets/javascripts/polymer/src/standard/resolveUrl.html +0 -27
  67. data/app/assets/javascripts/polymer/src/standard/styling.html +0 -157
  68. data/app/assets/javascripts/polymer/src/standard/utils.html +0 -158
  69. data/app/assets/javascripts/polymer/src/standard/x-styling.html +0 -300
@@ -1,82 +0,0 @@
1
- <!--
2
- @license
3
- Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4
- This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
- The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
- The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
- Code distributed by Google as part of the polymer project is also
8
- subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
- -->
10
- <script>
11
-
12
- (function() {
13
-
14
- // path fixup for urls in cssText that's expected to
15
- // come from a given ownerDocument
16
- function resolveCss(cssText, ownerDocument) {
17
- return cssText.replace(CSS_URL_RX, function(m, pre, url, post) {
18
- return pre + '\'' +
19
- resolve(url.replace(/["']/g, ''), ownerDocument) +
20
- '\'' + post;
21
- });
22
- }
23
-
24
- // url fixup for urls in an element's attributes made relative to
25
- // ownerDoc's base url
26
- function resolveAttrs(element, ownerDocument) {
27
- for (var name in URL_ATTRS) {
28
- var a$ = URL_ATTRS[name];
29
- for (var i=0, l=a$.length, a, at, v; (i<l) && (a=a$[i]); i++) {
30
- if (name === '*' || element.localName === name) {
31
- at = element.attributes[a];
32
- v = at && at.value;
33
- if (v && (v.search(BINDING_RX) < 0)) {
34
- at.value = (a === 'style') ?
35
- resolveCss(v, ownerDocument) :
36
- resolve(v, ownerDocument);
37
- }
38
- }
39
- }
40
- }
41
- }
42
-
43
- function resolve(url, ownerDocument) {
44
- var resolver = getUrlResolver(ownerDocument);
45
- resolver.href = url;
46
- return resolver.href || url;
47
- }
48
-
49
- var tempDoc;
50
- var tempDocBase;
51
- function resolveUrl(url, baseUri) {
52
- if (!tempDoc) {
53
- tempDoc = document.implementation.createHTMLDocument('temp');
54
- tempDocBase = tempDoc.createElement('base');
55
- tempDoc.head.appendChild(tempDocBase);
56
- }
57
- tempDocBase.href = baseUri;
58
- return resolve(url, tempDoc);
59
- }
60
-
61
- function getUrlResolver(ownerDocument) {
62
- return ownerDocument.__urlResolver ||
63
- (ownerDocument.__urlResolver = ownerDocument.createElement('a'));
64
- }
65
-
66
- var CSS_URL_RX = /(url\()([^)]*)(\))/g;
67
- var URL_ATTRS = {
68
- '*': ['href', 'src', 'style', 'url'],
69
- form: ['action']
70
- };
71
- var BINDING_RX = /\{\{|\[\[/;
72
-
73
- // exports
74
- Polymer.ResolveUrl = {
75
- resolveCss: resolveCss,
76
- resolveAttrs: resolveAttrs,
77
- resolveUrl: resolveUrl
78
- };
79
-
80
- })();
81
-
82
- </script>
@@ -1,52 +0,0 @@
1
- <!--
2
- @license
3
- Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4
- This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
- The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
- The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
- Code distributed by Google as part of the polymer project is also
8
- subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
- -->
10
- <script>
11
-
12
- Polymer = {
13
- Settings: (function() {
14
- // NOTE: Users must currently opt into using ShadowDOM. They do so by doing:
15
- // Polymer = {dom: 'shadow'};
16
- // TODO(sorvell): Decide if this should be auto-use when available.
17
- // TODO(sorvell): if SD is auto-use, then the flag above should be something
18
- // like: Polymer = {dom: 'shady'}
19
-
20
- // via Polymer object
21
- var user = window.Polymer || {};
22
-
23
- // via url
24
- location.search.slice(1).split('&').forEach(function(o) {
25
- o = o.split('=');
26
- o[0] && (user[o[0]] = o[1] || true);
27
- });
28
-
29
- var wantShadow = (user.dom === 'shadow');
30
- var hasShadow = Boolean(Element.prototype.createShadowRoot);
31
- var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
32
- var useShadow = wantShadow && hasShadow;
33
-
34
- var hasNativeImports = Boolean('import' in document.createElement('link'));
35
- var useNativeImports = hasNativeImports;
36
-
37
- var useNativeCustomElements = (!window.CustomElements ||
38
- window.CustomElements.useNative);
39
-
40
- return {
41
- wantShadow: wantShadow,
42
- hasShadow: hasShadow,
43
- nativeShadow: nativeShadow,
44
- useShadow: useShadow,
45
- useNativeShadow: useShadow && nativeShadow,
46
- useNativeImports: useNativeImports,
47
- useNativeCustomElements: useNativeCustomElements
48
- };
49
- })()
50
- };
51
-
52
- </script>
@@ -1,32 +0,0 @@
1
- <!--
2
- @license
3
- Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4
- This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
- The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
- The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
- Code distributed by Google as part of the polymer project is also
8
- subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
- -->
10
- <link rel="import" href="style-util.html">
11
- <script>
12
-
13
- (function() {
14
-
15
- var defaultSheet = document.createElement('style');
16
-
17
- function applyCss(cssText) {
18
- defaultSheet.textContent += cssText;
19
- defaultSheet.__cssRules =
20
- Polymer.StyleUtil.parser.parse(defaultSheet.textContent);
21
- }
22
-
23
- applyCss('');
24
-
25
- // exports
26
- Polymer.StyleDefaults = {
27
- applyCss: applyCss,
28
- defaultSheet: defaultSheet
29
- };
30
-
31
- })();
32
- </script>
@@ -1,185 +0,0 @@
1
- <!--
2
- @license
3
- Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4
- This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
- The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
- The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
- Code distributed by Google as part of the polymer project is also
8
- subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
- -->
10
-
11
- <link rel="import" href="style-util.html">
12
-
13
- <script>
14
-
15
- (function() {
16
-
17
- /* Transforms ShadowDOM styling into ShadyDOM styling
18
-
19
- * scoping:
20
-
21
- * elements in scope get scoping selector class="x-foo-scope"
22
- * selectors re-written as follows:
23
-
24
- div button -> div.x-foo-scope button.x-foo-scope
25
-
26
- * :host -> scopeName
27
-
28
- * :host(...) -> scopeName...
29
-
30
- * ::content -> ' ' NOTE: requires use of scoping selector and selectors
31
- cannot otherwise be scoped:
32
- e.g. :host ::content > .bar -> x-foo > .bar
33
-
34
- * ::shadow, /deep/: processed simimlar to ::content
35
-
36
- * :host-context(...): NOT SUPPORTED
37
-
38
- */
39
-
40
- // Given a node and scope name, add a scoping class to each node
41
- // in the tree. This facilitates transforming css into scoped rules.
42
- function transformDom(node, scope) {
43
- _transformDom(node, scope ? scope + SCOPE_SUFFIX : '');
44
- }
45
-
46
- function _transformDom(node, selector) {
47
- if (node.setAttribute) {
48
- node.setAttribute(SCOPE_ATTR, selector);
49
- }
50
- var c$ = Polymer.dom(node).childNodes;
51
- for (var i=0; i<c$.length; i++) {
52
- _transformDom(c$[i], selector);
53
- }
54
- }
55
-
56
- function transformElement(element, scope) {
57
- element.setAttribute(SCOPE_ATTR, scope + SCOPE_SUFFIX);
58
- }
59
-
60
- function transformHost(host, scope) {
61
- }
62
-
63
- // Given a string of cssText and a scoping string (scope), returns
64
- // a string of scoped css where each selector is transformed to include
65
- // a class created from the scope. ShadowDOM selectors are also transformed
66
- // (e.g. :host) to use the scoping selector.
67
- function transformCss(rules, scope, ext, callback) {
68
- var hostScope = calcHostScope(scope, ext);
69
- return Polymer.StyleUtil.toCssText(rules, function(rule) {
70
- transformRule(rule, scope, hostScope);
71
- if (callback) {
72
- callback(rule, scope, hostScope);
73
- }
74
- });
75
- }
76
-
77
- function calcHostScope(scope, ext) {
78
- return ext ? '[is=' + scope + ']' : scope;
79
- }
80
-
81
- function transformRule(rule, scope, hostScope) {
82
- _transformRule(rule, transformComplexSelector,
83
- scope, hostScope);
84
- }
85
-
86
- // transforms a css rule to a scoped rule.
87
- function _transformRule(rule, transformer, scope, hostScope) {
88
- var p$ = rule.selector.split(COMPLEX_SELECTOR_SEP);
89
- for (var i=0, l=p$.length, p; (i<l) && (p=p$[i]); i++) {
90
- p$[i] = transformer(p, scope, hostScope);
91
- }
92
- rule.selector = p$.join(COMPLEX_SELECTOR_SEP);
93
- }
94
-
95
- function transformComplexSelector(selector, scope, hostScope) {
96
- var stop = false;
97
- selector = selector.replace(SIMPLE_SELECTOR_SEP, function(m, c, s) {
98
- if (!stop) {
99
- var o = transformCompoundSelector(s, c, scope, hostScope);
100
- if (o.stop) {
101
- stop = true;
102
- }
103
- c = o.combinator;
104
- s = o.value;
105
- }
106
- return c + s;
107
- });
108
- return selector;
109
- }
110
-
111
- function transformCompoundSelector(selector, combinator, scope, hostScope) {
112
- // replace :host with host scoping class
113
- var jumpIndex = selector.search(SCOPE_JUMP);
114
- if (selector.indexOf(HOST) >=0) {
115
- // :host(...)
116
- selector = selector.replace(HOST_PAREN, function(m, host, paren) {
117
- return hostScope + paren;
118
- });
119
- // now normal :host
120
- selector = selector.replace(HOST, hostScope);
121
- // replace other selectors with scoping class
122
- } else if (jumpIndex !== 0) {
123
- selector = scope ? transformSimpleSelector(selector, scope) : selector;
124
- }
125
- // remove left-side combinator when dealing with ::content.
126
- if (selector.indexOf(CONTENT) >= 0) {
127
- combinator = '';
128
- }
129
- // process scope jumping selectors up to the scope jump and then stop
130
- // e.g. .zonk ::content > .foo ==> .zonk.scope > .foo
131
- var stop;
132
- if (jumpIndex >= 0) {
133
- selector = selector.replace(SCOPE_JUMP, ' ');
134
- stop = true;
135
- }
136
- return {value: selector, combinator: combinator, stop: stop};
137
- }
138
-
139
- function transformSimpleSelector(selector, scope) {
140
- var p$ = selector.split(PSEUDO_PREFIX);
141
- p$[0] += CSS_PREFIX + scope + SCOPE_SUFFIX + CSS_SUFFIX;
142
- return p$.join(PSEUDO_PREFIX);
143
- }
144
-
145
- function transformRootRule(rule) {
146
- _transformRule(rule, transformRootSelector);
147
- }
148
-
149
- function transformRootSelector(selector) {
150
- return selector.match(SCOPE_JUMP) ?
151
- transformComplexSelector(selector) :
152
- selector.trim() + SCOPE_ROOT_SELECTOR;
153
- }
154
-
155
- var SCOPE_ATTR = 'style-scope';
156
- var SCOPE_ROOT_SELECTOR = ':not([' + SCOPE_ATTR + '])';
157
- var SCOPE_SUFFIX = '';
158
- var COMPLEX_SELECTOR_SEP = ',';
159
- var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)([^\s>+~]+)/g;
160
- var HOST = ':host';
161
- // NOTE: this supports 1 nested () pair for things like
162
- // :host(:not([selected]), more general support requires
163
- // parsing which seems like overkill
164
- var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
165
- var CONTENT = '::content';
166
- var SCOPE_JUMP = /\:\:content|\:\:shadow|\/deep\//;
167
- var CSS_PREFIX = '[' + SCOPE_ATTR + '=';
168
- var CSS_SUFFIX = ']';
169
- var PSEUDO_PREFIX = ':';
170
- var SCOPING_CLASS = /(?:^|\s)([\S]*?-x)(?:$|\s)/;
171
-
172
- // exports
173
- Polymer.StyleTransformer = {
174
- element: transformElement,
175
- dom: transformDom,
176
- host: transformHost,
177
- css: transformCss,
178
- rule: transformRule,
179
- rootRule: transformRootRule,
180
- SCOPE_SUFFIX: SCOPE_SUFFIX
181
- };
182
-
183
- })();
184
-
185
- </script>
@@ -1,77 +0,0 @@
1
- <!--
2
- @license
3
- Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4
- This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
- The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
- The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
- Code distributed by Google as part of the polymer project is also
8
- subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
- -->
10
-
11
- <link rel="import" href="css-parse.html">
12
-
13
- <script>
14
-
15
- (function() {
16
-
17
- function toCssText(rules, callback) {
18
- if (typeof rules === 'string') {
19
- rules = Polymer.CssParse.parse(rules);
20
- }
21
- if (callback) {
22
- forEachStyleRule(rules, callback);
23
- }
24
- return Polymer.CssParse.stringify(rules);
25
- }
26
-
27
- function forEachStyleRule(node, cb) {
28
- var s = node.selector;
29
- var skipRules = false;
30
- if (s) {
31
- if ((s.indexOf(AT_RULE) !== 0) && (s.indexOf(MIXIN_SELECTOR) !== 0)) {
32
- cb(node);
33
- }
34
- skipRules = (s.indexOf(KEYFRAME_RULE) >= 0) ||
35
- (s.indexOf(MIXIN_SELECTOR) >= 0);
36
- }
37
- var r$ = node.rules;
38
- if (r$ && !skipRules) {
39
- for (var i=0, l=r$.length, r; (i<l) && (r=r$[i]); i++) {
40
- forEachStyleRule(r, cb);
41
- }
42
- }
43
- }
44
-
45
- // add a string of cssText to the document.
46
- function applyCss(cssText, moniker, target, lowPriority) {
47
- var style = document.createElement('style');
48
- if (moniker) {
49
- style.setAttribute('scope', moniker);
50
- }
51
- style.textContent = cssText;
52
- target = target || document.head;
53
- if (lowPriority) {
54
- var n$ = target.querySelectorAll('style[scope]');
55
- var ref = n$.length ? n$[n$.length-1].nextSibling : target.firstChild;
56
- target.insertBefore(style, ref);
57
- } else {
58
- target.appendChild(style);
59
- }
60
- return style;
61
- }
62
-
63
- var AT_RULE = '@';
64
- var KEYFRAME_RULE = 'keyframe';
65
- var MIXIN_SELECTOR = '--';
66
-
67
- // exports
68
- Polymer.StyleUtil = {
69
- parser: Polymer.CssParse,
70
- applyCss: applyCss,
71
- forEachStyleRule: forEachStyleRule,
72
- toCssText: toCssText
73
- };
74
-
75
- })();
76
-
77
- </script>
@@ -1,132 +0,0 @@
1
- <!--
2
- @license
3
- Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4
- This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
- The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
- The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
- Code distributed by Google as part of the polymer project is also
8
- subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
- -->
10
-
11
- <script>
12
-
13
- Polymer.Templatizer = {
14
-
15
- templatize: function(template) {
16
- // TODO(sjmiles): supply _alternate_ content reference missing from root
17
- // templates (not nested). `_content` exists to provide content sharing
18
- // for nested templates.
19
- if (!template._content) {
20
- template._content = template.content;
21
- }
22
- // fast path if template's anonymous class has been memoized
23
- if (template._content._ctor) {
24
- this.ctor = template._content._ctor;
25
- //console.log('Templatizer.templatize: using memoized archetype');
26
- return;
27
- }
28
- // `archetype` is the prototype of the anonymous
29
- // class created by the templatizer
30
- var archetype = Object.create(Polymer.Base);
31
- archetype.host = this;
32
- archetype.contentHost = this._getContentHost();
33
- // normally Annotations.parseAnnotations(template) but
34
- // archetypes do special caching
35
- this.customPrepAnnotations(archetype, template);
36
- // setup accessors
37
- archetype._prepEffects();
38
- // late-binds archetype.listen to host.listen; h.l doesn't exist yet
39
- archetype.listen = function() {
40
- this.listen.apply(this, arguments);
41
- }.bind(this.host);
42
-
43
- // boilerplate code
44
- archetype._notifyPath = this._notifyPathImpl;
45
- // boilerplate code
46
- var _constructor = this._constructorImpl;
47
- var ctor = function TemplateInstance(model) {
48
- _constructor.call(this, model);
49
- };
50
- // standard references
51
- ctor.prototype = archetype;
52
- archetype.constructor = ctor;
53
- // TODO(sjmiles): constructor cache?
54
- template._content._ctor = ctor;
55
- // TODO(sjmiles): choose less general name
56
- this.ctor = ctor;
57
- },
58
-
59
- _getContentHost: function() {
60
- return (this.host && this.host.contentHost) || this.host;
61
- },
62
-
63
- customPrepAnnotations: function(archetype, template) {
64
- if (template) {
65
- archetype._template = template;
66
- var c = template._content;
67
- if (c) {
68
- var contentHost = archetype.contentHost;
69
- if (contentHost) {
70
- Polymer.Annotations.prepElement =
71
- contentHost._prepElement.bind(contentHost);
72
- }
73
- archetype._annotes = c._annotes ||
74
- Polymer.Annotations.parseAnnotations(template);
75
- c._annotes = archetype._annotes;
76
- Polymer.Annotations.prepElement = null;
77
- }
78
- else {
79
- console.warn('no _content');
80
- }
81
- }
82
- else {
83
- console.warn('no _template');
84
- }
85
- },
86
-
87
- _notifyPathImpl: function() {
88
- var pd = this.pathDelegate;
89
- if (pd) {
90
- var args = Array.prototype.slice.call(arguments);
91
- args.unshift(this);
92
- pd._notifyDelegatePath.apply(pd, args);
93
- }
94
- },
95
-
96
- _constructorImpl: function(model) {
97
- this._setupConfigure(model);
98
- this._pushHost(this.host);
99
- this.root = this.instanceTemplate(this._template);
100
- this._popHost();
101
- this._marshalAnnotatedNodes();
102
- this._marshalInstanceEffects();
103
- this._marshalAnnotatedListeners();
104
- this._readyContent();
105
- },
106
-
107
- stamp: function(model) {
108
- return new this.ctor(model);
109
- }
110
-
111
- // TODO(sorvell): note, using the template as host is ~5-10% faster if
112
- // elements have no default values.
113
- // _constructorImpl: function(model, host) {
114
- // this._setupConfigure(model);
115
- // host._beginHost();
116
- // this.root = this.instanceTemplate(this._template);
117
- // host._popHost();
118
- // this._marshalTemplateContent();
119
- // this._marshalAnnotatedNodes();
120
- // this._marshalInstanceEffects();
121
- // this._marshalAnnotatedListeners();
122
- // this._ready();
123
- // },
124
-
125
- // stamp: function(model) {
126
- // return new this.ctor(model, this.host);
127
- // }
128
-
129
-
130
- };
131
-
132
- </script>