RESOLVED CONFIGURATION CHANGED 17830
innerText returns incorrectly capitalized text with text-transform: uppercase
https://bugs.webkit.org/show_bug.cgi?id=17830
Summary innerText returns incorrectly capitalized text with text-transform: uppercase
Mark Ambachtsheer
Reported 2008-03-13 11:19:03 PDT
When innerText is used to retrieve the text content of an element, and that text has the CSS style 'text-transform: uppercase' on it, innerText returns capitalized plain text.
Attachments
test HTML file that reproduces the erroneous behavior (656 bytes, text/html)
2008-03-13 11:20 PDT, Mark Ambachtsheer
no flags
screenshot of Safari 3.0.4 rendering the test HTML file. (37.27 KB, application/octet-stream)
2008-03-13 11:24 PDT, Mark Ambachtsheer
no flags
screenshot of Internet Explorer 7 rendering the HTML test file. (19.74 KB, application/octet-stream)
2008-03-13 11:27 PDT, Mark Ambachtsheer
no flags
Safari 15.5 matches other browsers (469.26 KB, image/png)
2022-06-01 03:14 PDT, Ahmad Saleem
no flags
Mark Ambachtsheer
Comment 1 2008-03-13 11:20:31 PDT
Created attachment 19733 [details] test HTML file that reproduces the erroneous behavior
Mark Ambachtsheer
Comment 2 2008-03-13 11:24:56 PDT
Created attachment 19734 [details] screenshot of Safari 3.0.4 rendering the test HTML file. WebKit nightly r30966 looks exactly the same.
Mark Ambachtsheer
Comment 3 2008-03-13 11:27:19 PDT
Created attachment 19736 [details] screenshot of Internet Explorer 7 rendering the HTML test file. Shows Internet Explorer rendering the test file. 'innerText' is not part of any standard, but it is supported by Internet Explorer. Presumably this is therefore the reference rendering.
Mark Ambachtsheer
Comment 4 2008-03-13 11:30:14 PDT
Comment on attachment 19733 [details] test HTML file that reproduces the erroneous behavior <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>text-transform: uppercase and innerText</title> </head> <body> <div id='testDiv' style='text-transform: uppercase;'>The quick brown fox jumped over the lazy dogs</div> <div>The following text is the result of retrieving the innerText property of the div containing the previous text:</div > <div> <script type="text/javascript"> <!-- var testDiv = document.getElementById('testDiv'); document.write(testDiv.innerText); --> </script> </div> </body> </html>
Mark Ambachtsheer
Comment 5 2008-03-13 11:31:57 PDT
Comment on attachment 19733 [details] test HTML file that reproduces the erroneous behavior <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>text-transform: uppercase and innerText</title> </head> <body> <div id='testDiv' style='text-transform: uppercase;'>The quick brown fox jumped over the lazy dogs</div> <div>The following text is the result of retrieving the innerText property of the div containing the previous text:</div > <div> <script type="text/javascript"> <!-- var testDiv = document.getElementById('testDiv'); document.write(testDiv.innerText); --> </script> </div> </body> </html>
Dave Hyatt
Comment 6 2008-03-13 15:22:41 PDT
I'm surprised by this behavior. I thought .innerText is supposed to show rendered text (and not just raw DOM contents). Therefore I'd expect the text-transform to be included.
Jerome Leclanche
Comment 7 2013-03-31 12:22:45 PDT
This surprised me today; is it still unclear what the behaviour ought to be?
Ahmad Saleem
Comment 9 2022-06-01 03:14:55 PDT
Created attachment 459923 [details] Safari 15.5 matches other browsers I am unable to reproduce this on Safari 15.5 and it matches browser as shown in the picture. Can this is be marked as "RESOLVED CONFIGURATION CHANGED"? Thanks!
Alexey Proskuryakov
Comment 10 2022-06-01 08:35:45 PDT
Thank you for checking! And the spec does say that innerText returns text "as rendered" when it's rendered, and DOM content otherwise.
Note You need to log in before you can comment on or make changes to this bug.