Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
2010-03-08 Kent Tamura <tkent@chromium.org>
Reviewed by Adam Barth. Implement HTML5 <hgroup> element. https://bugs.webkit.org/show_bug.cgi?id=32943 The new test file tests: - <p> closing, - Residual style, and - FormatBlock. * fast/html/hgroup-element-expected.txt: Added. * fast/html/hgroup-element.html: Added. * fast/html/script-tests/hgroup-element.js: Added. 2010-03-08 Kent Tamura <tkent@chromium.org> Reviewed by Adam Barth. Implement HTML5 <hgroup> element. https://bugs.webkit.org/show_bug.cgi?id=33369 <hgroup> should behave the same as <nav>, <section>, <article>, and <aside>. <hgroup> has no specific parsing rules. Test: fast/html/hgroup-element.html * css/html.css: Add hgroup as a block element. * editing/htmlediting.cpp: (WebCore::validBlockTag): Add hgroupTag. * html/HTMLElement.cpp: (WebCore::createTagPriorityMap): Returns 5 for hgroupTag. (WebCore::blockTagList): Add hgroupTag. * html/HTMLParser.cpp: (WebCore::HTMLParser::getNode): Add hgroupTag. * html/HTMLTagNames.in: Add hgroup. Canonical link: https://commits.webkit.org/47007@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
10 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,20 @@ | ||
Various tests for the hgroup element. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
<hgroup> closes <p>: | ||
PASS hgroup1.parentNode.nodeName == "p" is false | ||
<p> does not close <hgroup>: | ||
PASS p1.parentNode.nodeName is "HGROUP" | ||
<hgroup> can be nested inside <hgroup>: | ||
PASS hgroup3.parentNode.id is "hgroup2" | ||
Residual style: | ||
PASS getWeight("hgroup4") is "bold" | ||
PASS getWeight("span1") is "bold" | ||
FormatBlock: | ||
PASS document.getElementById("span2").parentNode.nodeName is "HGROUP" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> | ||
<script src="../../fast/js/resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script src="script-tests/hgroup-element.js"></script> | ||
<script src="../../fast/js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,44 @@ | ||
description('Various tests for the hgroup element.'); | ||
|
||
var testParent = document.createElement('div'); | ||
document.body.appendChild(testParent); | ||
|
||
debug('<hgroup> closes <p>:'); | ||
testParent.innerHTML = '<p>Test that <hgroup id="hgroup1"><h1>a hgroup element</h1></hgroup> closes <p>.</p>'; | ||
var hgroup1 = document.getElementById('hgroup1'); | ||
shouldBeFalse('hgroup1.parentNode.nodeName == "p"'); | ||
|
||
debug('<p> does not close <hgroup>:'); | ||
testParent.innerHTML = '<hgroup>Test that <p id="p1">a p element</p> does not close a hgroup element.</hgroup>'; | ||
var p1 = document.getElementById('p1'); | ||
shouldBe('p1.parentNode.nodeName', '"HGROUP"'); | ||
|
||
// Note: hgroup *should* have only h1-h6 elements, but *can* have any elements. | ||
debug('<hgroup> can be nested inside <hgroup>:'); | ||
testParent.innerHTML = '<hgroup id="hgroup2">Test that <hgroup id="hgroup3">a hgroup element</hgroup> can be nested inside another.</hgroup>'; | ||
var hgroup3 = document.getElementById('hgroup3'); | ||
shouldBe('hgroup3.parentNode.id', '"hgroup2"'); | ||
|
||
debug('Residual style:'); | ||
testParent.innerHTML = '<b><hgroup id="hgroup4"><h2>This text should be bold.</h2></hgroup> <span id="span1">This is also bold.</span></b>'; | ||
function getWeight(id) { | ||
return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('font-weight'); | ||
} | ||
shouldBe('getWeight("hgroup4")', '"bold"'); | ||
shouldBe('getWeight("span1")', '"bold"'); | ||
document.body.removeChild(testParent); | ||
|
||
debug('FormatBlock:'); | ||
var editable = document.createElement('div'); | ||
editable.innerHTML = '[<span id="span2">The text will be a child of <hgroup>.</span>]'; | ||
document.body.appendChild(editable); | ||
editable.contentEditable = true; | ||
var selection = window.getSelection(); | ||
selection.selectAllChildren(editable); | ||
document.execCommand('FormatBlock', false, 'hgroup'); | ||
selection.collapse(); | ||
shouldBe('document.getElementById("span2").parentNode.nodeName', '"HGROUP"'); | ||
document.body.removeChild(editable); | ||
|
||
var successfullyParsed = true; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -72,7 +72,7 @@ layer { | ||
display: block | ||
} | ||
|
||
article, aside, footer, header, nav, section { | ||
article, aside, footer, header, hgroup, nav, section { | ||
display: block | ||
} | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters