在 pre 标签或具有 pre-wrap 样式的容器中,
para a 和 para b 之间有一个 TextNode 内容为 '\n' ,
此时执行 document.execCommand('formatblock', false, 'blockquote')
然后 para b 被克隆了。
Chrome/21.0.1180.75 Safari/537.1
@font-face { | |
font-family: 'Helvetica Neue'; | |
unicode-range: U+FF0C, U+3001, U+3002; /* 仅转换顿号、逗号、句号 */ | |
src: local(PMingLiU); | |
} | |
@font-face { | |
font-family: sans-serif; | |
unicode-range: U+FF0C, U+3001, U+3002; | |
src: local(PMingLiU); |
var onOrientationChange, $html = $(document.documentElement) | |
if ('orientation' in window) { | |
onOrientationChange = function() { | |
var classes = { | |
'0': 'portrait', | |
'90': 'landscape landscape-left', | |
'-90': 'landscape landscape-right' | |
} | |
var values = function(o) { | |
return Object.keys(o).map(function (k) { return o[k] }) |
a .ellipsis:after { | |
content: '...'; | |
} | |
a .invisible { | |
font-size: 0; | |
line-height: 0; | |
} |
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style type="text/css"> | |
button { | |
display: block; | |
margin: 5px; | |
} |
// I 替换 | |
var span = goog.dom.createDom('span',{ innerText: element.nodeValue }) | |
element.parentNode.replaceChild(span, element) | |
// II 测量 | |
var clientRect = getElementClientRect(span) | |
// II 还原 | |
span.parentNode.replaceChild(element, span) | |
var pad = goog.userAgent.VERSION === '8.0' ? 2 : 0 | |
var range = document.selection.createRange() |
chain = (o, fn) -> () -> fn.call o | |
$body = $ document.body | |
do chain $body, -> | |
@css 'background','sienna' | |
@addClass 'sienna' |
<!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; |
在 pre 标签或具有 pre-wrap 样式的容器中,
para a 和 para b 之间有一个 TextNode 内容为 '\n' ,
此时执行 document.execCommand('formatblock', false, 'blockquote')
然后 para b 被克隆了。
Chrome/21.0.1180.75 Safari/537.1
/* | |
http://stackoverflow.com/questions/65849/how-to-insert-line-breaks-in-html-documents-using-css/66000#66000 | |
*/ | |
a:before { | |
content: '\a'; | |
white-space: pre; | |
} |
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style type="text/css"> | |
a { | |
/*text-decoration: none;*/ | |
} |