Skip to content
This repository has been archived by the owner on Mar 29, 2019. It is now read-only.

Commit

Permalink
Bug 787412 - HTMLOptionElement.prototype.text should use do a deep tr…
Browse files Browse the repository at this point in the history
…ee traversal; r=mounir
  • Loading branch information
Ms2ger committed Sep 6, 2012
1 parent ceda491 commit 39bf3c2
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion content/html/content/src/nsHTMLOptionElement.cpp
Expand Up @@ -260,7 +260,7 @@ NS_IMETHODIMP
nsHTMLOptionElement::GetText(nsAString& aText)
{
nsAutoString text;
nsContentUtils::GetNodeTextContent(this, false, text);
nsContentUtils::GetNodeTextContent(this, true, text);

// XXX No CompressWhitespace for nsAString. Sad.
text.CompressWhitespace(true, true);
Expand Down
3 changes: 2 additions & 1 deletion content/html/content/test/forms/Makefile.in
Expand Up @@ -32,13 +32,14 @@ MOCHITEST_FILES = \
test_maxlength_attribute.html \
test_datalist_element.html \
test_form_attributes_reflection.html \
test_option_disabled.html \
test_option_index_attribute.html \
test_option_text.html \
test_progress_element.html \
test_form_attribute-1.html \
test_form_attribute-2.html \
test_form_attribute-3.html \
test_form_attribute-4.html \
test_option_disabled.html \
test_meter_element.html \
test_meter_pseudo-classes.html \
test_max_attribute.html \
Expand Down
16 changes: 16 additions & 0 deletions content/html/content/test/forms/test_option_text.html
@@ -0,0 +1,16 @@
<!doctype html>
<meta charset=utf-8>
<title>HTMLOptionElement.text</title>
<link rel=author title=Ms2ger href="mailto:Ms2ger@gmail.com">
<link rel=help href="http://www.whatwg.org/html/#dom-option-text">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
test(function() {
var option = document.createElement("option");
option.appendChild(document.createElement("font"))
.appendChild(document.createTextNode(" font "));
assert_equals(option.text, "font");
});
</script>
1 change: 1 addition & 0 deletions layout/reftests/forms/reftest.list
Expand Up @@ -60,6 +60,7 @@ fails-if(Android) != textarea-rtl.html textarea-no-resize.html
== select-multiple.html select-multiple-ref.html
== select-boguskids.html select-boguskids-ref.html
== select-dynamic-boguskids.html select-boguskids-ref.html
== select-option-children.html select-option-children-ref.html

asserts(2) == button-first-letter-1.html button-first-letter-1-ref.html
asserts(1) != button-first-letter-1.html button-first-letter-1-noref.html
Expand Down
5 changes: 5 additions & 0 deletions layout/reftests/forms/select-option-children-ref.html
@@ -0,0 +1,5 @@
<!doctype html>
<meta charset=utf-8>
<title>Option elements with children</title>
<body>
<select><option>font</option></select>
11 changes: 11 additions & 0 deletions layout/reftests/forms/select-option-children.html
@@ -0,0 +1,11 @@
<!doctype html>
<meta charset=utf-8>
<title>Option elements with children</title>
<body>
<script>
document.body
.appendChild(document.createElement("select"))
.appendChild(document.createElement("option"))
.appendChild(document.createElement("font"))
.appendChild(document.createTextNode("font"))
</script>

0 comments on commit 39bf3c2

Please sign in to comment.