Bug 17830

Summary: innerText returns incorrectly capitalized text with text-transform: uppercase
Product: WebKit Reporter: Mark Ambachtsheer <mark.a>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ahmad.saleem792, ap, jerome, mitz, nishgau28
Priority: P2 Keywords: HasReduction
Version: 523.x (Safari 3)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
test HTML file that reproduces the erroneous behavior
none
screenshot of Safari 3.0.4 rendering the test HTML file.
none
screenshot of Internet Explorer 7 rendering the HTML test file.
none
Safari 15.5 matches other browsers none

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.