From 116d48983e53cfde6bcce392cb1a8e10a322d174 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 12 Oct 2015 16:59:39 +0200 Subject: [PATCH] Avoid panicking in the implementation of HTMLOptionElement#text for non-element, non-text children. --- .../the-option-element/option-text-recurse.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/html/semantics/forms/the-option-element/option-text-recurse.html b/html/semantics/forms/the-option-element/option-text-recurse.html index 46baa8e1ce5bbe..cf854f5260bb2a 100644 --- a/html/semantics/forms/the-option-element/option-text-recurse.html +++ b/html/semantics/forms/the-option-element/option-text-recurse.html @@ -74,4 +74,19 @@ option.appendChild(document.createTextNode("text")); assert_equals(option.text, "text"); }, "option.text should work if the option is in a MathML script element"); + +test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode("te")); + option.appendChild(document.createComment("comment")); + option.appendChild(document.createTextNode("xt")); + assert_equals(option.text, "text"); +}, "option.text should ignore comment children"); +test(function() { + var option = document.createElement("option"); + option.appendChild(document.createTextNode("te")); + option.appendChild(document.createProcessingInstruction("target", "data")); + option.appendChild(document.createTextNode("xt")); + assert_equals(option.text, "text"); +}, "option.text should ignore PI children");