WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 richedit getXHTML bug, andot, October 25, 2002
     Re:richedit getXHTML bug, Erik Arvidsson, October 25, 2002
         Re:richedit getXHTML bug, andot, October 26, 2002
             Re:richedit getXHTML bug, Erik Arvidsson, October 27, 2002
                 Re:richedit getXHTML bug , andot, October 28, 2002
                     Re:richedit getXHTML bug , Erik Arvidsson, October 28, 2002
                 Re:richedit getXHTML bug, andot, October 28, 2002
             Re:richedit getXHTML bug, Erik Arvidsson, October 27, 2002
                 Re:richedit getXHTML bug, andot, October 28, 2002

Subject: Re:richedit getXHTML bug From: andot Date: October 28, 2002

I find another bug in getxhtml 1.03.

this bug not only in IE 5.x, but also in IE 6. the bug can find in your example getxhtmdemo.html. when I click [Get XHTML] button, the following code

<button onclick="alert( getXhtml( getSelectedObject() ) )">Get XHTML</button>

will be changed into

<button onclick="function anonymous()
{
alert( getXhtml( getSelectedObject() ) )
}">Get XHTML</button>

I find this bug caused by the method node.getAttribute , so I think the following code is better than only using node.getAttribute. Although this code is so long than yours.

function isInt(s){
  return (parseInt(s).toString() == s.toString());
}

function _getAttribute(node, attr){
  return isInt(attr.nodeValue) ? node.getAttribute(attr.nodeName) : attr.nodeValue;
}

function _appendNodeXHTML(node, sb) {
...
...

     if (attrs[i].nodeName != "style") {
      sb.append(" " +
       (attrs[i].expando ? attrs[i].nodeName : attrs[i].nodeName.toLowerCase()) +
       "=\"" + _fixAttribute(_getAttribute(node, attrs[i])) + "\"");
     }
     else
      sb.append(" style=\"" + _fixAttribute(node.style.cssText) + "\"");
...
...

I trust you can make it shorter. Thank you!

From: Erik Arvidsson
Sent: October 28, 2002
Subject: Re:richedit getXHTML bug

I update getxhtml to 1.03 so the unit bug in IE5.x is worked around.

See http://webfx.eae.net/download/

erik





Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX