Skip to content

top-level className - #582

Merged
mbostock merged 4 commits into
mbostock/inline-stylesfrom
fil/top-level-className
Oct 26, 2021
Merged

mbostock merged 4 commits into
mbostock/inline-stylesfrom
fil/top-level-className

Conversation

@Fil

@Fil Fil commented Oct 25, 2021 •

Copy link
Copy Markdown
Contributor

Se discussion in #579 (review)

Comment thread src/style.js Outdated
}

export function validClassName(str) {
return typeof str === "string" &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would expect string coercion here instead of requiring the string type exactly.

I’m curious why we’re validating the class name? Is it just to avoid people using it to inject arbitrary styles into our style sheet? That seems reasonable if so.

@Fil Fil Oct 25, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I mainly wanted to avoid multiple classes (space-separated), which would break things. Then realized we didn't want curly brackets for the reason you're saying. Validating against the spec seemed like a good idea to avoid any shenanigans—maybe overkill tho. We can remove type check.

Base automatically changed from fil/inline-styles-test to mbostock/inline-styles October 26, 2021 02:09
@mbostock
mbostock merged commit 84bc745 into mbostock/inline-styles Oct 26, 2021
@mbostock
mbostock deleted the fil/top-level-className branch October 26, 2021 02:16
mbostock added a commit that referenced this pull request Oct 26, 2021
* inline styles; tabular nums

* inline styles test (#581)

* keep inline stylesheet

* inline stylesheets

* top-level className (#582)

* keep inline stylesheet

* inline stylesheets

* top-level className

* coerce className to string

Co-authored-by: Mike Bostock <mbostock@gmail.com>

Co-authored-by: Philippe Rivière <fil@rezo.net>
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