bug 549295 - html serializer should not wrap by default. r=Olly sr=Boris

This commit is contained in:
Laurent Jouanneau 2010-04-03 14:51:17 +02:00
parent e0ac5d5547
commit 80bbbfa384
38 changed files with 257 additions and 231 deletions

View File

@ -104,13 +104,10 @@ nsXHTMLContentSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
// The previous version of the HTML serializer did implicit wrapping
// when there is no flags, so we keep wrapping in order to keep
// compatibility with the existing calling code
// XXXLJ perhaps we should remove these two default settings later ?
// XXXLJ perhaps should we remove this default settings later ?
if (aFlags & nsIDocumentEncoder::OutputFormatted ) {
aFlags = aFlags | nsIDocumentEncoder::OutputWrap;
}
else if (!(aFlags & nsIDocumentEncoder::OutputRaw)) {
aFlags = aFlags | nsIDocumentEncoder::OutputWrap;
}
nsresult rv;
rv = nsXMLContentSerializer::Init(aFlags, aWrapColumn, aCharSet, aIsCopying, aRewriteEncodingDeclaration);
@ -185,7 +182,9 @@ nsXHTMLContentSerializer::AppendText(nsIDOMText* aText,
PRInt32 lastNewlineOffset = kNotFound;
if (HasLongLines(data, lastNewlineOffset)) {
// We have long lines, rewrap
mDoWrap = PR_TRUE;
AppendToStringWrapped(data, aStr);
mDoWrap = PR_FALSE;
}
else {
AppendToStringConvertLF(data, aStr);

View File

@ -184,6 +184,7 @@ _TEST_FILES = test_bug5141.html \
file_htmlserializer_1_sibling_body.html \
file_htmlserializer_1_sibling_body_only_body.html \
file_htmlserializer_1_no_body.html \
file_htmlserializer_1_wrap.html \
test_bug424359-2.html \
file_htmlserializer_2.html \
test_bug431082.html \
@ -283,6 +284,7 @@ _TEST_FILES = test_bug5141.html \
file_xhtmlserializer_1_sibling_body.xhtml \
file_xhtmlserializer_1_sibling_body_only_body.xhtml \
file_xhtmlserializer_1_no_body.xhtml \
file_xhtmlserializer_1_wrap.xhtml \
test_bug422403-2.xhtml \
file_xhtmlserializer_2.xhtml \
file_xhtmlserializer_2_basic.xhtml \

View File

@ -3,10 +3,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -28,8 +26,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -43,5 +40,4 @@ ut gravida eros leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body>

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html><head><meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test for html serializer</title>
</head><body>
@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -33,8 +30,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -48,5 +44,4 @@ ut gravida eros leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html><head><meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test for html serializer</title>
</head><body>
@ -8,11 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a
href="http://mochi.test:8888/tests/content/base/test/file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="http://mochi.test:8888/tests/content/base/test/file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -34,8 +30,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -49,5 +44,4 @@ ut gravida eros leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html><head><meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test for html serializer</title>
</head><body>
@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -33,8 +30,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -48,6 +44,4 @@ ut gravida eros leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p><body><p>this is
an other body element</p></body></body></html>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p><body><p>this is an other body element</p></body></body></html>

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html><head><meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test for html serializer</title>
</head></html>

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html><head><meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test for html serializer</title>
</head><body>
@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -33,8 +30,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -48,5 +44,4 @@ ut gravida eros leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html><head><meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test for html serializer</title>
</head><body>
@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -33,8 +30,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -52,5 +48,4 @@ ut gravida eros leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html><head><meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test for html serializer</title>
</head><body><p>this is an other body element</p></body><body>
@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -33,8 +30,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -48,5 +44,4 @@ ut gravida eros leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>

View File

@ -3,10 +3,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -28,8 +26,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -43,5 +40,4 @@ ut gravida eros leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body>

View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html><head><meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<title>Test for html serializer</title>
</head><body>
<p>Hello world</p> <p>
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
nostra, per inceptos hymenaeos. </p>
<ul><li>Nam tellus massa,éàèçù</li><li>
fringilla
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
<script type="text/javascript">
// a script which does nothing
function nothing() {
var hey="hello";
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
}
var a=3, b=4, c=7;
// here we test the non-serialization of xml character into javascript content
var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br>
nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
lacus risus pulvinar ante.
</pre>
ut gravida eros leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>

View File

@ -1,11 +1,9 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset="><title>Test
for html serializer with entities</title>
<meta http-equiv="content-type" content="text/html; charset="><title>Test for html serializer with entities</title>
</head><body>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability
with older products that don't support α and friends.</p>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability with older products that don't support α and friends.</p>
<p>latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´
µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ

View File

@ -1,11 +1,9 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset="><title>Test
for html serializer with entities</title>
<meta http-equiv="content-type" content="text/html; charset="><title>Test for html serializer with entities</title>
</head><body>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability
with older products that don't support &alpha; and friends.</p>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability with older products that don't support &alpha; and friends.</p>
<p>latin1 &iexcl; &cent; &pound; &curren; &yen; &brvbar; &sect; &uml;
&copy; &ordf; &laquo; &not; &shy; &reg; &macr; &deg; &plusmn; &sup2;

View File

@ -1,11 +1,9 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset="><title>Test
for html serializer with entities</title>
<meta http-equiv="content-type" content="text/html; charset="><title>Test for html serializer with entities</title>
</head><body>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability
with older products that don't support &alpha; and friends.</p>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability with older products that don't support &alpha; and friends.</p>
<p>latin1 &iexcl; &cent; &pound; &curren; &yen; &brvbar; &sect; &uml;
&copy; &ordf; &laquo; &not; &shy; &reg; &macr; &deg; &plusmn; &sup2;

View File

@ -1,11 +1,9 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset="><title>Test
for html serializer with entities</title>
<meta http-equiv="content-type" content="text/html; charset="><title>Test for html serializer with entities</title>
</head><body>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability
with older products that don't support α and friends.</p>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability with older products that don't support α and friends.</p>
<p>latin1 &iexcl; &cent; &pound; &curren; &yen; &brvbar; &sect; &uml;
&copy; &ordf; &laquo; &not; &shy; &reg; &macr; &deg; &plusmn; &sup2;

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Testcase for IPv6 addresses</title>
</head><body>
<a href="http://[2001:4860:a003::68]/">Test</a>

View File

@ -3,10 +3,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -30,8 +28,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -46,10 +43,8 @@ ut gravida eros <br />leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em>
ullamcorper laoreet.<br/>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em> ullamcorper laoreet.<br/>
Cras quis<br/>
nisi at odio<br/>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non

View File

@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -38,8 +36,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -54,10 +51,8 @@ ut gravida eros <br />leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em>
ullamcorper laoreet.<br/>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em> ullamcorper laoreet.<br/>
Cras quis<br/>
nisi at odio<br/>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non

View File

@ -11,11 +11,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a
href="http://mochi.test:8888/tests/content/base/test/file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="http://mochi.test:8888/tests/content/base/test/file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -39,8 +36,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -55,10 +51,8 @@ ut gravida eros <br />leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em>
ullamcorper laoreet.<br/>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em> ullamcorper laoreet.<br/>
Cras quis<br/>
nisi at odio<br/>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non

View File

@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -38,8 +36,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -54,10 +51,8 @@ ut gravida eros <br />leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em>
ullamcorper laoreet.<br/>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em> ullamcorper laoreet.<br/>
Cras quis<br/>
nisi at odio<br/>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non

View File

@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -38,8 +36,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -54,10 +51,8 @@ ut gravida eros <br />leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em>
ullamcorper laoreet.<br/>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em> ullamcorper laoreet.<br/>
Cras quis<br/>
nisi at odio<br/>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non

View File

@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -38,8 +36,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -58,10 +55,8 @@ ut gravida eros <br />leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em>
ullamcorper laoreet.<br/>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em> ullamcorper laoreet.<br/>
Cras quis<br/>
nisi at odio<br/>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non

View File

@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -38,8 +36,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -54,10 +51,8 @@ ut gravida eros <br />leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em>
ullamcorper laoreet.<br/>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em> ullamcorper laoreet.<br/>
Cras quis<br/>
nisi at odio<br/>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non

View File

@ -3,10 +3,8 @@
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
nostra, per inceptos hymenaeos. </p>
@ -30,8 +28,7 @@ var d = a < b && a > c;
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
@ -46,10 +43,8 @@ ut gravida eros <br />leo ut libero
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em>
ullamcorper laoreet.<br/>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em> ullamcorper laoreet.<br/>
Cras quis<br/>
nisi at odio<br/>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Test for html serializer</title>
</head>
<body>
<p>Hello world</p> <p>
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
ad
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
conubia</a>
nostra, per inceptos hymenaeos. </p>
<ul><li>Nam tellus massa,éàèçù</li><li>
fringilla
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
<script id="script" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
// a script which does nothing
function nothing() {
var hey="hello";
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
}
var a=3, b=4, c=7;
// here we test the non-serialization of xml character into javascript content
var d = a < b && a > c;
//]]>
</script>
<ol><li>Fusce
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum
posuere nulla</li><li> Donec tempor.</li></ol>
Donec sollicitudin tortor
<!-- test on
comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br />
nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br />
lacus risus pulvinar ante.
</pre>
ut gravida eros <br />leo ut libero
<!-- empty element: end tag should be generated for backward compatibility with HTML -->
<p></p>
<noscript>
<p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript>
<p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
<pre xmlns="http://mozilla.org/ns/foo">lacinia <em>libero</em>
ullamcorper laoreet.<br/>
Cras quis<br/>
nisi at odio<br/>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br/>
lacus risus pulvinar ante.
</pre>
</body>
</html>

View File

@ -7,8 +7,7 @@
</head>
<body>
<p>The basic set is just " " &amp; &lt; &gt; " for interoperability with
older products that don't support α and friends.</p>
<p>The basic set is just " " &amp; &lt; &gt; " for interoperability with older products that don't support α and friends.</p>
<p>latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´
µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ

View File

@ -7,8 +7,7 @@
</head>
<body>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability
with older products that don't support &alpha; and friends.</p>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability with older products that don't support &alpha; and friends.</p>
<p>latin1 &iexcl; &cent; &pound; &curren; &yen; &brvbar; &sect; &uml;
&copy; &ordf; &laquo; &not; &shy; &reg; &macr; &deg; &plusmn; &sup2;

View File

@ -7,8 +7,7 @@
</head>
<body>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability
with older products that don't support &alpha; and friends.</p>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability with older products that don't support &alpha; and friends.</p>
<p>latin1 &iexcl; &cent; &pound; &curren; &yen; &brvbar; &sect; &uml;
&copy; &ordf; &laquo; &not; &shy; &reg; &macr; &deg; &plusmn; &sup2;

View File

@ -7,8 +7,7 @@
</head>
<body>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability
with older products that don't support α and friends.</p>
<p>The basic set is just &nbsp; &amp; &lt; &gt; " for interoperability with older products that don't support α and friends.</p>
<p>latin1 &iexcl; &cent; &pound; &curren; &yen; &brvbar; &sect; &uml;
&copy; &ordf; &laquo; &not; &shy; &reg; &macr; &deg; &plusmn; &sup2;

View File

@ -86,10 +86,9 @@ function testHtmlSerializer_1 () {
//------------ OutputWrap
// by default, this flag is set, so we should have the same result as
// when there are no flags.
encoder.init(doc, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputWrap);
out = encoder.encodeToString();
expected = loadFileContent("file_xhtmlserializer_1_wrap.xhtml");
is(out, expected, "test OutputWrap");
//------------ OutputFormatted

View File

@ -92,20 +92,20 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = 'This is a <em xmlns=\"http://www.w3.org/1999/xhtml\">draggable</em> bit of\n text.';
expected = 'This is a <em xmlns=\"http://www.w3.org/1999/xhtml\">draggable</em> bit of text.';
is(out, expected, "test selection");
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(null);
encoder.setContainerNode(node);
out = encoder.encodeToString();
expected = 'This is a <em xmlns=\"http://www.w3.org/1999/xhtml\">draggable</em> bit of\n text.';
expected = 'This is a <em xmlns=\"http://www.w3.org/1999/xhtml\">draggable</em> bit of text.';
is(out, expected, "test container node");
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
expected = "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"draggable\" \nondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em> \nbit of text.</div>";
expected = "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em> bit of text.</div>";
is(out, expected, "test node");
node = document.getElementById('aList');
@ -116,20 +116,20 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '\n <li xmlns=\"http://www.w3.org/1999/xhtml\">Lorem ipsum dolor</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">sit amet, <strong>consectetuer</strong>\n </li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">adipiscing elit</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">Nam eu sapien. Sed viverra \nlacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. \nClass</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">aptent taciti</li>\n';
expected = '\n <li xmlns=\"http://www.w3.org/1999/xhtml\">Lorem ipsum dolor</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">sit amet, <strong>consectetuer</strong> </li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">adipiscing elit</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">aptent taciti</li>\n';
is(out, expected, "test list selection");
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(null);
encoder.setContainerNode(node);
out = encoder.encodeToString();
expected = '\n <li xmlns=\"http://www.w3.org/1999/xhtml\">Lorem ipsum dolor</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">sit amet, <strong>consectetuer</strong>\n </li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">adipiscing elit</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">Nam eu sapien. Sed viverra \nlacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. \nClass</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">aptent taciti</li>\n';
expected = '\n <li xmlns=\"http://www.w3.org/1999/xhtml\">Lorem ipsum dolor</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">sit amet, <strong>consectetuer</strong> </li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">adipiscing elit</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li xmlns=\"http://www.w3.org/1999/xhtml\">aptent taciti</li>\n';
is(out, expected, "test list container node");
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
expected = "<ol xmlns=\"http://www.w3.org/1999/xhtml\" id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>";
expected = "<ol xmlns=\"http://www.w3.org/1999/xhtml\" id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>";
is(out, expected, "test list node");
var liList = node.getElementsByTagName("li");
@ -143,7 +143,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol xmlns=\"http://www.w3.org/1999/xhtml\" id="aList"><li>Lorem ipsum \ndolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol xmlns=\"http://www.w3.org/1999/xhtml\" id="aList"><li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the first child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol
@ -152,7 +152,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol xmlns=\"http://www.w3.org/1999/xhtml\" id="aList"><li>sit amet, <strong>consectetuer</strong>\n </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol xmlns=\"http://www.w3.org/1999/xhtml\" id="aList"><li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol");
@ -163,7 +163,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol xmlns=\"http://www.w3.org/1999/xhtml\" id="aList" start="5"><li>sit \namet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol xmlns=\"http://www.w3.org/1999/xhtml\" id="aList" start="5"><li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");
@ -174,7 +174,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<li xmlns=\"http://www.w3.org/1999/xhtml\">sit amet, <strong>consectetuer</strong>\n </li>\n ';
expected = '<li xmlns=\"http://www.w3.org/1999/xhtml\">sit amet, <strong>consectetuer</strong> </li>\n ';
is(out, expected, "test list selection with range: selection contains only some child of the ol");

View File

@ -91,10 +91,9 @@ function testHtmlSerializer_1 () {
//------------ OutputWrap
// by default, this flag is set, so we should have the same result as
// when there are no flags.
encoder.init(doc, "text/html", de.OutputLFLineBreak |de.OutputWrap);
out = encoder.encodeToString();
expected = loadFileContent("file_htmlserializer_1_wrap.html");
isRoughly(out, expected, "test OutputWrap");
//------------ OutputFormatted

View File

@ -111,7 +111,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
expected = "<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em>\n bit of text.</div>";
expected = "<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em> bit of text.</div>";
is(out, expected, "test node");
node = document.getElementById('aList');
@ -122,20 +122,20 @@ function testHtmlSerializer_1 () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n';
expected = '\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n';
is(out, expected, "test list selection");
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(null);
encoder.setContainerNode(node);
out = encoder.encodeToString();
expected = '\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n';
expected = '\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n';
is(out, expected, "test list container node");
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
expected = "<ol id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>";
expected = "<ol id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>";
is(out, expected, "test list node");
var liList = node.getElementsByTagName("li");
@ -149,7 +149,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol id="aList"><li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol id="aList"><li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the first child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol
@ -158,7 +158,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol id="aList"><li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol id="aList"><li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol");
@ -169,7 +169,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol start="5" id="aList"><li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol start="5" id="aList"><li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");

View File

@ -90,7 +90,7 @@ function testSerializer () {
encoder.init(doc, "text/html", de.OutputLFLineBreak);
encoder.setCharset("UTF-8");
result = encoder.encodeToString();
expected = '<html><head><meta http-equiv=\"content-type\" content=\"text/html; \ncharset=UTF-8\">\n <title>Test</title>\n';
expected = '<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n <title>Test</title>\n';
expected += ' <link rel=\"Top\" href=\"\"> ';
expected += ' </head><body>foo \n\n\n <p>Hello world</p>\n</body></html>';
is(result, expected, "serialization of a link element with content, inside an html document");

View File

@ -65,7 +65,7 @@ function testCopyPaste () {
transferable.getTransferData ("text/html", data, {} ) ;
is (data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
"<div id=\"draggable\" title=\"title to have a long HTML line\">This is a <em>draggable</em>\n bit of text.</div>",
"<div id=\"draggable\" title=\"title to have a long HTML line\">This is a <em>draggable</em> bit of text.</div>",
"text/html value in the clipboard");
// let's paste now in the textarea and verify its content

View File

@ -40,7 +40,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
expected = "<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em>\n bit of text.</div>";
expected = "<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em> bit of text.</div>";
is(out, expected, "test node");
var select = window.getSelection();
@ -49,7 +49,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = "<div style=\"display: none;\">\n\n<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em>\n bit of text.</div>\n\n</div>";
expected = "<div style=\"display: none;\">\n\n<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em> bit of text.</div>\n\n</div>";
is(out, expected, "test selection");
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputAbsoluteLinks | de.OutputEncodeHTMLEntities | de.OutputSelectionOnly | de.OutputRaw);
@ -63,7 +63,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = "<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em>\n bit of text.</div>";
expected = "<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em> bit of text.</div>";
is(out, expected, "test selection with additional data");
node = document.getElementById('aList');
@ -74,19 +74,19 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection");
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setContainerNode(node);
out = encoder.encodeToString();
expected = '\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n';
expected = '\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n';
is(out, expected, "test list container node");
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
expected = "<ol id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>";
expected = "<ol id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>";
is(out, expected, "test list node");
var liList = node.getElementsByTagName("li");
@ -100,7 +100,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol id="aList">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol id="aList">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the first child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol
@ -109,7 +109,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol id="aList"><li value=\"2\">sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol id="aList"><li value=\"2\">sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol");
@ -120,7 +120,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol start=\"5\" id=\"aList\"><li value=\"6\">sit amet, <strong>consectetuer</strong>\n </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol start=\"5\" id=\"aList\"><li value=\"6\">sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");
// selection contains only some child of the ol
@ -154,7 +154,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol id=\"aList\">\n <li value=\"8\">Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol id=\"aList\">\n <li value=\"8\">Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with a value on a LI");
//test Bug 436703

View File

@ -44,7 +44,7 @@ function testHtmlCopyEncoder () {
// right order but the html serializer serializes in the reverse order
// (because the html parser stores the attribute in the reverse order,
// see bug 213347 for reason).
expected = "<div ondragstart=\"doDragStartSelection(event)\" id=\"draggable\">This is a <em>draggable</em>\n <br>bit of text.</div>";
expected = "<div ondragstart=\"doDragStartSelection(event)\" id=\"draggable\">This is a <em>draggable</em> <br>bit of text.</div>";
is(out, expected, "test node");
var select = window.getSelection();
@ -53,7 +53,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = "<div style=\"display: none;\">\n\n<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em>\n <br>bit of text.</div>\n\n</div>";
expected = "<div style=\"display: none;\">\n\n<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em> <br>bit of text.</div>\n\n</div>";
todo_is(out, expected, "test selection");
node.nextSibling.data="\nfoo bar\n";
@ -77,13 +77,13 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html",de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setContainerNode(node);
out = encoder.encodeToString();
expected = '\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n';
expected = '\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n';
is(out, expected, "test list container node");
encoder.init(document, "text/html",de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
expected = "<ol id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>";
expected = "<ol id=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>";
is(out, expected, "test list node");
var liList = node.getElementsByTagName("li");
@ -97,7 +97,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html",de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol id="aList">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol id="aList">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
todo_is(out, expected, "test list selection with range: selection start at the first child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol
@ -106,7 +106,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html",de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol id="aList"><li value=\"2\">sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol id="aList"><li value=\"2\">sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
todo_is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol");
@ -117,7 +117,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html",de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
expected = '<ol start=\"5\" id=\"aList\"><li value=\"6\">sit amet, <strong>consectetuer</strong>\n </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '<ol start=\"5\" id=\"aList\"><li value=\"6\">sit amet, <strong>consectetuer</strong>\n </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
todo_is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");