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

fix(core/dfn-panel): avoid using CSS variables #2888

Merged
merged 1 commit into from
May 20, 2020

Conversation

sidvishnoi
Copy link
Member

Reverts hot-fix from https://github.com/w3c/respec/pull/2846 (See https://github.com/w3c/respec/issues/2845)
Precursor to https://github.com/w3c/respec/pull/2820

This changes the markup for dfnPanel, mainly converts the caret to a <span> instead of ::before as we cannot programmatically set position of ::before without CSS variables - which aren't supported by nuHTML validator.

@sidvishnoi sidvishnoi changed the title fix(core/dfn-panel): workaround css-validator errors fix(core/dfn-panel): avoid using CSS variables May 20, 2020
@sidvishnoi sidvishnoi requested a review from saschanaz May 20, 2020 11:37
content: "";
position: absolute;
border: 10px solid transparent;
border-top: 0;
border-bottom: 9px solid #a2a9b1; /* triangle outline */
top: -9px;
left: calc(var(--caret-offset, 0px) + 0.75em); /* set via JS */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be better to use attr() in the future rather than just reverting this. Google just posted an intent to implement for the feature. https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/FGCgsKmylhw/BSUrk2roCQAJ

Since the validator is quite inactive, the browser implementation might be quicker.

Copy link
Collaborator

@saschanaz saschanaz May 20, 2020

Choose a reason for hiding this comment

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

Looking at the code, the validator already supports attr() so we probably can just use it when the browser support lands.

Copy link
Member Author

@sidvishnoi sidvishnoi May 20, 2020

Choose a reason for hiding this comment

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

Even though nuHTML allows advanced attr(), CSS validator doesn't yet.

This comment was marked as outdated.

Copy link
Collaborator

@saschanaz saschanaz May 20, 2020

Choose a reason for hiding this comment

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

Hey, actually it does validate it!

.abc {
  width: calc(attr(data-foo px) / 10);
}

Try this code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right! I missed the px suffix

@sidvishnoi sidvishnoi merged commit dbf0b49 into develop May 20, 2020
@sidvishnoi sidvishnoi deleted the fix/dfn-panel-nu-css branch May 20, 2020 11:53
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.

2 participants