diff --git a/src/ngSanitize/sanitize.js b/src/ngSanitize/sanitize.js
index e669e77a63b1..1e424d693134 100644
--- a/src/ngSanitize/sanitize.js
+++ b/src/ngSanitize/sanitize.js
@@ -378,7 +378,12 @@ function decodeEntities(value) {
var content = parts[2];
if (content) {
hiddenPre.innerHTML=content.replace(/text', handler);
+ expect(text).toEqual('INNER_TEXT');
+ });
+ });
+ it('should use textContent if available', function() {
+ window.hiddenPre = {
+ textContent: 'TEXT_CONTENT',
+ innerText: 'INNER_TEXT'
+ };
+ inject(function($sanitize) {
+ htmlParser('text', handler);
+ expect(text).toEqual('TEXT_CONTENT');
+ });
+ });
+ it('should use textContent even if empty', function() {
+ window.hiddenPre = {
+ textContent: '',
+ innerText: 'INNER_TEXT'
+ };
+ inject(function($sanitize) {
+ htmlParser('text', handler);
+ expect(text).toEqual('');
+ });
+ });
+});