From 309a88bcf62c1c64a2b91c0eb753c19209a425b2 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Fri, 3 Jan 2014 23:56:27 -0700 Subject: [PATCH] Prefer textContent to innerText Fixes #807. --- src/dom/getTextContentAccessor.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dom/getTextContentAccessor.js b/src/dom/getTextContentAccessor.js index 1475481e03..f9d141c7ca 100644 --- a/src/dom/getTextContentAccessor.js +++ b/src/dom/getTextContentAccessor.js @@ -30,9 +30,11 @@ var contentKey = null; */ function getTextContentAccessor() { if (!contentKey && ExecutionEnvironment.canUseDOM) { - contentKey = 'innerText' in document.createElement('div') ? - 'innerText' : - 'textContent'; + // Prefer textContent to innerText because many browsers support both but + // SVG elements don't support innerText even when
does. + contentKey = 'textContent' in document.createElement('div') ? + 'textContent' : + 'innerText'; } return contentKey; }