Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit36ff984

Browse files
committed
Implement r3895: Dropped <dialog>. (also added <dc> and <ds>)
1 parent9aef358 commit36ff984

File tree

2 files changed

+35
-29
lines changed

2 files changed

+35
-29
lines changed

‎SPEC

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
3852
1+
3859
22

33
This is the last revision of the spec this library has been audited against.
44

‎library/HTML5/TreeBuilder.php

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ class HTML5_TreeBuilder {
6464

6565
private$scoping =array('applet','button','caption','html','marquee','object','table','td','th','svg:foreignObject');
6666
private$formatting =array('a','b','big','code','em','font','i','nobr','s','small','strike','strong','tt','u');
67+
// dl and ds are speculative
6768
private$special =array('address','area','article','aside','base','basefont','bgsound',
68-
'blockquote','body','br','center','col','colgroup','command','dd','details','dialog','dir','div','dl',
69+
'blockquote','body','br','center','col','colgroup','command','dc','dd','details','dir','div','dl','ds',
6970
'dt','embed','fieldset','figure','footer','form','frame','frameset','h1','h2','h3','h4','h5',
7071
'h6','head','header','hgroup','hr','iframe','img','input','isindex','li','link',
7172
'listing','menu','meta','nav','noembed','noframes','noscript','ol',
@@ -752,6 +753,10 @@ public function emitToken($token, $mode = null) {
752753
// parse error
753754
break;
754755

756+
case HTML5_Tokenizer::EOF:
757+
// parse error
758+
break;
759+
755760
case HTML5_Tokenizer::STARTTAG:
756761
switch($token['name']) {
757762
case'html':
@@ -830,7 +835,7 @@ public function emitToken($token, $mode = null) {
830835
// in spec, there is a diversion here
831836

832837
case'address':case'article':case'aside':case'blockquote':
833-
case'center':case'datagrid':case'details':case'dialog':case'dir':
838+
case'center':case'datagrid':case'details':case'dir':
834839
case'div':case'dl':case'fieldset':case'figure':case'footer':
835840
case'header':case'hgroup':case'menu':case'nav':
836841
case'ol':case'p':case'section':case'ul':
@@ -921,7 +926,7 @@ public function emitToken($token, $mode = null) {
921926
break;
922927

923928
// condensed specification
924-
case'li':case'dd':case'dt':
929+
case'li':case'dc':case'dd':case'ds':case'dt':
925930
/* 1. Set the frameset-ok flag to "not ok". */
926931
$this->flag_frameset_ok =false;
927932

@@ -937,12 +942,12 @@ public function emitToken($token, $mode = null) {
937942
/* 3. If node is an li element, then act as if an end
938943
* tag with the tag name "li" had been seen, then jump
939944
* to the last step. */
940-
// for case 'dd': case 'dt':
941-
/* If node is add or dt element, then act as if an end
945+
// for case 'dc': case 'dd': case 'ds': case 'dt':
946+
/* If node is adc, dd, ds or dt element, then act as if an end
942947
* tag with the same tag name as node had been seen, then
943948
* jump to the last step. */
944949
if(($token['name'] ==='li' &&$node->tagName ==='li') ||
945-
($token['name'] !=='li' && ($node->tagName ==='dd' ||$node->tagName ==='dt'))) {// limited conditional
950+
($token['name'] !=='li' && ($node->tagName =='dc' ||$node->tagName ==='dd' ||$node->tagName =='ds' ||$node->tagName ==='dt'))) {// limited conditional
946951
$this->emitToken(array(
947952
'type' => HTML5_Tokenizer::ENDTAG,
948953
'name' =>$node->tagName,
@@ -1463,20 +1468,21 @@ public function emitToken($token, $mode = null) {
14631468
switch($token['name']) {
14641469
/* An end tag with the tag name "body" */
14651470
case'body':
1466-
/* If thesecond element in thestack of open elementsis
1467-
not a bodyelement, this is a parse error. Ignore thetoken.
1468-
(innerHTML case) */
1469-
if(count($this->stack) <2 ||$this->stack[1]->tagName !=='body') {
1471+
/* If the stack of open elementsdoes not have a body
1472+
*element in scope, this is a parse error; ignore the
1473+
* token. */
1474+
if(!$this->elementInScope('body')) {
14701475
$this->ignored =true;
14711476

1472-
/* Otherwise, if there is a node in the stack of open
1473-
* elements that is not either a dd element, a dt
1474-
* element, an li element, an optgroup element, an
1475-
* option element, a p element, an rp element, an rt
1476-
* element, a tbody element, a td element, a tfoot
1477-
* element, a th element, a thead element, a tr element,
1478-
* the body element, or the html element, then this is a
1479-
* parse error. */
1477+
/* Otherwise, if there is a node in the stack of open
1478+
* elements that is not either a dc element, a dd element,
1479+
* a ds element, a dt element, an li element, an optgroup
1480+
* element, an option element, a p element, an rp element,
1481+
* an rt element, a tbody element, a td element, a tfoot
1482+
* element, a th element, a thead element, a tr element,
1483+
* the body element, or the html element, then this is a
1484+
* parse error.
1485+
*/
14801486
}else {
14811487
// XERROR: implement this check for parse error
14821488
}
@@ -1500,7 +1506,7 @@ public function emitToken($token, $mode = null) {
15001506

15011507
case'address':case'article':case'aside':case'blockquote':
15021508
case'center':case'datagrid':case'details':case'dir':
1503-
case'div':case'dl':case'fieldset':case'figure':case'footer':
1509+
case'div':case'dl':case'fieldset':case'footer':
15041510
case'header':case'hgroup':case'listing':case'menu':
15051511
case'nav':case'ol':case'pre':case'section':case'ul':
15061512
/* If the stack of open elements has an element in scope
@@ -1603,8 +1609,8 @@ public function emitToken($token, $mode = null) {
16031609
}
16041610
break;
16051611

1606-
/* An end tag whose tag name is "dd", "dt",or "li" */
1607-
case'dd':case'dt':
1612+
/* An end tag whose tag name is "dc", "dd", "ds","dt" */
1613+
case'dc':case'dd':case'ds':case'dt':
16081614
if($this->elementInScope($token['name'])) {
16091615
$this->generateImpliedEndTags(array($token['name']));
16101616

@@ -2863,7 +2869,7 @@ public function emitToken($token, $mode = null) {
28632869
}elseif ($token['type'] === HTML5_Tokenizer::EOF || (
28642870
$token['type'] === HTML5_Tokenizer::STARTTAG &&
28652871
(in_array($token['name'],array('b',"big","blockquote","body","br",
2866-
"center","code","dd","div","dl","dt","em","embed","h1","h2",
2872+
"center","code","dc","dd","div","dl","ds","dt","em","embed","h1","h2",
28672873
"h3","h4","h5","h6","head","hr","i","img","li","listing",
28682874
"menu","meta","nobr","ol","p","pre","ruby","s","small",
28692875
"span","strong","strike","sub","sup","table","tt","u","ul",
@@ -3341,13 +3347,13 @@ private function clearTheActiveFormattingElementsUpToTheLastMarker() {
33413347
}
33423348

33433349
privatefunctiongenerateImpliedEndTags($exclude =array()) {
3344-
/* When the steps below require the UA to generate implied end tags,
3345-
then,if the current node is add element, adt element,an li element,
3346-
a p element, atd element,a thelement,or a trelement,the UA must
3347-
act as if an end tag with the respective tag name had been seen and
3348-
then generate implied end tags again. */
3350+
/* When the steps below require the UA to generate implied end tags,
3351+
*then,while the current node is adc element, add element,a ds
3352+
* element, adt element,an lielement,an optionelement,an optgroup
3353+
* element, a p element, an rp element, or an rt element, the UA must
3354+
* pop the current node off the stack of open elements. */
33493355
$node =end($this->stack);
3350-
$elements =array_diff(array('dd','dt','li','p','td','th','tr'),$exclude);
3356+
$elements =array_diff(array('dc','dd','ds','dt','li','p','td','th','tr'),$exclude);
33513357

33523358
while(in_array(end($this->stack)->tagName,$elements)) {
33533359
array_pop($this->stack);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp