Opened 12 years ago

Closed 11 years ago

#446 closed defect (fixed)

Paragraph tags acting weird in Firefox 1.0.6

Reported by: phpdev Owned by: yermol
Priority: normal Milestone: Version 1.0
Component: Plugin_EnterParagraphs Version: trunk
Severity: normal Keywords:
Cc:

Description

If you press enter in Firefox (with no other text in the textarea) the following is html entered:

<body><p>&nbsp;</p></body><p></p>

It works fine in IE :S
Also the spacing in the editor window is erratic when entering and deleting paragraphs in Firefox, and occasionally it is impossible to delete a paragraph. This is all when no other content is in the textarea.

Change History (6)

comment:1 Changed 11 years ago by xinha.20.artus83@…

The problem is cause by this code in enter-paragraph.js (lines 704-707):

  if ( cnt.nodeType == 11 && !cnt.firstChild )
		{
		cnt.appendChild(editor._doc.createElement(pify.nodeName));
		}

When enter is pressed, these lines create a body Element, and append it to the cnt, which is inserted into the document later. This is certainly not the intended behavior, but I am unsure, what those lines are for in the first place. Any ideas?

comment:2 Changed 11 years ago by wreimer@…

  • Summary changed from Paragraph tags acting weird in Firefox 1.0.6/Linux to Paragraph tags acting weird in Firefox 1.0.6

Not sure what the line is for, but simply adding a test for BODY fixes it:

if ( cnt.nodeType == 11 && !cnt.firstChild && pify.nodeName != "BODY")
	{
	cnt.appendChild(editor._doc.createElement(pify.nodeName));}
	}

And this issue is not just in Linux.

Wes

comment:3 Changed 11 years ago by wreimer@…

Sorry, that should be (removed extra brace):

if ( cnt.nodeType == 11 && !cnt.firstChild && pify.nodeName != "BODY")
	{
	cnt.appendChild(editor._doc.createElement(pify.nodeName));
	}

comment:4 Changed 11 years ago by wreimer@…

Upon further testing, this seems to be better, since there are some cases where it seems that we sometimes do want to create a body tag (even though this doesn't make sense -- more testing needed!) :

  if ( cnt.nodeType == 11 && !cnt.firstChild)
  {	
  if (pify.nodeName != "BODY" || (pify.nodeName == "BODY" && pifyOffset != 0)) 
    { //WKR: prevent body tag in empty doc
	cnt.appendChild(editor._doc.createElement(pify.nodeName));
    }
  }

comment:5 Changed 11 years ago by gogo

  • Component changed from Xinha Core to Plugin_EnterParagraphs
  • Milestone set to Version 1.0
  • Owner changed from gogo to yermol
  • Priority changed from high to normal
  • Severity changed from major to normal
  • Version set to trunk

Shifting this to be applied for 1.0 release.

comment:6 Changed 11 years ago by gogo

  • Resolution set to fixed
  • Status changed from new to closed

Applied in changeset:501

Note: See TracTickets for help on using tickets.