Juan R. González-Álvarez wrote:
Ok i think that Henry is right and the problem is not in replace but in
the posterior createTextNode method when it finds the "&" in the string
and escape like "&" when generating the HTML.
What would be more easy way to fix that?
ISTM there is no problem but a misconception of yours that needs fixing.
The DOM2Core:Document::createTextNode() method that you presumably speak
of takes a DOMString value as argument, supported by a primitive string
value in ECMAScript implementations per the DOM 2 Core Specifications'
ECMAScript Binding section.
document.createTextNode("&")
is supposed to create a TextNode object[1] with the content
&
and return a reference to it which is represented in HTML by
&
among other entity references. Maybe you think that
<a href="http://foo.example/?bar=42&baz=23">...</a>
would not be correct in which case you should read on SGML and HTML, and
validate your markup (you should do that anyway) because you were wrong then.
See also:
http://www.w3.org/TR/DOM-Level-2-Core/ http://www.w3.org/TR/html4/ http://validator.w3.org/
PointedEars
-----------
[1] "Foo object" is a short-hand term for "an object that implements the
Foo interface"
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16