Bug 14805 - innerText doesn't return display:none or visibility:hidden text
Summary: innerText doesn't return display:none or visibility:hidden text
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P4 Minor
Assignee: Nobody
Depends on:
Reported: 2007-07-29 13:03 PDT by Derk-Jan Hartman
Modified: 2022-08-18 16:24 PDT (History)
14 users (show)

See Also:

Test case from Comment #0 (402 bytes, text/html)
2007-07-29 13:58 PDT, David Kilzer (:ddkilzer)
no flags Details
Safari 15.6 matches with other browsers (609.14 KB, image/png)
2022-08-09 10:02 PDT, Ahmad Saleem
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Derk-Jan Hartman 2007-07-29 13:03:13 PDT
I trust the intent here is to emulate IE behaviour, because innerText does not seem to have a standard specification.

It seems that there is currently a difference in behaviour though, take the following HTML
<td><span style="display:none">02005-06-02</span> <a href="/wiki/June_2" title="June 2">June 2</a>, <a href="/wiki/2005" title="2005">2005</a></td>

in IE innerText should result in: "02005-06-02 June 2, 2005"  (at least earlier versions, I did not test in IE7)
on Safari 3.0.2 i get: "June 2, 2005"
Comment 1 David Kilzer (:ddkilzer) 2007-07-29 13:58:42 PDT
Created attachment 15725 [details]
Test case from Comment #0

Both Safari 2.0.4 (419.3) with original WebKit and Safari 3 Public Beta v. 3.0.2 (522.12) with a local debug build of WebKit r24749 on Mac OS X 10.4.10 (8R218) both result in:

Actual td.innerText = 'June 2, 2005'

Firefox on 10.4.10:

Actual td.innerText = 'undefined'
Comment 2 Sam Weinig 2007-07-29 14:39:12 PDT
As a work around, you can can use the textContent attribute to get the same result as innerText on IE.
Comment 3 Derk-Jan Hartman 2007-08-09 15:17:20 PDT
This workaround is now used in wikipedia http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=24647

However, i still think that if we implement IE specific behaviour, it should either work exactly like that, or not be implemented at all.
Comment 7 dawn wells 2018-11-03 05:54:22 PDT
Thank you for the workaround. I will soon try that and will update you on my website http://www.soundadvicefl.com/. Will it work for any other browser?
Comment 10 Ahmad Saleem 2022-08-09 10:02:24 PDT
Created attachment 461506 [details]
Safari 15.6 matches with other browsers

I am not able to reproduce this bug and as can be seen from attached screenshot, all browsers (Chrome Canary 106, Firefox Nightly 105 and Safari 15.6) match each other in test case. I am going to mark this as "RESOLVED CONFIGURATION CHANGED".

If this is still present, please ignore my comment and reopen. Thanks!
Comment 11 Alexey Proskuryakov 2022-08-18 16:24:10 PDT
Our behavior hasn't changed, but no changes are expected as all current browsers align.