-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
双向绑定ie11 input 中文placeholder 兼容问题 #495
Comments
我看看这个问题。但,为啥不在组件渲染前就设置好数据name? |
写了个比较原始的测试,没发现问题,不知道是不是因为我是模拟的ie11,而不是纯粹的。代码放出来你看看,我也再去找个原始的ie11试试看 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>中文</title>
</head>
<body>
<div id="a"></div>
<b id="b"></b>
<script>
function on(el, name, fn) {
if (el.addEventListener) {
el.addEventListener(name, fn, false);
}
else {
el.attachEvent('on' + name, fn);
}
}
var input = document.createElement('input');
document.getElementById('a').innerHTML = 'addEventListener is '
+ (input.addEventListener ? '' : 'not ') + 'supported.<br>'
+ 'oninput is '
+ (('oninput' in input) ? '' : 'not ') + 'supported.<br>'
+ 'window.CompositionEvent is '
+ (window.CompositionEvent ? '' : 'not ') + 'supported.';
input.setAttribute('type', 'text');
input.placeholder = '测试';
document.body.appendChild(input);
if ('oninput' in input) {
on(input, 'input', function () {
document.getElementById('b').innerHTML = (input.value) + ' inputed';
});
}
if (window.CompositionEvent) {
on(input, 'compositionstart', function () {
document.getElementById('b').innerHTML ='start';
});
on(input, 'compositionend', function () {
document.getElementById('b').innerHTML +='END';
});
on(input, 'change', function () {
document.getElementById('b').innerHTML +='change';
});
}
</script>
</body>
</html> |
angular/angular.js#2614 但实际上,上面两个issue描述都不完整。这个现象不是必发生,和
都有关系 我想想怎么改,目前还想不出来 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
版本:3.8.2
ie11下 placeholder为中文的时候,会默认触发一次input事件。导致在attached中设置的name的值被清空。
The text was updated successfully, but these errors were encountered: