| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 26 | 2 | 4 | 0.952 | StatementList[4] |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 26 | 115 | Closure/closure/goog/dom/selection.js |
| 2 | 25 | 384 | Closure/closure/goog/dom/selection.js |
| ||||
// Text within the selection , e.g. "" assuming that the cursor is just after
// the \r\n combination.
var selectionText= selectionRange.text;
// Text within the selection, e.g., "" (this will later include the \r\n
// sequences also)
var untrimmedSelectionText= selectionText;
// Boolean indicating whether we are done dealing with the text before the
// selection's beginning.
var isRangeEndTrimmed= false;
// Go over the range until it becomes a 0-lengthed range or until the range
// text starts changing when we move the end back by one character.
// If after moving the end back by one character, the text remains the same,
// then we need to add a "\r\n" at the end to get the actual text.
while (!isRangeEndTrimmed) {
if (range.compareEndPoints('StartToEnd', range)== 0) {
isRangeEndTrimmed= true;
}
else {
range.moveEnd('character', -1);
if (range.text== beforeSelectionText) {
// If the start position of the cursor was after a \r\n string,
// we would skip over it in one go with the moveEnd call, but
// range.text will still show "Hello" (because of the IE range.text
// bug) - this implies that we should add a \r\n to our
// untrimmedBeforeSelectionText string.
untrimmedBeforeSelectionText+= '\r\n';
}
else {
isRangeEndTrimmed= true;
}
}
}
|
| ||||
// Text within the selection , e.g. "o" assuming that the cursor is just after
// the \r\n combination.
var selectionText= selectionRange.text;
// Text within the selection, e.g., "o" (this will later include the \r\n
// sequences also)
var untrimmedSelectionText= selectionText;
// Boolean indicating whether we are done dealing with the text inside the
// selection.
var isSelectionRangeEndTrimmed= false;
// Go over the selected range until it becomes a 0-lengthed range or until
// the range text starts changing when we move the end back by one character.
// If after moving the end back by one character, the text remains the same,
// then we need to add a "\r\n" at the end to get the actual text.
while (!isSelectionRangeEndTrimmed) {
if (selectionRange.compareEndPoints('StartToEnd', selectionRange)== 0) {
isSelectionRangeEndTrimmed= true;
}
else {
selectionRange.moveEnd('character', -1);
if (selectionRange.text== selectionText) {
// If the selection was not empty, and the end point of the selection
// was just after a \r\n, we would have skipped it in one go with the
// moveEnd call, and this implies that we should add a \r\n to the
// untrimmedSelectionText string.
untrimmedSelectionText+= '\r\n';
}
else {
isSelectionRangeEndTrimmed= true;
}
}
}
|
| |||
// Text within the selection , e.g. "" assuming that the cursor is just after
// Text within the selection , e.g. "o" assuming that the cursor is just after
// the \r\n combination.
var selectionText=selectionRange.text;
// Text within the selection, e.g., "" (this will later include the \r\n
// Text within the selection, e.g., "o" (this will later include the \r\n
// sequences also)
var untrimmedSelectionText=selectionText;
// Boolean indicating whether we are done dealing with the text before the
// selection's beginning.
// Boolean indicating whether we are done dealing with the text inside the
// selection.
var [[#variable61b516a0]]= false;
// Go over the range until it becomes a 0-lengthed range or until the range
// text starts changing when we move the end back by one character.
// Go over the selected range until it becomes a 0-lengthed range or until
// the range text starts changing when we move the end back by one character.
// If after moving the end back by one character, the text remains the same,
// then we need to add a "\r\n" at the end to get the actual text.
while (! [[#variable61b516a0]])
{ if ( [[#variable572332e0]].compareEndPoints('StartToEnd', [[#variable572332e0]])==0)
{ [[#variable61b516a0]]= true;
}
else
{ [[#variable572332e0]].moveEnd('character',-1);
if ( [[#variable572332e0]].text== [[#variable623ab5e0]])
{ [[#variable5bc374e0]]+='\r\n';
}
else
{ [[#variable61b516a0]]= true;
}
}
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#61b516a0]] | isRangeEndTrimmed |
| 1 | 2 | [[#61b516a0]] | isSelectionRangeEndTrimmed |
| 2 | 1 | [[#572332e0]] | range |
| 2 | 2 | [[#572332e0]] | selectionRange |
| 3 | 1 | [[#623ab5e0]] | beforeSelectionText |
| 3 | 2 | [[#623ab5e0]] | selectionText |
| 4 | 1 | [[#5bc374e0]] | // If the start position of the cursor was after a \r\n string, // we would skip over it in one go with the moveEnd call, but // range.text will still show "Hello" (because of the IE range.text // bug) - this implies that we should add a \r\n to our // untrimmedBeforeSelectionText string. untrimmedBeforeSelectionText |
| 4 | 2 | [[#5bc374e0]] | // If the selection was not empty, and the end point of the selection // was just after a \r\n, we would have skipped it in one go with the // moveEnd call, and this implies that we should add a \r\n to the // untrimmedSelectionText string. untrimmedSelectionText |