5 function generate(node) {
7 node.id = 'core-label-' + ID++;
12 Polymer('core-label', {
14 * A query selector string for a "target" element not nested in the `<core-label>`
21 'for': {reflect: true, value: ''}
28 this._forElement = null;
32 this._forElement = this.querySelector('[for]');
36 tapHandler: function(ev) {
37 if (!this._forElement) {
40 if (ev.target === this._forElement) {
43 this._forElement.focus();
44 this._forElement.click();
45 this.fire('tap', null, this._forElement);
48 if (this._forElement) {
49 this._forElement.setAttribute('aria-labelledby', this.id);
52 _findScope: function() {
53 var n = this.parentNode;
54 while(n && n.parentNode) {
59 forChanged: function(oldFor, newFor) {
60 if (this._forElement) {
61 this._forElement.removeAttribute('aria-labelledby');
63 var scope = this._findScope();
67 this._forElement = scope.querySelector(newFor);
68 if (this._forElement) {