<commit_before>(function (angular) {
    "use strict";

	var module = angular.module('net.enzey.menu', ['net.enzey.services']);

	module.provider('nzMenuConfig', function () {
		var positionFn = function(flyoutElem, contextElem, mouseEvent) {
			flyoutElem.css('position', 'absolute');
			contextElem.append(flyoutElem);
		};

		this.setPositionFn = function(_positionFn) {
			if (angular.isFunction(_positionFn)) {
				positionFn = _positionFn;
			}
		};

		this.$get = function() {
			return {
				getPositionFn: function() {
					return positionFn;
				}
			};
		};
	});

	module.directive('nzMenu', function ($compile, $parse, $document, $timeout, nzService, nzMenuConfig) {
		return {
			priority: 9999,
			compile: function ($element, $attrs) {
				//var html = $element.html();
				//$element.html('');
				var currentlyDisplayed = false;

				return {
					pre: function (scope, element, attrs) {
						if (!element.attr('isLifted')) {
							var positionFn = $parse(attrs.positionFn)(scope);
							if (!positionFn) {positionFn = nzMenuConfig.getPositionFn();}
							var contextObj = element.parent();
							contextObj.on('click', function(event) {
								if (!currentlyDisplayed) {
									currentlyDisplayed = true;
									var renderedHtml = $compile(html)(scope);
									positionFn(renderedHtml, contextObj, event);
									nzService.registerClickAwayAction(contextObj, function(event) {
										renderedHtml.remove();
										currentlyDisplayed = false;
									});
									scope.$apply();
								}
							});

							element.attr('isLifted', true);
							var html = element[0].outerHTML;
							element.remove();
						}
					},
					post: function (scope, element, attrs, controllers) {
						
					}
				}
			}
		};

	});

})(angular);<commit_msg>Only extract the raw uncompiled HTML once.<commit_after>(function (angular) {
    "use strict";

	var module = angular.module('net.enzey.menu', ['net.enzey.services']);

	module.provider('nzMenuConfig', function () {
		var positionFn = function(flyoutElem, contextElem, mouseEvent) {
			flyoutElem.css('position', 'absolute');
			contextElem.append(flyoutElem);
		};

		this.setPositionFn = function(_positionFn) {
			if (angular.isFunction(_positionFn)) {
				positionFn = _positionFn;
			}
		};

		this.$get = function() {
			return {
				getPositionFn: function() {
					return positionFn;
				}
			};
		};
	});

	module.directive('nzMenu', function ($compile, $parse, nzService, nzMenuConfig) {
		return {
			scope: true,
			priority: 9999,
			compile: function ($element, $attrs) {
				var currentlyDisplayed = false;

				var html;
				if (!$element.attr('isLifted')) {
					var html = $element[0].outerHTML;
				}

				return {
					pre: function (scope, element, attrs) {
						if (!element.attr('isLifted')) {
							var parentElem = $element.parent();
							var positionFn = $parse(attrs.positionFn)(scope);
							if (!positionFn) {positionFn = nzMenuConfig.getPositionFn();}

							parentElem.on('click', function(event) {
								if (!currentlyDisplayed) {
									currentlyDisplayed = true;
									var renderedHtml = $compile(html)(scope);
									positionFn(renderedHtml, parentElem, event);
									nzService.registerClickAwayAction(parentElem, function(event) {
										renderedHtml.remove();
										currentlyDisplayed = false;
									});
									scope.$apply();
								}
							});

							// Configure click action
							element.attr('isLifted', true);
							element.remove();
						}
					},
					post: function (scope, element, attrs, controllers) {
						
					}
				}
			}
		};

	});

})(angular);
{'fraction_non_alphanumeric': 0.14593698175787728, 'fraction_numerical': 0.002763957987838585, 'mean_word_length': 2.809473684210526, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7097935', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1078, 'n_words': 212}