aide comprehension d'un script
salut , j'utilise un script pour insérer des balises html sur un texte selectionner dans une textarea, par contre j'aimerais comprendre exactement certaines lignes.
si quelqu'un veut bien m'expliquer :
ceci
Code:
1 2 3
|
if (textEl.createTextRange)
textEl.caretPos = document.selection.createRange().duplicate(); |
ceci
Code:
1 2 3 4 5 6
|
if (textEl.createTextRange && textEl.caretPos)
{
var caretPos = textEl.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
} |
merci @+ :D