Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Mf2/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,8 @@ public function parseH(\DOMElement $e, $is_backcompat = false, $has_nested_mf =
}
}

// Make sure things are in alphabetical order
// Make sure things are unique and in alphabetical order
$mfTypes = array_unique($mfTypes);
sort($mfTypes);

// Phew. Return the final result.
Expand Down
10 changes: 10 additions & 0 deletions tests/Mf2/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,5 +766,15 @@ public function testMfClassRegex() {
$this->assertArrayHasKey('123-url', $output['items'][0]['properties']);
}

/**
* @see https://github.com/microformats/microformats2-parsing/issues/30
*/
public function testUniqueAndAlphabeticalMfClasses() {
$input = '<div class="h-entry h-cite h-entry"></div>';
$output = Mf2\parse($input);

$this->assertEquals(array('h-cite', 'h-entry'), $output['items'][0]['type']);
}

}