Bug 612528 - Make <option> and <optgroup> imply </option> in the "in body" insertion mode only if the current node is "option". rs=jonas, a=blocking2.0-betaN.

This commit is contained in:
Henri Sivonen 2010-12-09 11:27:58 +02:00
parent 854b09ec25
commit 69594f3f8f
3 changed files with 4 additions and 58 deletions

View File

@ -2172,45 +2172,10 @@ public abstract class TreeBuilder<T> implements TokenHandler,
break starttagloop;
case OPTGROUP:
case OPTION:
/*
* If the stack of open elements has an option
* element in scope, then act as if an end tag
* with the tag name "option" had been seen.
*/
if (findLastInScope("option") != TreeBuilder.NOT_FOUND_ON_STACK) {
optionendtagloop: for (;;) {
if (isCurrent("option")) {
pop();
break optionendtagloop;
}
eltPos = currentPtr;
for (;;) {
if (stack[eltPos].name == "option") {
generateImpliedEndTags();
if (errorHandler != null
&& !isCurrent("option")) {
errNoCheck("End tag \u201C"
+ name
+ "\u201D seen but there were unclosed elements.");
}
while (currentPtr >= eltPos) {
pop();
}
break optionendtagloop;
}
eltPos--;
}
}
if (isCurrent("option")) {
pop();
}
/*
* Reconstruct the active formatting elements,
* if any.
*/
reconstructTheActiveFormattingElements();
/*
* Insert an HTML element for the token.
*/
appendToCurrentNodeAndPushElementMayFoster(
elementName,
attributes);

View File

@ -1205,26 +1205,8 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
}
case NS_HTML5TREE_BUILDER_OPTGROUP:
case NS_HTML5TREE_BUILDER_OPTION: {
if (findLastInScope(nsHtml5Atoms::option) != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) {
for (; ; ) {
if (isCurrent(nsHtml5Atoms::option)) {
pop();
NS_HTML5_BREAK(optionendtagloop);
}
eltPos = currentPtr;
for (; ; ) {
if (stack[eltPos]->name == nsHtml5Atoms::option) {
generateImpliedEndTags();
while (currentPtr >= eltPos) {
pop();
}
NS_HTML5_BREAK(optionendtagloop);
}
eltPos--;
}
}
optionendtagloop_end: ;
if (isCurrent(nsHtml5Atoms::option)) {
pop();
}
reconstructTheActiveFormattingElements();
appendToCurrentNodeAndPushElementMayFoster(elementName, attributes);

View File

@ -7,6 +7,5 @@
var html5Exceptions = {
"<!doctype html><keygen><frameset>" : true, // Bug 101019
"<select><keygen>" : true, // Bug 101019
"<option><span><option>" : true, // Bug 612528
"<!doctype html><div><body><frameset>" : true, // Bug 614241
}