| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 @license | |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.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/CONTRI
BUTORS.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/PATEN
TS.txt | |
| 9 --><html><head><link rel="import" href="../polymer/polymer.html"> | |
| 10 | |
| 11 <!-- | |
| 12 `iron-meta` is a generic element you can use for sharing information across the
DOM tree. | |
| 13 It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) such that a
ny | |
| 14 instance of iron-meta has access to the shared | |
| 15 information. You can use `iron-meta` to share whatever you want (or create an ex
tension | |
| 16 [like x-meta] for enhancements). | |
| 17 | |
| 18 The `iron-meta` instances containing your actual data can be loaded in an import
, | |
| 19 or constructed in any way you see fit. The only requirement is that you create t
hem | |
| 20 before you try to access them. | |
| 21 | |
| 22 Examples: | |
| 23 | |
| 24 If I create an instance like this: | |
| 25 | |
| 26 <iron-meta key="info" keyUrl="foo/bar"></iron-meta> | |
| 27 | |
| 28 Note that keyUrl="foo/bar" is the metadata I've defined. I could define more | |
| 29 attributes or use child nodes to define additional metadata. | |
| 30 | |
| 31 Now I can access that element (and it's metadata) from any iron-meta instance | |
| 32 via the byKey method, e.g. | |
| 33 | |
| 34 meta.byKey('info').getAttribute('keyUrl'). | |
| 35 | |
| 36 Pure imperative form would be like: | |
| 37 | |
| 38 document.createElement('iron-meta').byKey('info').getAttribute('keyUrl'); | |
| 39 | |
| 40 Or, in a Polymer element, you can include a meta in your template: | |
| 41 | |
| 42 <iron-meta id="meta"></iron-meta> | |
| 43 ... | |
| 44 this.$.meta.byKey('info').getAttribute('keyUrl'); | |
| 45 | |
| 46 @group Iron Elements | |
| 47 @demo demo/index.html | |
| 48 @hero hero.svg | |
| 49 @element iron-meta | |
| 50 --> | |
| 51 | |
| 52 </head><body><script src="iron-meta-extracted.js"></script></body></html> | |
| OLD | NEW |