Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add [TreatNullAs=EmptyString] for innerHTML/outerHTML.

  • Loading branch information...
commit 34f0f81740670c8f2896bac9fc49d7aa36c4fe70 1 parent d9d08ee
@Ms2ger Ms2ger authored
View
10 domparser
@@ -10,7 +10,7 @@
<body>
<div class=head>
<h1>DOM Parsing and Serialization</h1>
-<h2 class="no-num no-toc" id=living-standard-&mdash;-last-updated-28-november-2012>Living Standard &mdash; Last Updated 28 November 2012</h2>
+<h2 class="no-num no-toc" id=living-standard-&mdash;-last-updated-24-december-2012>Living Standard &mdash; Last Updated 24 December 2012</h2>
<dl>
<dt>This Version:
<dd><a href=http://domparsing.spec.whatwg.org/>http://domparsing.spec.whatwg.org/</a>
@@ -34,7 +34,7 @@
<p class=copyright><a href=http://creativecommons.org/publicdomain/zero/1.0/ rel=license><img alt=CC0 src=http://i.creativecommons.org/p/zero/1.0/80x15.png></a>
To the extent possible under law, the editors have waived all copyright and
related or neighboring rights to this work. In addition, as of
-28 November 2012, the editors have made this specification available
+24 December 2012, the editors have made this specification available
under the
<a href=http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0 rel=license>Open Web Foundation Agreement Version 1.0</a>,
which is available at
@@ -520,8 +520,8 @@ method must
<h2 id=extensions-to-the-element-interface><span class=secno>6 </span>Extensions to the <a href=http://dom.spec.whatwg.org/#element><code class=external data-anolis-spec=dom>Element</code></a> interface</h2>
<pre class=idl>partial interface <a class=external data-anolis-spec=dom href=http://dom.spec.whatwg.org/#element>Element</a> {
- attribute DOMString <a href=#dom-element-innerhtml title=dom-Element-innerHTML>innerHTML</a>;
- attribute DOMString <a href=#dom-element-outerhtml title=dom-Element-outerHTML>outerHTML</a>;
+ [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-element-innerhtml title=dom-Element-innerHTML>innerHTML</a>;
+ [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-element-outerhtml title=dom-Element-outerHTML>outerHTML</a>;
void <a href=#dom-element-insertadjacenthtml title=dom-Element-insertAdjacentHTML>insertAdjacentHTML</a>(DOMString <var title="">position</var>, DOMString <var title="">text</var>);
};</pre>
@@ -977,7 +977,7 @@ method must run these steps:
<h2 class=no-num id=acknowledgements>Acknowledgements</h2>
<p>Thanks to
-Anne van Kesteren, Aryeh Gregor, Henri Sivonen, Ryosuke Niwa, Simon Pieters and timeless
+Anne van Kesteren, Aryeh Gregor, Boris Zbarsky, Henri Sivonen, Ryosuke Niwa, Simon Pieters and timeless
for their useful comments.
<p>Special thanks to Ian Hickson for defining the
View
6 source.html
@@ -500,8 +500,8 @@ <h2 class=no-num>Issues</h2>
<h2>Extensions to the <code data-anolis-spec=dom>Element</code> interface</h2>
<pre class=idl>partial interface <span data-anolis-spec=dom>Element</span> {
- attribute DOMString <span title=dom-Element-innerHTML>innerHTML</span>;
- attribute DOMString <span title=dom-Element-outerHTML>outerHTML</span>;
+ [TreatNullAs=EmptyString] attribute DOMString <span title=dom-Element-innerHTML>innerHTML</span>;
+ [TreatNullAs=EmptyString] attribute DOMString <span title=dom-Element-outerHTML>outerHTML</span>;
void <span title=dom-Element-insertAdjacentHTML>insertAdjacentHTML</span>(DOMString <var title>position</var>, DOMString <var title>text</var>);
};</pre>
@@ -945,7 +945,7 @@ <h2 class=no-num>References</h2>
<h2 class=no-num>Acknowledgements</h2>
<p>Thanks to
-Anne van Kesteren, Aryeh Gregor, Henri Sivonen, Ryosuke Niwa, Simon Pieters and timeless
+Anne van Kesteren, Aryeh Gregor, Boris Zbarsky, Henri Sivonen, Ryosuke Niwa, Simon Pieters and timeless
for their useful comments.
<p>Special thanks to Ian Hickson for defining the
View
2  tests/MANIFEST
@@ -5,8 +5,10 @@ innerhtml-03.xhtml
innerhtml-04.html
innerhtml-05.xhtml
innerhtml-06.html
+innerhtml-07.html
insert_adjacent_html.html
support insert_adjacent_html.js
insert_adjacent_html.xhtml
outerhtml-01.html
+outerhtml-02.html
dir support
View
0  tests/innerhtml-06.html 100755 → 100644
File mode changed
View
45 tests/innerhtml-07.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<title>innerHTML and string conversion</title>
+<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
+<link rel="help" href="http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ var p = document.createElement("p");
+ p.innerHTML = null;
+ assert_equals(p.innerHTML, "");
+ assert_equals(p.textContent, "");
+}, "innerHTML and string conversion: null.")
+test(function() {
+ var p = document.createElement("p");
+ p.innerHTML = undefined;
+ assert_equals(p.innerHTML, "undefined");
+ assert_equals(p.textContent, "undefined");
+}, "innerHTML and string conversion: undefined.")
+test(function() {
+ var p = document.createElement("p");
+ p.innerHTML = 42;
+ assert_equals(p.innerHTML, "42");
+ assert_equals(p.textContent, "42");
+}, "innerHTML and string conversion: number.")
+test(function() {
+ var p = document.createElement("p");
+ p.innerHTML = {
+ toString: function() { return "pass"; },
+ valueOf: function() { return "fail"; }
+ };
+ assert_equals(p.innerHTML, "pass");
+ assert_equals(p.textContent, "pass");
+}, "innerHTML and string conversion: toString.")
+test(function() {
+ var p = document.createElement("p");
+ p.innerHTML = {
+ toString: undefined,
+ valueOf: function() { return "pass"; }
+ };
+ assert_equals(p.innerHTML, "pass");
+ assert_equals(p.textContent, "pass");
+}, "innerHTML and string conversion: valueOf.")
+</script>
View
50 tests/outerhtml-02.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<title>outerHTML and string conversion</title>
+<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
+<link rel="help" href="http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+test(function() {
+ var div = document.createElement("div");
+ var p = div.appendChild(document.createElement("p"));
+ p.outerHTML = null;
+ assert_equals(div.innerHTML, "");
+ assert_equals(div.textContent, "");
+}, "outerHTML and string conversion: null.")
+test(function() {
+ var div = document.createElement("div");
+ var p = div.appendChild(document.createElement("p"));
+ p.outerHTML = undefined;
+ assert_equals(div.innerHTML, "undefined");
+ assert_equals(div.textContent, "undefined");
+}, "outerHTML and string conversion: undefined.")
+test(function() {
+ var div = document.createElement("div");
+ var p = div.appendChild(document.createElement("p"));
+ p.outerHTML = 42;
+ assert_equals(div.innerHTML, "42");
+ assert_equals(div.textContent, "42");
+}, "outerHTML and string conversion: number.")
+test(function() {
+ var div = document.createElement("div");
+ var p = div.appendChild(document.createElement("p"));
+ p.outerHTML = {
+ toString: function() { return "pass"; },
+ valueOf: function() { return "fail"; }
+ };
+ assert_equals(div.innerHTML, "pass");
+ assert_equals(div.textContent, "pass");
+}, "outerHTML and string conversion: toString.")
+test(function() {
+ var div = document.createElement("div");
+ var p = div.appendChild(document.createElement("p"));
+ p.outerHTML = {
+ toString: undefined,
+ valueOf: function() { return "pass"; }
+ };
+ assert_equals(div.innerHTML, "pass");
+ assert_equals(div.textContent, "pass");
+}, "outerHTML and string conversion: valueOf.")
+</script>
Please sign in to comment.
Something went wrong with that request. Please try again.