rem:  a = right.previousSibling; if (a && !/\S/.test(HTMLArea.getInnerText(a))) HTMLArea.removeFromParent(a); if (!/\S/.test(HTMLArea.getInnerText(right))) {  a = right.lastChild; if (a && !/\S/.test(HTMLArea.getInnerText(a))) HTMLArea.removeFromParent(a); right.appendChild(doc.createElement('br')); } 
context: HTMLArea.prototype._checkInsertP = function() {	var editor = this;	this.focusEditor();	var i, left, right, rangeClone,		sel	= this._getSelection(),		range	= this._createRange(sel),		p	= this.getAllAncestors(),		block	= null,		a	= null,		doc	= this._doc;		for (i = 0; i < p.length; ++i) {		if (HTMLArea.isBlockElement(p[i]) && !/html|body|table|tbody|tr/i.test(p[i].tagName)) {			block = p[i];			break;		}	}	if (!range.collapsed) {		range.deleteContents();	}	this.emptySelection(sel);	if (!block || /^(td|div)$/i.test(block.tagName)) {		if (!block) var block = doc.body;		if (/\S/.test(HTMLArea.getInnerText(block))) {			rangeClone = range.cloneRange();			rangeClone.setStartBefore(block.firstChild);			rangeClone.surroundContents(left = doc.createElement('p'));			if (!/\S/.test(HTMLArea.getInnerText(left))) {					// Remove any element created empty				a = left.lastChild;				if (a && !/\S/.test(HTMLArea.getInnerText(a))) HTMLArea.removeFromParent(a);				left.appendChild(doc.createElement('br'));			}			left.normalize();			range.setStartAfter(left);			range.setEndAfter(block.lastChild);				// Working around Safari issue: The following gives a range exception				// range.surroundContents(right = doc.createElement('p'));			right = doc.createElement('p');			right.appendChild(range.extractContents());			block.appendChild(right);				// Remove any element created empty			a = right.previousSibling;			if (a && !/\S/.test(HTMLArea.getInnerText(a))) HTMLArea.removeFromParent(a);			if (!/\S/.test(HTMLArea.getInnerText(right))) {					// Remove any element created empty				a = right.lastChild;				if (a && !/\S/.test(HTMLArea.getInnerText(a))) HTMLArea.removeFromParent(a);				right.appendChild(doc.createElement('br'));			}			right.normalize();		} else {			range = doc.createRange();			var first = block.firstChild;			if (first) block.removeChild(first);			block.appendChild(right = doc.createElement('p'));			if (first) right.appendChild(first);		}		range.selectNodeContents(right);	} else {		range.setEndAfter(block);		var df = range.extractContents(), left_empty = false;		if(!/\S/.test(HTMLArea.getInnerText(block))) {			block.innerHTML = "<br />";			left_empty = true;		}		p = df.firstChild;		if (p) {			if(!/\S/.test(HTMLArea.getInnerText(p))) { 				if (/^h[1-6]$/i.test(p.tagName)) p = this.convertNode(p,"p");				p.innerHTML = "<br />";			}			if(/^li$/i.test(p.tagName) && left_empty && !block.nextSibling) {				left = block.parentNode;				left.removeChild(block);				range.setEndAfter(left);				range.collapse(false);				p = this.convertNode(p, /^li$/i.test(left.parentNode.tagName) ? "br" : "p");			}			range.insertNode(df);				// Remove any anchor created empty			var a = p.previousSibling.lastChild;			if (a && /^a$/i.test(a.tagName) && !/\S/.test(a.innerHTML)) HTMLArea.removeFromParent(a);			range.selectNodeContents(p);		}	}	range.collapse(true);	this.emptySelection(sel);	this.addRangeToSelection(sel, range);	this.scrollToCaret();};
meta: 9100	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/9100/4bcff78764dcdcc39dcb903f0af84e382c4f87a7/htmlarea-gecko.js/buggy/typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js