Created
December 11, 2014 13:49
-
-
Save normanzb/137a8b9d0cf317a1be58 to your computer and use it in GitHub Desktop.
IE8 onpropertychange doesn't fire
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<input id="test" /> | |
<script type="text/javascript"> | |
(function(){ | |
var count = 0; | |
var h; | |
var test = document.getElementById("test"); | |
function onPropChange() { | |
if ( window.event.propertyName != 'value' ) { | |
return; | |
} | |
console.log('hello', count++); | |
if ( count > 10 ){ | |
return; | |
} | |
test.onpropertychange = null; | |
test.value = ''; | |
test.onpropertychange = onPropChange; | |
clearTimeout(h) | |
h = setTimeout(function(){ | |
count=0; | |
}); | |
}; | |
test.onpropertychange = onPropChange; | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment