<commit_before>/*
 * angular-shims-placeholder
 * https://github.com/jrief/angular-shims-placeholder
 *
 * Add Angular directives which emulates attribute ´placeholder´ in input fields
 * of type text for browsers not supporting this, ie. IE9 and below.
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

(function(angular, document, undefined) {
'use strict';

angular.module('ng.shims.placeholder', []).directive('placeholder', function($timeout) {
	if (! angular.mock) {
		// run unit tests, even if your browser supports the placeholder field
		var test = document.createElement("input");
		if (test.placeholder !== void 0)
			return {};
	}

	// No native support for attribute placeholder
	return {
		restrict: 'A',
		require: '?ngModel',
		priority: 1,
		link: function(scope, elem, attrs, ngModel) {
			var orig_val = getValue(),
				is_pwd = attrs.type === 'password',
				text = attrs.placeholder,
				emptyClassName = 'empty',
				domElem = elem[0],
				clone;

			if (!text) { return; }

			if (is_pwd) { setupPasswordPlaceholder(); }

			// init
			setValue(orig_val);

			// on focus, replace auto-label with empty field
			elem.bind('focus', function() {
				if (elem.hasClass(emptyClassName)) {
					elem.val('');
					elem.removeClass(emptyClassName);
				}
			});

			// on blur, show placeholder if necessary
			elem.bind('blur', updateValue);

			// handler for model-less inputs to interact with non-angular code
			if (!ngModel) {
				elem.bind('change', updateValue);
			}

			// model -> view
			if (ngModel) {
				ngModel.$render = function() {
					setValue(ngModel.$viewValue);
				};
			}

			function updateValue(e) {
				var val = elem.val();

				// don't update from placeholder, helps debounce<commit_msg>IE8/9 Fix text cursor not showing up when tabbing into a field<commit_after>/*
 * angular-shims-placeholder
 * https://github.com/jrief/angular-shims-placeholder
 *
 * Add Angular directives which emulates attribute ´placeholder´ in input fields
 * of type text for browsers not supporting this, ie. IE9 and below.
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

(function(angular, document, undefined) {
'use strict';

angular.module('ng.shims.placeholder', []).directive('placeholder', function($timeout) {
	if (! angular.mock) {
		// run unit tests, even if your browser supports the placeholder field
		var test = document.createElement("input");
		if (test.placeholder !== void 0)
			return {};
	}

	// No native support for attribute placeholder
	return {
		restrict: 'A',
		require: '?ngModel',
		priority: 1,
		link: function(scope, elem, attrs, ngModel) {
			var orig_val = getValue(),
				is_pwd = attrs.type === 'password',
				text = attrs.placeholder,
				emptyClassName = 'empty',
				domElem = elem[0],
				clone;

			if (!text) { return; }

			if (is_pwd) { setupPasswordPlaceholder(); }

			// init
			setValue(orig_val);

			// on focus, replace auto-label with empty field
			elem.bind('focus', function() {
				if (elem.hasClass(emptyClassName)) {
					elem.val('');
					elem.removeClass(emptyClassName);
					domElem.select(); // IE8/9 show text cursor after tabbing in
				}
			});

			// on blur, show placeholder if necessary
			elem.bind('blur', updateValue);

			// handler for model-less inputs to interact with non-angular code
			if (!ngModel) {
				elem.bind('change', updateValue);
			}

			// model -> view
			if (ngModel) {
				ngModel.$render = function() {
					setValue(ngModel.$viewValue);
				};
			}

			function updateValue(e) {
				var val = elem.val();

				// don't update from placeholder, helps debounce
{'fraction_non_alphanumeric': 0.1354998622968879, 'fraction_numerical': 0.00550812448361333, 'mean_word_length': 3.247953216374269, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '4120467', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1082, 'n_words': 326}