Created
August 15, 2012 13:40
-
-
Save ambar/3360256 to your computer and use it in GitHub Desktop.
Maxthon 3.42 line break bug
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
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style type="text/css"> | |
#editable { | |
padding: .5em; | |
min-height: 200px; | |
border: 1px dotted gray; | |
white-space: pre-wrap; | |
line-height: 1.5; | |
} | |
#log { | |
margin-top: 1em; | |
padding: 1em; | |
min-height: 1em; | |
background: #cde; | |
white-space: pre-wrap; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="editable" contentEditable>contentEditable</div> | |
<div id="log"></div> | |
<script> | |
var $ = document.querySelector.bind(document) | |
var editable = $('#editable') | |
var log = $('#log') | |
var dump = function() { | |
log.textContent = editable.innerHTML | |
} | |
editable.oninput = dump | |
dump() | |
var selection = document.getSelection() | |
selection.collapse(editable, true) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment