Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Parsing of the
rel
attribute has been improved by using WHATWG’s definition of splitting on whitespace. We also treat it as a set, which means we drop duplicate values. This might spare us a loop or two.The properties (
hreflang
,media
,title
,type
,text
) we add to therel-urls
object should only be added if they weren’t previously set. Overwriting order has been changed to accord with this.The test
testRelURLsInfoMergesCorrectly
is a simple check for the correct behaviour.The final
rels
array within therel-urls
object has been changed to contain only unique items, sorted alphabetically. This reflects the latest parsing specification change.The test
testRelURLsRelsUniqueAndSorted
is a simple check for both uniqueness and order.The arrays of URLs within the
rels
object should not contain duplicates. The code has been changed to not add any URLs that are already present in the array. Based on the following line in the parsing spec, that had me reread it thrice as a non-native English speaker:The test
testRelURLsNoDuplicates
is a simple check to make sure duplicate URLs aren’t added.Closes #159 if merged.