Permalink
Browse files

Fix #648 - fixing issue where meta tags having a property attribute w…

…as intermediately ordered so a final "grab deepest id dubplicate" would grab the exact opposite of what it should.
  • Loading branch information...
mawtex committed Jan 25, 2019
1 parent 1c27f5a commit 75858267bf04b07e2f55db59b7dfaca3ff903991
Showing with 1 addition and 4 deletions.
  1. +1 −4 Composite/Core/WebClient/Renderings/Page/PageRenderer.cs
@@ -642,11 +642,8 @@ public static void NormalizeXhtmlDocument(XhtmlDocument rootDocument)

rootDocument.Root.Add(nestedDocument.Attributes().Except(rootDocument.Root.Attributes(), _nameBasedAttributeComparer));

// making <meta property="..." /> from nested documents appear first. We will not filter them later and this ensure desired precedence
bool IsMetaProperty(XElement e) => e.Name.LocalName == "meta" && e.Attribute("property") != null;
rootDocument.Head.Add(nestedHead.Nodes());

rootDocument.Head.AddFirst(nestedHead.Elements().Where(IsMetaProperty));
rootDocument.Head.Add(nestedHead.Nodes().Where(f => !(f is XElement e && IsMetaProperty(e))));
rootDocument.Head.Add(nestedHead.Attributes().Except(rootDocument.Head.Attributes(), _nameBasedAttributeComparer));
rootDocument.Body.Add(nestedBody.Attributes().Except(rootDocument.Body.Attributes(), _nameBasedAttributeComparer));

0 comments on commit 7585826

Please sign in to comment.