在IE8中键入第一个单词时不会触发onpropertychange

时间:2015-08-31 08:24:36

标签: internet-explorer-8 propertychanged

如果在绑定propertychange事件时给出输入值,则不会触发第一次更改 <VirtualHost *:443> ServerAdmin webmaster@localhost ServerName seafile.mlnet.de/ DocumentRoot /var/www/html Alias /media /home/seafile/haiwen/seafile-server-latest/seahub/media ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown RewriteEngine On ProxyPass /seafhttp http://127.0.0.1:8082 ProxyPassReverse /seafhttp http://127.0.0.1:8082 RewriteRule ^/seafhttp - [QSA,L] RewriteRule ^/(media.*)$ /$1 [QSA,L,PT] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /seahub.fcgi/$1 [QSA,L,E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] </VirtualHost>
例如 输入“12345” 键入“1”时没有任何反应; 如何在没有setTimeout的情况下修复;

1 个答案:

答案 0 :(得分:0)

我添加了keyup事件以修复IE8

if (browser.ie < 10) { // 检查是否为可输入元素 var isInput = function(elem) { return elem.nodeName == 'INPUT' || elem.nodeName == 'TEXTAREA'; }, iefx = _.uniqueId('.ieinputFixed'); $.event.special.input = { setup: function() { if (!isInput(this)) return false; var elem = this, oldValue = this.value, setter = function() { if (oldValue !== elem.value) { oldValue = elem.value; $.event.trigger('input', null, elem); } }, doc = $(document); // oldValue = elem.value; if (browser.ie == 9 || browser.ie == 8) { $(elem).on('focus' + iefx, function() { doc.on('selectionchange' + iefx, setter); }).on('blur' + iefx, function() { doc.off('selectionchange' + iefx, setter); }); } // IE8 if (browser.ie == 8) { $(elem).on('keyup' + iefx, setter); } //ie6-9 elem.attachEvent('onpropertychange', $.data(elem, iefx, function(event) { if (event.propertyName.toLowerCase() == "value") { setter(); } })); }, teardown: function() { if (!isInput(this)) return false; if (browser.ie == 9 || browser.ie == 8) $.event.remove(this, iefx); this.detachEvent('onpropertychange', $.data(this, iefx)); $.removeData(this, iefx); } }; }