Skip to content

Commit c3db4cb

Browse files
committed
Update upgradeRelTagToCategory() to avoid adding elements to parsed e-*
Fixed test to include the original rel=tag HTML/text
1 parent b086f75 commit c3db4cb

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Mf2/Parser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,8 +1340,8 @@ public function upgradeRelTagToCategory(DOMElement $el) {
13401340
$dataEl->setAttribute('class', 'category');
13411341
$dataEl->setAttribute('value', $value);
13421342

1343-
# append before the current element
1344-
$tempEl->parentNode->insertBefore($dataEl, $tempEl);
1343+
# append as child of input element. this should ensure added element does get parsed inside e-*
1344+
$el->appendChild($dataEl);
13451345
}
13461346
}
13471347
}

tests/Mf2/ClassicMicroformatsTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,7 @@ public function testHEntryRelTagInContent() {
892892
$input = <<< END
893893
<article class="hentry">
894894
<div class="entry-content">
895-
Entry content should not include the generated <code>data</code> element for rel tag backcompat
896-
<a href="/tag/test" rel="tag">test</a>
895+
Entry content should not include the generated <code>data</code> element for rel tag backcompat <a href="/tag/test" rel="tag">test</a>
897896
</div>
898897
</article>
899898
END;
@@ -903,8 +902,8 @@ public function testHEntryRelTagInContent() {
903902
$item = $output['items'][0];
904903

905904
$this->assertEquals(['test'], $item['properties']['category']);
906-
$this->assertEquals('Entry content should not include the generated data element for rel tag backcompat', $item['properties']['content'][0]['value']);
907-
$this->assertEquals('Entry content should not include the generated <code>data</code> element for rel tag backcompat', $item['properties']['content'][0]['html']);
905+
$this->assertEquals('Entry content should not include the generated data element for rel tag backcompat test', $item['properties']['content'][0]['value']);
906+
$this->assertEquals('Entry content should not include the generated <code>data</code> element for rel tag backcompat <a href="/tag/test" rel="tag">test</a>', $item['properties']['content'][0]['html']);
908907
}
909908

910909
/**

0 commit comments

Comments
 (0)