-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathie8_bug.html
115 lines (101 loc) · 4.01 KB
/
ie8_bug.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>React IE8 on paste</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/3.4.0/es5-shim.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/3.4.0/es5-sham.min.js"></script>
<script type="text/javascript" src="http://fb.me/react-with-addons-0.10.0.js"></script>
<style>
.editable {
border: 1px #CCC solid;
padding: 5px;
background-color: #FFF;
}
html, body {
background-color: #F1F2F3;
height: 100%;
}
</style>
</head>
<body>
<h1>React: IE8 onPaste example: </h1>
<p>This example pages shows the issue that the onPaste event is not being fired in React in IE8.</p>
<p><b>Pasting into either container should show an alert box.</b></p>
<h2>1. React container:</h2>
<div id="container"></div>
<h2>2. Standard container with Event Listener</h2>
<div id="container2" class="editable" contenteditable="true"></div>
<h2>3. Standard container with Event Listener via Bubbling</h2>
<div id="container3" class="editable" contenteditable="true"></div>
<script>
// Console-polyfill. MIT license.
// https://github.com/paulmillr/console-polyfill
// Make it safe to do console.log() always.
(function(con) {
'use strict';
var prop, method;
var empty = {};
var dummy = function() {};
var properties = 'memory'.split(',');
var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +
'groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,' +
'table,time,timeEnd,timeStamp,trace,warn').split(',');
while (prop = properties.pop()) con[prop] = con[prop] || empty;
while (method = methods.pop()) con[method] = con[method] || dummy;
})(this.console = this.console || {}); // Using `this` for web workers.
/**
* Simple React contentEditable.
*/
var Editable = React.createClass({
render: function(){
return React.DOM.div({
contentEditable: true,
className: "editable",
onPaste: this.handlePaste
});
},
handlePaste: function(e){
alert('Pasted!');
}
});
//Load all of the things
window.onload = function(){
React.renderComponent(Editable(), document.getElementById('container'));
if('addEventListener' in window){
document.getElementById("container2").addEventListener('paste', function(){
alert("pasted");
}, false);
} else if ('attachEvent' in window){
document.getElementById("container2").attachEvent('onpaste', function(){
alert('Pasted!');
});
}
var bubbleFn = function(e){
e = e || window.event;
var t = e.target || e.srcElement;
if(t == document.getElementById('container3')){
alert('Pasted!');
}
};
if('addEventListener' in window){
document.addEventListener('paste', bubbleFn, false);
} else if ('attachEvent' in window){
document.attachEvent('onpaste', bubbleFn);
}
};
</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-34444698-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>