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

core(font-size): gather style declaration of type Attributes #9414

Merged
merged 3 commits into from
Jul 24, 2019

Conversation

connorjclark
Copy link
Collaborator

Attributes is a type for cssRule in the font-size artifact.

The audit checks for it here.

However, the gatherer never returned a rule of type Attributes. Instead, it was returning no cssRule (that property is optional) - which was fine because the audit handles it in the same way.

First thought was to just remove Attributes from the type property. But then I saw it was pretty simple to change the gatherer to be correct.

But ... it doesn't really convey much more information - just makes it more explicit - so I could go either way with this. The style declaration will look like this:

{ type: 'Attributes',
  range: undefined,
  styleSheetId: undefined,
  parentRule: undefined }

Also: I think this was the only reason cssRule was made optional - or is there another valid reason that it would not exist?

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

I suppose this LGTM!

Definitely a bit weird that the font-size audit result is identical whether we identify the style source or not, maybe that should change :)


result = FontSizeGather.getEffectiveFontRule({attributesStyle, inherited});
expect(result).toMatchObject({type: 'Attributes'});

result = FontSizeGather.getEffectiveFontRule({matchedCSSRules, inherited});
Copy link
Collaborator

Choose a reason for hiding this comment

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

want to throw attributesStyle in here to test the correct specificity?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@connorjclark
Copy link
Collaborator Author

connorjclark commented Jul 19, 2019

Definitely a bit weird that the font-size audit result is identical whether we identify the style source or not, maybe that should change :)

In either the Inline or Attributes case, we want to point to the node in the audit table. I'm not sure if doing anything special in Attributes (like annotating the result in the table with <font size=1> (attributes)) is ideal.

also font (the only way Attributes will happen here) is sooooo old should we care about making it look different?

@patrickhulce
Copy link
Collaborator

also font (the only way Attributes will happen here) is sooooo old should we care about making it look different?

fair points, I'm sold :)

Copy link
Member

@exterkamp exterkamp left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants