MCPcopy Create free account
hub / github.com/socketstream/socketstream / breakLeftOf

Function breakLeftOf

docs/js/google-code-prettify.js:1033–1053  ·  view source on GitHub ↗
(limit, copy)

Source from the content-addressed store, hash-verified

1031 }
1032
1033 function breakLeftOf(limit, copy) {
1034 // Clone shallowly if this node needs to be on both sides of the break.
1035 var rightSide = copy ? limit.cloneNode(false) : limit;
1036 var parent = limit.parentNode;
1037 if (parent) {
1038 // We clone the parent chain.
1039 // This helps us resurrect important styling elements that cross lines.
1040 // E.g. in <i>Foo<br>Bar</i>
1041 // should be rewritten to <li><i>Foo</i></li><li><i>Bar</i></li>.
1042 var parentClone = breakLeftOf(parent, 1);
1043 // Move the clone and everything to the right of the original
1044 // onto the cloned parent.
1045 var next = limit.nextSibling;
1046 parentClone.appendChild(rightSide);
1047 for (var sibling = next; sibling; sibling = next) {
1048 next = sibling.nextSibling;
1049 parentClone.appendChild(sibling);
1050 }
1051 }
1052 return rightSide;
1053 }
1054
1055 var copiedListItem = breakLeftOf(lineEndNode.nextSibling, 0);
1056

Callers 1

breakAfterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected