Skip to content

Instantly share code, notes, and snippets.

@ambar
Created August 15, 2012 13:40
Show Gist options
  • Save ambar/3360256 to your computer and use it in GitHub Desktop.
Save ambar/3360256 to your computer and use it in GitHub Desktop.
Maxthon 3.42 line break bug
<!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