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.
Created attachment 19733 [details] test HTML file that reproduces the erroneous behavior
Created attachment 19734 [details] screenshot of Safari 3.0.4 rendering the test HTML file. WebKit nightly r30966 looks exactly the same.
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.
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>
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.
This surprised me today; is it still unclear what the behaviour ought to be?
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!
Thank you for checking! And the spec does say that innerText returns text "as rendered" when it's rendered, and DOM content otherwise.