MCPcopy Create free account
hub / github.com/choosehappy/QuickAnnotator / hiddenInputBrowserCacheDirective

Function hiddenInputBrowserCacheDirective

static/js/angular.js:27414–27453  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27412
27413
27414var hiddenInputBrowserCacheDirective = function() {
27415 var valueProperty = {
27416 configurable: true,
27417 enumerable: false,
27418 get: function() {
27419 return this.getAttribute('value') || '';
27420 },
27421 set: function(val) {
27422 this.setAttribute('value', val);
27423 }
27424 };
27425
27426 return {
27427 restrict: 'E',
27428 priority: 200,
27429 compile: function(_, attr) {
27430 if (lowercase(attr.type) !== 'hidden') {
27431 return;
27432 }
27433
27434 return {
27435 pre: function(scope, element, attr, ctrls) {
27436 var node = element[0];
27437
27438 // Support: Edge
27439 // Moving the DOM around prevents autofillling
27440 if (node.parentNode) {
27441 node.parentNode.insertBefore(node, node.nextSibling);
27442 }
27443
27444 // Support: FF, IE
27445 // Avoiding direct assignment to .value prevents autofillling
27446 if (Object.defineProperty) {
27447 Object.defineProperty(node, 'value', valueProperty);
27448 }
27449 }
27450 };
27451 }
27452 };
27453};
27454
27455
27456

Callers

nothing calls this directly

Calls 1

lowercaseFunction · 0.85

Tested by

no test coverage detected