|
25 | 25 | },
|
26 | 26 |
|
27 | 27 | publishAttributes: function(prototype, base) {
|
28 |
| - // merge names from 'attributes' attribute |
| 28 | + // merge names from 'attributes' attribute into the 'publish' object |
29 | 29 | var attributes = this.getAttribute(ATTRIBUTES_ATTRIBUTE);
|
30 | 30 | if (attributes) {
|
31 |
| - // get properties to publish |
32 |
| - var publish = prototype.publish || (prototype.publish = {}); |
| 31 | + // create a `publish` object if needed. |
| 32 | + // the `publish` object is only relevant to this prototype, the |
| 33 | + // publishing logic in `declaration/properties.js` is responsible for |
| 34 | + // managing property values on the prototype chain. |
| 35 | + // TODO(sjmiles): the `publish` object is later chained to it's |
| 36 | + // ancestor object, presumably this is only for |
| 37 | + // reflection or other non-library uses. |
| 38 | + var publish = prototype.publish || (prototype.publish = {}); |
33 | 39 | // names='a b c' or names='a,b,c'
|
34 | 40 | var names = attributes.split(ATTRIBUTES_REGEX);
|
35 | 41 | // record each name for publishing
|
36 | 42 | for (var i=0, l=names.length, n; i<l; i++) {
|
37 | 43 | // remove excess ws
|
38 | 44 | n = names[i].trim();
|
39 |
| - // if the user hasn't specified a value, we want to use the |
40 |
| - // default, unless a superclass has already chosen one |
| 45 | + // looks weird, but causes n to exist on `publish` if it does not; |
| 46 | + // a more careful test would need expensive `in` operator |
41 | 47 | if (n && publish[n] === undefined) {
|
42 |
| - // TODO(sjmiles): querying native properties on IE11 (and possibly |
43 |
| - // on other browsers) throws an exception because there is no actual |
44 |
| - // instance. |
45 |
| - // In fact, trying to publish native properties is known bad for this |
46 |
| - // and other reasons, and we need to solve this problem writ large. |
47 |
| - try { |
48 |
| - var hasValue = (base[n] !== undefined); |
49 |
| - } catch(x) { |
50 |
| - hasValue = false; |
51 |
| - } |
52 |
| - // supply an empty 'descriptor' object and let the publishProperties |
53 |
| - // code determine a default |
54 |
| - if (!hasValue) { |
55 |
| - publish[n] = Polymer.nob; |
56 |
| - } |
| 48 | + publish[n] = undefined; |
57 | 49 | }
|
58 | 50 | }
|
59 | 51 | }
|
|
0 commit comments