Prefer textContent to innerText
Fixes #807.
Ben Alpert committed
Jan 3, 2014 at 23:56 UTC
309a88bcf62c1c64a2b91c0eb753c19209a425b2
1 file changed
+5
-3
src/dom/getTextContentAccessor.js
+5
-3
@@ -30,9 +30,11 @@ var contentKey = null;
30
*/
31
function getTextContentAccessor() {
32
if (!contentKey && ExecutionEnvironment.canUseDOM) {
33
- contentKey = 'innerText' in document.createElement('div') ?
34
- 'innerText' :
35
- 'textContent';
33
+ // Prefer textContent to innerText because many browsers support both but
34
+ // SVG <text> elements don't support innerText even when <div> does.
35
+ contentKey = 'textContent' in document.createElement('div') ?
36
+ 'textContent' :
37
+ 'innerText';
38
}
39
return contentKey;
40
}