Bug 17830 - innerText returns incorrectly capitalized text with text-transform: uppercase
Summary: innerText returns incorrectly capitalized text with text-transform: uppercase
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2008-03-13 11:19 PDT by Mark Ambachtsheer
Modified: 2022-06-01 08:35 PDT (History)
5 users (show)

See Also:


Attachments
test HTML file that reproduces the erroneous behavior (656 bytes, text/html)
2008-03-13 11:20 PDT, Mark Ambachtsheer
no flags Details
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 Details
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 Details
Safari 15.5 matches other browsers (469.26 KB, image/png)
2022-06-01 03:14 PDT, Ahmad Saleem
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Ambachtsheer 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.
Comment 1 Mark Ambachtsheer 2008-03-13 11:20:31 PDT
Created attachment 19733 [details]
test HTML file that reproduces the erroneous behavior
Comment 2 Mark Ambachtsheer 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.
Comment 3 Mark Ambachtsheer 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.
Comment 4 Mark Ambachtsheer 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>
Comment 5 Mark Ambachtsheer 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>
Comment 6 Dave Hyatt 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.


Comment 7 Jerome Leclanche 2013-03-31 12:22:45 PDT
This surprised me today; is it still unclear what the behaviour ought to be?
Comment 9 Ahmad Saleem 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!
Comment 10 Alexey Proskuryakov 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.