Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge body attributes #58

Merged
merged 5 commits into from
Aug 29, 2017
Merged

Conversation

cborgolte
Copy link
Contributor

This fixes the issue, when multiple tags are merged with identical attributes.
'class' attributes are merged together, other duplicate attributes overwrite their predecessors.

This test reflects the behavior we are going to fix now.

- just for documentation -
When merging attributes of the <body> Element,
all existing class attributes will be merged into one.
All other existing attributes will be ov overwritten by new ones.
@cborgolte cborgolte requested a review from domano August 3, 2017 17:36
@@ -83,7 +83,7 @@ type Content interface {
Tail() Fragment

// The attributes for the body element
BodyAttributes() Fragment
BodyAttributes() []html.Attribute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking API change, please leave the old method and create BodyAttributesV2 or something

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 94.202% when pulling 5996df6 on cborgolte:merge-body-attributes into f05f8e2 on tarent:master.

BodyAttributes() Fragment

// Return the attributes for the body element as array.
BodyAttributesArray() []html.Attribute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still breaking the interface here

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 93.883% when pulling 4ea38de on cborgolte:merge-body-attributes into f05f8e2 on tarent:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 94.115% when pulling a848b09 on cborgolte:merge-body-attributes into f05f8e2 on tarent:master.

@@ -178,7 +202,12 @@ func (cntx *ContentMerge) GetBodyFragmentByName(name string) (Fragment, bool) {

func (cntx *ContentMerge) AddContent(c Content, priority int) {
cntx.addHead(c.Head())
cntx.addBodyAttributes(c.BodyAttributes())
content2, ok := c.(Content2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call it contentV2 to be clear that the naming choice is a result of a api change

@@ -99,6 +99,13 @@ type Content interface {
MemorySize() int
}

type Content2 interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would call it ContentV2, see above

@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 94.115% when pulling c85d73b on cborgolte:merge-body-attributes into f05f8e2 on tarent:master.

@domano domano merged commit 69430f9 into qvest-digital:master Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants