Created
March 11, 2010 21:54
-
-
Save boucher/329712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/AppKit/Platform/DOM/CPPlatformString.j b/AppKit/Platform/DOM/CPPlatformString.j | |
| index 7b82f44..96c1dcc 100644 | |
| --- a/AppKit/Platform/DOM/CPPlatformString.j | |
| +++ b/AppKit/Platform/DOM/CPPlatformString.j | |
| @@ -67,11 +67,15 @@ var DOMSpanElement = nil, | |
| DOMSpanElement = DOMIFrameDocument.createElement("span"); | |
| DOMSpanElement.style.position = "absolute"; | |
| - DOMSpanElement.style.whiteSpace = "pre"; | |
| DOMSpanElement.style.visibility = "visible"; | |
| DOMSpanElement.style.padding = "0px"; | |
| DOMSpanElement.style.margin = "0px"; | |
| + try { | |
| + DOMSpanElement.style.whiteSpace = "pre"; | |
| + } | |
| + catch (e) {} | |
| + | |
| DOMDivElement.appendChild(DOMSpanElement); | |
| } | |
| @@ -93,16 +97,29 @@ var DOMSpanElement = nil, | |
| if (!aWidth) | |
| { | |
| style.width = ""; | |
| - style.whiteSpace = "pre"; | |
| + | |
| + try { | |
| + style.whiteSpace = "pre"; | |
| + } | |
| + catch (e) {} | |
| + | |
| + style.wordWrap = "normal"; | |
| } | |
| else | |
| { | |
| style.width = ROUND(aWidth) + "px"; | |
| + try | |
| + { | |
| + style.whiteSpace = "-o-pre-wrap"; | |
| + style.whiteSpace = "-pre-wrap"; | |
| + style.whiteSpace = "-moz-pre-wrap"; | |
| + style.whiteSpace = "pre-wrap"; | |
| + } catch(e) | |
| + { | |
| + //some versions of IE throw exceptions for unsupported properties. | |
| + } | |
| + | |
| style.wordWrap = "break-word"; | |
| - style.whiteSpace = "-o-pre-wrap"; | |
| - style.whiteSpace = "-pre-wrap"; | |
| - style.whiteSpace = "-moz-pre-wrap"; | |
| - style.whiteSpace = "pre-wrap"; | |
| } | |
| style.font = [aFont cssString]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment