<commit_before><link rel="import" href="closable.html">
<script>
/**
 * @license
 * Copyright (c) 2015 MediaMath Inc. All rights reserved.
 * This code may only be used under the BSD style license found at http://mediamath.github.io/strand/LICENSE.txt

*/
(function (scope) {

	var AutoTogglable = {

		properties: {
			toggleTrigger: {
				type: Object,
				observer: '_triggerChanged'
			}
		},

		created: function() {
			this._boundToggle = this._toggle.bind(this);
		},

		attached: function() {
			this._addListener(this.toggleTrigger);
		},

		detached: function() {
			this._removeListener(this.toggleTrigger);
		},

		_addListener: function(trigger) {
			if(trigger && trigger.addEventListener) {
				trigger.addEventListener('click', this._boundToggle);
			}
		},

		_removeListener: function(trigger) {
			if(trigger && trigger.removeEventListener) {
				trigger.removeEventListener('click', this._boundToggle);
			}
		},
<commit_msg>Resolves an edge case where if target is set before attached an event… (#125)<commit_after><link rel="import" href="closable.html">
<script>
/**
 * @license
 * Copyright (c) 2015 MediaMath Inc. All rights reserved.
 * This code may only be used under the BSD style license found at http://mediamath.github.io/strand/LICENSE.txt

*/
(function (scope) {

	var AutoTogglable = {

		properties: {
			toggleTrigger: {
				type: Object,
				observer: '_triggerChanged'
			}
		},

		attached: function() {
			this._addListener(this.toggleTrigger);
		},

		detached: function() {
			this._removeListener(this.toggleTrigger);
		},

		_addListener: function(trigger) {
			if (trigger && typeof trigger === 'object') {
				this.listen(trigger, 'tap', '_toggle');
			}
		},

		_removeListener: function(trigger) {
			if (trigger && typeof trigger === 'object') {
				this.unlisten(trigger, 'tap', '_toggle');
			}
		},

{'fraction_non_alphanumeric': 0.1420086393088553, 'fraction_numerical': 0.005939524838012959, 'mean_word_length': 3.800518134715026, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3298921', 'n_tokens_mistral': 672, 'n_tokens_neox': 560, 'n_words': 135}